koha.git
8 months agoBug 34587: Move period total calculations to the backend to improve performance
Matt Blenkinsop [Fri, 4 Aug 2023 16:32:16 +0000 (16:32 +0000)]
Bug 34587: Move period total calculations to the backend to improve performance

Remove the front end processing in favour of doing this in the backend and passing it in the API response

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Make column options dependent on data_type
Matt Blenkinsop [Thu, 3 Aug 2023 16:45:41 +0000 (16:45 +0000)]
Bug 34587: Make column options dependent on data_type

In the reports builder you can select which columns you would like to display in a report. Not all columns are applicable to all data types so it needs limiting to only be selectable if that column is available for that data type

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Create tabs for new data types in ProvidersShow
Matt Blenkinsop [Thu, 3 Aug 2023 15:08:48 +0000 (15:08 +0000)]
Bug 34587: Create tabs for new data types in ProvidersShow

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Convert titles search to keyword search
Matt Blenkinsop [Thu, 3 Aug 2023 13:24:51 +0000 (13:24 +0000)]
Bug 34587: Convert titles search to keyword search

Now that we are harvesting more data types, "titles" search no longer applies and should become a keyword search able to work for any data type

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add list endpoints for usage_databases/items/platforms
Matt Blenkinsop [Thu, 3 Aug 2023 13:24:08 +0000 (13:24 +0000)]
Bug 34587: Add list endpoints for usage_databases/items/platforms

Needed to display lists in the provider tabs in the UI

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Abstract reports backend to allow new data types
Matt Blenkinsop [Wed, 2 Aug 2023 09:20:23 +0000 (09:20 +0000)]
Bug 34587: Abstract reports backend to allow new data types

Now that harvesting is possible for platforms, databases and items we need to be able to generate reports for all of these data types. Currently the reporting backend structure is very geared towards titles. Rather than copying this for each different data type, this patch abstracts the code to accept the data type as a url parameter and use that to generate a report based on a given data type

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add ability to delete saved reports
Matt Blenkinsop [Tue, 1 Aug 2023 09:14:36 +0000 (09:14 +0000)]
Bug 34587: Add ability to delete saved reports

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Cypress update
Matt Blenkinsop [Wed, 26 Jul 2023 13:26:03 +0000 (13:26 +0000)]
Bug 34587: Cypress update

Update the cypress tests to reflect recent changes

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: COUNTER file upload
Pedro Amorim [Thu, 20 Jul 2023 14:44:01 +0000 (14:44 +0000)]
Bug 34587: COUNTER file upload

Adds the ability to manually upload a counter file and harvest data to the provider

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Copy authorised value categories and authorised values to new installs
Pedro Amorim [Thu, 20 Jul 2023 10:19:30 +0000 (10:19 +0000)]
Bug 34587: Copy authorised value categories and authorised values to new installs

(cherry picked from commit 338ae09e692420fe783da1699386b14891af62ab)

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Move column options into reports store to tidy up url params
Matt Blenkinsop [Tue, 20 Jun 2023 16:28:01 +0000 (16:28 +0000)]
Bug 34587: Move column options into reports store to tidy up url params

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add cypress tests for Data providers
Matt Blenkinsop [Tue, 20 Jun 2023 10:15:38 +0000 (10:15 +0000)]
Bug 34587: Add cypress tests for Data providers

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add reports by data provider
Matt Blenkinsop [Fri, 16 Jun 2023 16:27:53 +0000 (16:27 +0000)]
Bug 34587: Add reports by data provider

Add the option to have a report by provider that rolls all usage up into one top-level figure to see how often that provider is being used a given period

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add default report capability to reports viewer
Matt Blenkinsop [Thu, 15 Jun 2023 11:43:53 +0000 (11:43 +0000)]
Bug 34587: Add default report capability to reports viewer

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Refactor reports viewer to use URL params instead of pinia store
Matt Blenkinsop [Fri, 9 Jun 2023 15:38:44 +0000 (15:38 +0000)]
Bug 34587: Refactor reports viewer to use URL params instead of pinia store

This patch removes the pinia store and uses URL params to pass data between components. Using the pinia store means that the data is lost on page refresh and the report then throws an error.

This patch also merges the first column in the table into one line per object, rather than repeating the same title for each line of data.

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Limit data provider options when report type is selected in reports builder
Matt Blenkinsop [Fri, 2 Jun 2023 08:42:52 +0000 (08:42 +0000)]
Bug 34587: Limit data provider options when report type is selected in reports builder

When a provider is selected in the reports builder it should only be possible to select report types that that provider currently harvests to avoid redundant reports

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add publisher and publisher_id to usage_titles schema and KohaTables
Matt Blenkinsop [Fri, 2 Jun 2023 08:39:19 +0000 (08:39 +0000)]
Bug 34587: Add publisher and publisher_id to usage_titles schema and KohaTables

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Fix titles search in reports viewer
Matt Blenkinsop [Thu, 1 Jun 2023 14:26:17 +0000 (14:26 +0000)]
Bug 34587: Fix titles search in reports viewer

Titles search does not currently work when data from multiple providers is present. This patch allows for titles to be individually fetched per provider

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add reports by metric types
Matt Blenkinsop [Tue, 30 May 2023 14:45:12 +0000 (14:45 +0000)]
Bug 34587: Add reports by metric types

Adds the ability to generate a report with the individual metric types as columns

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add test connection button
Matt Blenkinsop [Tue, 30 May 2023 14:44:48 +0000 (14:44 +0000)]
Bug 34587: Add test connection button

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: SUSHI COUNTER Harvester
Pedro Amorim [Wed, 1 Mar 2023 17:38:20 +0000 (17:38 +0000)]
Bug 34587: SUSHI COUNTER Harvester

This commit is a squash of the following:

SUSHI harvesting process in the data providers class:
* Builds the URL query and requests the SUSHI service endpoint
* Parses the JSON response and builds the csv COUNTER file and adds it to counter_files table

Usage statistics data processing:
* When a counter_files entry is stored, CounterFile.pm will:
* Parse the csv COUNTER file and
* Add a usage_titles entry for each unique title in the COUNTER file
* Add the title's respective erm_usage_mus (monthly usage) entries, repeating for each metric_type
* Add the title's respective erm_usage_yus (yearly usage) entries, repeating for each metric_type

Harvesting cronjob;

'Run now':
* API endpoint to start the harvesting process of a data provider
* Button in the data providers list to run the harvesting process for each data provider upon clicked

ERM SUSHI: Background job

Job progress is updated to total amount of usage titles after retrieving
the response from SUSHI;
Job warning and success messages are added accordingly
Redundant duplicate titles will not be added
Redundant duplicate monthly and yearly usage statistics will not be added
Data provider harvest background job harvests once per report_type

Enqueue one background job for each report_type in the usage data provider

Update the way we measure progress in the background job.
It now uses the COUNTER report body rows instead of SUSHI response results.
We're now incrementing and showing the number of skipped mus, skipped
yus, added mus and added yus
There's a bug in the way we calculate yus
Updates to background job progress bar - Depends on 34468

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add reports components
Matt Blenkinsop [Thu, 27 Apr 2023 10:53:36 +0000 (10:53 +0000)]
Bug 34587: Add reports components

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add reports store
Matt Blenkinsop [Thu, 27 Apr 2023 10:53:18 +0000 (10:53 +0000)]
Bug 34587: Add reports store

Adds a reports store to facilitate data transfer between the reports builder and reports viewer and remove the need for duplicated code in the two components

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Add data providers components and sub-components
Matt Blenkinsop [Thu, 27 Apr 2023 10:52:52 +0000 (10:52 +0000)]
Bug 34587: Add data providers components and sub-components

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Vue router, api client and authorised values
Matt Blenkinsop [Thu, 27 Apr 2023 10:52:14 +0000 (10:52 +0000)]
Bug 34587: Vue router, api client and authorised values

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: Usage statistics table column data
Matt Blenkinsop [Thu, 27 Apr 2023 10:51:05 +0000 (10:51 +0000)]
Bug 34587: Usage statistics table column data

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: API unit tests
Matt Blenkinsop [Thu, 27 Apr 2023 10:50:48 +0000 (10:50 +0000)]
Bug 34587: API unit tests

prove t/db_dependent/api/v1/erm_counter_files.t
prove t/db_dependent/api/v1/erm_usage_data_providers.t
prove t/db_dependent/api/v1/erm_usage_titles.t

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: API controllers and objects
Matt Blenkinsop [Thu, 27 Apr 2023 10:50:28 +0000 (10:50 +0000)]
Bug 34587: API controllers and objects

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: API swagger paths and definitions
Matt Blenkinsop [Thu, 27 Apr 2023 10:49:46 +0000 (10:49 +0000)]
Bug 34587: API swagger paths and definitions

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: DBIC files
Matt Blenkinsop [Thu, 27 Apr 2023 10:49:20 +0000 (10:49 +0000)]
Bug 34587: DBIC files

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34587: SQL structure and atomic update file
Matt Blenkinsop [Thu, 27 Apr 2023 10:48:45 +0000 (10:48 +0000)]
Bug 34587: SQL structure and atomic update file

Sponsored-by: PTFS Europe Ltd
Sponsored-by: Bywater Solutions
Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35201: (bug 30708 follow-up) Fix Preservation/Settings.ts
Jonathan Druart [Tue, 31 Oct 2023 14:03:23 +0000 (15:03 +0100)]
Bug 35201: (bug 30708 follow-up) Fix Preservation/Settings.ts

We were not correctly mocking the config route from the tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35201: (bug 30708 follow-up) Fix Preservation tests
Jonathan Druart [Tue, 31 Oct 2023 14:27:25 +0000 (15:27 +0100)]
Bug 35201: (bug 30708 follow-up) Fix Preservation tests

We didn't mock the config given the last changes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35199: (bug 34448 follow-up) Fix error handling in http-client.js
Jonathan Druart [Tue, 31 Oct 2023 13:45:08 +0000 (14:45 +0100)]
Bug 35199: (bug 34448 follow-up) Fix error handling in http-client.js

From bug bug 34448.

386         // Submit the form, get 500
387         cy.intercept("POST", "/api/v1/erm/agreements", {
388             statusCode: 500,
389             error: "Something went wrong",
390         });
391         cy.get("#agreements_add").contains("Submit").click();
392         cy.get("main div[class='dialog alert']").contains(
393             "Something went wrong: SyntaxError: Unexpected end of JSON input"
394         );

This is wrong: we are now showing a JS error (SyntaxError) instead of the expected 500: internal server error!

The problem was that a regular 500 does not have anything in the body,
and _fetchJSON didn't handle that ( JSON.parse(text) ).
If the body of the response does not contain anything we need to get the
text from statusText (which contains "Internal Server Error" in case of
500).

Test plan:
1. Make sure all cypress tests pass
2. Confirm the above:
Raise an exception from a given route (/agreements for instance) and
confirm that the error displayed on the interface is correct (ie. not
SyntaxError, but "Error: Internal Server Error")

For QA:
* This change is covered properly in Dialog_spec.ts, no need to redo it in
every other test files.
* Without the following change in count, we see:
"Something went wrong: Error: Error: Internal Server Error" because
setError is called twice. We don't need to set the error from count, it
has been set from _fetchJSON already.
-            error => {
-                setError(error.toString());
-            }
+            error => {}

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35033: (QA follow-up): tidy up code
Victor Grousset/tuxayo [Mon, 30 Oct 2023 17:58:09 +0000 (18:58 +0100)]
Bug 35033: (QA follow-up): tidy up code

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35033: Add a validation for biblioitems in about/system information
Blou [Wed, 11 Oct 2023 15:57:28 +0000 (11:57 -0400)]
Bug 35033: Add a validation for biblioitems in about/system information

In the About section, under the System information tab, we get validation between
issues, borrowers, biblio, items, reserves tables, and their deleted/old counterpart.

But there's no validation for biblioitems.

This patch will simply add the same test (and display) as the others, but for biblioitems.

Testing
0) Create a simple biblio entry through cataloguing. Note the biblioitemnumber created.
1) Insert a dummy entry in deletedbiblioitem using the biblioitemnumber.  An simple SQL will do
insert into deletedbiblioitems select * from biblioitems where biblioitemnumber = GIVENbin;
2) Go to about, see there's no warning in systeminformation.
3) apply the patch, validate that an error appears.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34424: Add Emily Lamancusa to QA Team
Katrin Fischer [Sun, 29 Oct 2023 14:36:38 +0000 (14:36 +0000)]
Bug 34424: Add Emily Lamancusa to QA Team

Long overdue.

To test:
* Apply patch
* Verify that Emily shows as part on the QA Team
  on the About page

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35180: Fix 246 to 264 in COMMENT of deletedbiblioitems.publishercode
Katrin Fischer [Sun, 29 Oct 2023 09:31:06 +0000 (09:31 +0000)]
Bug 35180: Fix 246 to 264 in COMMENT of deletedbiblioitems.publishercode

This fixes a typo in the comment.

To test:
* Please check diff of the patch closely.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34520: DBRev 23.06.00.055
Tomas Cohen Arazi [Tue, 31 Oct 2023 14:02:20 +0000 (11:02 -0300)]
Bug 34520: DBRev 23.06.00.055

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34520: Fix FK for item_groups in reserves for new installations
Katrin Fischer [Sun, 29 Oct 2023 14:14:37 +0000 (14:14 +0000)]
Bug 34520: Fix FK for item_groups in reserves for new installations

There was a discrepancy between the database update for reserves
and the kohastructure.sql definition. This makes sure that the
FK is always "ON DELETE SET NULL".

To test:
* Before applying this path
* sudo koha-mysql kohadev
* show create table reserves;

CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE

* Apply patch
* Run database update
* Check database again:

CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE

* reset_all (create a new database)
* Check database again:

CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35186: Remove unnecessary html tags from PASSWORD notices
Katrin Fischer [Sun, 29 Oct 2023 15:42:36 +0000 (15:42 +0000)]
Bug 35186: Remove unnecessary html tags from PASSWORD notices

In HTML notices we don't need to explicitly use <html></html>.

This removes them from the 2 notices using them:
* PASSWORD_RESET
* STAFF_PASSWORD_RESET

To test:
* Apply patch
* Make sure your Koha can send email (set up SMTP server, KohaAdminLibraryAddress)
* Make sure your patron has an email set
* In patron account, use "More > Send password reset"
* Log out
* In the OPAC, request password reset ("forgot your password?")
* Verify both notices appear nicely formatted (line breaks, bold, etc.)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34924: (QA follow-up) correctly handle digest data compilation for successful...
Emily Lamancusa [Thu, 26 Oct 2023 14:21:09 +0000 (10:21 -0400)]
Bug 34924: (QA follow-up) correctly handle digest data compilation for successful renewal

automatic_renewals.pl does some data compilation for digest notices that
depends on the error value returned from attempt_auto_renew. However, on
successful renewal $error is undefined. Add additional checks on value
of $success and definedness of $error to compile data accurately and
avoid warns for undefined variable

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34924: Adjust auto renewal email to reflect success for final renewals
Nick Clemens [Mon, 23 Oct 2023 17:52:11 +0000 (17:52 +0000)]
Bug 34924: Adjust auto renewal email to reflect success for final renewals

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34924: Handle final renewal errors
Nick Clemens [Tue, 26 Sep 2023 17:29:28 +0000 (17:29 +0000)]
Bug 34924: Handle final renewal errors

This patch updates Koha::Checkout->attempt_auto_renew to renew when the 'final' errors are passed, and to pass the error value back to the cronjob for processing

The sample notice for AUTO_RENEW and AUTO_RENEW_DGST are both updated to handle the new error

On the next cron the error will be updated to too_many or too_unseen, but a notice will not be sent.

To test:
 0 - Run reset_all to install the updated sample notices or copy the text
 1 - Set system preference UnseenRenewals to 'Allow'
 2 - Setup a circ rule to allow 2 renewals, 2 unseen renewals
 3 - Checkout an item to a patron who has an email defined and auto renewals selected in messaging preferences
 4 - Update the issue to be due/overdue:
    UPDATE issues SET date_due=DATE_SUB(NOW(), INTERVAL 1 DAYS);
 5 - perl misc/cronjobs/automatic_renewals.pl -v -c
 6 - Confirm patron notified and issue renewed
 7 - Set issue due/overdue again
 8 - perl misc/cronjobs/automatic_renewals.pl -v -c
 9 - Confirm patron notified of final unseen renewal
10 - perl misc/cronjobs/automatic_renewals.pl -v -c
11 - Confirm issue not renewed, patron not notified
12 - Update circ rules t all 4 renewals total
13 - Force renewal on staff side to clear unseen
14 - perl misc/cronjobs/automatic_renewals.pl -v -c
15 - Confirm patron notified of final renewal (allowed 4, 2 unseen from cron, 1 manual, this unseen from cron)
16 - perl misc/cronjobs/automatic_renewals.pl -v -c
17 - Confirm patron not notified, issue not renewed

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34924: Add 'auto_renew_final' and 'auto_unseen_final' return to CanBookBeRenewed
Nick Clemens [Tue, 26 Sep 2023 15:03:45 +0000 (15:03 +0000)]
Bug 34924: Add 'auto_renew_final' and 'auto_unseen_final' return to CanBookBeRenewed

There is a desire for auto_renewals to treat the final renewal differently. We would like to notify the patron of the final renewal - but not again when the next renewal fails. This patch adds the new return value and tests.

To test:
prove -v t/db_dependent/Circulation.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34924: Add Koha::Checkout->attempt_auto_renew
Nick Clemens [Tue, 26 Sep 2023 13:53:44 +0000 (13:53 +0000)]
Bug 34924: Add Koha::Checkout->attempt_auto_renew

This patch moves the actual renewal out of the auto_renewals cronjob script and into the object and adds tests. The logic for notices is still handled in the script.

To test:
1 - prove -v t/db_dependent/Koha/Checkouts.t
2 - Add a circ rule with auto_renew checked
3 - Checkout an item to a patron and set due date in the past
4 - Checkout an item to a patron and set due date in the future
5 - perl misc/cronjobs/automatic_renewals.pl -v
6 - Confirm one would be renewed and the other is too_soon
7 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
8 - Confirm the expected issue is successfully renewed

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 25672: Fix double output_html_with_http_headers
Martin Renvoize [Tue, 24 Oct 2023 09:49:44 +0000 (10:49 +0100)]
Bug 25672: Fix double output_html_with_http_headers

We weren't exiting after calling output_html_with_http_headers and so we
were ending up with a double template render (and also a subsequent
confusion in the cookie consent code).

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 25672: Restore redirect on restricted upload
Martin Renvoize [Mon, 9 Oct 2023 11:26:02 +0000 (12:26 +0100)]
Bug 25672: Restore redirect on restricted upload

This patch restores the immediate redirect from plugins-upload should
uploads be restricted and an uploadlocation not be specified.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 25672: (QA follow-up): tidy up code
Victor Grousset/tuxayo [Mon, 9 Oct 2023 01:54:00 +0000 (03:54 +0200)]
Bug 25672: (QA follow-up): tidy up code

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 25672: Convert to restricting to listed repositories only
Martin Renvoize [Tue, 25 Jul 2023 14:46:34 +0000 (15:46 +0100)]
Bug 25672: Convert to restricting to listed repositories only

I think instead of a plain on/off switch we should use it in combination
with the plugin_repo's and set it to restrict to only those repos' (i.e.
disable uploads entirely if no repo's are listed, or just allow those
repo's when there are).

This patch achieves that, but only if plugins are installed via the
plugin browser method. We disable all direct upload avenues, so install
is blocked for other cases.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 25672: Prevent uninstall when plugin browser upload disabled
David Cook [Mon, 24 Jul 2023 06:17:13 +0000 (06:17 +0000)]
Bug 25672: Prevent uninstall when plugin browser upload disabled

When plugin browser upload is disabled, also prevent plugin browser
uninstall.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 25672: (QA follow-up) Hide install after search button
Martin Renvoize [Wed, 22 Jul 2020 08:10:29 +0000 (09:10 +0100)]
Bug 25672: (QA follow-up) Hide install after search button

If plugin upload is disabled, but there are git repositories listed in
the config for plugin searching, then you can search for a plugin and
attempt to install it. The install leads to an error page.

This patch removes the actions column and install button should the
enable_browser_upload option be disabled

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 25672: Enable enable_plugin_browser_upload by default
David Cook [Wed, 8 Jul 2020 23:07:47 +0000 (23:07 +0000)]
Bug 25672: Enable enable_plugin_browser_upload by default

This patch enables enable_plugin_browser_upload by default,
since the current behaviour for Koha is to enable browser upload
when enable_plugins is 1.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 25672: Use enable_plugin_browser_upload flag to control plugin upload
David Cook [Wed, 8 Jul 2020 11:53:54 +0000 (11:53 +0000)]
Bug 25672: Use enable_plugin_browser_upload flag to control plugin upload

This patch adds a enable_plugin_browser_upload flag to koha-conf.xml, which
controls whether or not Koha intranet users can upload Koha plugins via
their browser. Like "enable_plugins", it defaults to 0 for new installs.

This is useful when you want to provide Koha intranet users with plugins
that are pre-installed by administrators (by CLI) or restricting them
to plugins from a Github repo. See the following for more information:
Bug 23975 - Add ability to search and install plugins from GitHub
Bug 23191 - Administrators should be able to install plugins from the command line

To test:
1) Apply the full patchset
2) Confirm <enable_plugins>1</enable_plugins> is present in koha-conf.xml
3) Add <plugins_restricted>1</plugins_restricted> to koha-conf.xml
4) Ensure that the <plugin_repos> block is not commented and contains at
   least one trusted organisation in koha-conf.xml
   If needed get it from: debian/templates/koha-conf-site.xml.in
5) Run restart_all (in koha-testing-docker)
6) Go to /cgi-bin/koha/plugins/plugins-home.pl and note that you don't see
   an option to upload plugins
7) You should however see a search option and upon search you should have
   results returned from the chosen trusted organisations listed in the
   <plugin_repos> block mentioned above.
8) Clicking install on one of the results should work as expected and install
   the plugin.
9) Go directly to /cgi-bin/koha/plugins/plugins-upload.pl and note that it says
   "Plugin upload is restricted to only those plugins listed by your server
   administrator" and gives instructions on how to enable unrestricted browser
   upload.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 29811: Add timestamp option on authority record type
Thibaud Guillot [Thu, 6 Jan 2022 13:48:36 +0000 (14:48 +0100)]
Bug 29811: Add timestamp option on authority record type

According to the timestamp option for bibs record type I added the
timestamp option for authority records.
Timestamp is already present in database on field "modification_time"

Test Plan :
1 - Be sure to have authority record type for easiest test create one
2 - Execute script export_records.pl in your koha/misc directory and
choose a date (example yesterday if you just created an authority
right now).(see export_records.pl -h for help)
3 - Timestamp option has no effect on authority record type
4 - Execute script again but choose the date of tomorrow for example
5 - Same result
6 - Apply this patch
7 - Play again steps 2 and 4
8 - On step 2 you will see only your authorities created today (because
script show you authority has changes since the date you choose in
option) and for step 4 you must see an empty file.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 34227: (follow-up) Adjust selenium tests
Tomas Cohen Arazi [Mon, 30 Oct 2023 12:38:46 +0000 (09:38 -0300)]
Bug 34227: (follow-up) Adjust selenium tests

This patch adjusts the selenium tests to address the renamed ID for the
elements.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 33809: Centralize duplicated code
Jonathan Druart [Fri, 7 Jul 2023 07:44:21 +0000 (09:44 +0200)]
Bug 33809: Centralize duplicated code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 33809: (follow-up) Grammar correction
Owen Leonard [Thu, 1 Jun 2023 12:46:22 +0000 (12:46 +0000)]
Bug 33809: (follow-up) Grammar correction

This is somewhat nitpicky but I think "Show fewer..." is more correct
than "Show less..." for strings like "Show fewer authors."

'Generally, fewer is used when the number of things is counted ("fewer
problems") whereas less is used when the number is measured ("less
trouble" or "less time").'
-- https://www.merriam-webster.com/words-at-play/fewer-vs-less

It's not a strict rule but to my ear it sounds more correct. The brief
"Show less" displayed on screen seems fine because the object feels
indeterminate: "Show less information."

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 33809: Place hold and Add to cart links need better descriptions
Matt Blenkinsop [Tue, 23 May 2023 14:15:30 +0000 (14:15 +0000)]
Bug 33809: Place hold and Add to cart links need better descriptions

The place hold and add to cart buttons should identify to screen readers which title the button is linked to. This patch adds aria-labels that include the item title to make this more clear

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 33809: Facet "Show more/less" links don't identify what they are showing
Matt Blenkinsop [Tue, 23 May 2023 14:13:03 +0000 (14:13 +0000)]
Bug 33809: Facet "Show more/less" links don't identify what they are showing

This patch addresses the Show more/less links in the side menu in opac-facets.inc. The links don't identify which facet they are linked to and this is confusing for screen readers.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 27943: (QA follow-up) Alternate display in result lists
Katrin Fischer [Sat, 14 Oct 2023 23:10:30 +0000 (23:10 +0000)]
Bug 27943: (QA follow-up) Alternate display in result lists

The original display put the equivalent heading right after
the main heading with a = as separator. As the 7xx are repeatable
that could get croweded easily, also if the terms are longer
we might see not so nice breakage.

This puts every 7xx on its own line below the main heading
with some indentation.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 27943: (QA follow-up) Perltidy
Katrin Fischer [Sat, 14 Oct 2023 21:48:42 +0000 (21:48 +0000)]
Bug 27943: (QA follow-up) Perltidy

I have some trouble to get the tidyness test on
AuthoritiesMarc.pm passing. There are several outstanding
patches touching this file, so I didn't dare to perltidy
the whole file just yet.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 27943: (follow-up) Fix unit test, and use systempreference AuthoritySeparator
George Veranis [Mon, 20 Feb 2023 11:02:27 +0000 (12:02 +0100)]
Bug 27943: (follow-up) Fix unit test, and use systempreference AuthoritySeparator

Instead of hardcoding the separator we take the value from systempreference.
Also adjust the unit test to expect the "equalterm" array.
Test plan same as before.

Signed-off-by: Christian Nelson <christian.nelson@uwasa.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 27943: (QA follow-up) Add missing TT filters
Katrin Fischer [Sun, 24 Apr 2022 11:51:01 +0000 (11:51 +0000)]
Bug 27943: (QA follow-up) Add missing TT filters

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 27943: Add support for 7XX equal terms on authorities marc21 display
George Veranis [Fri, 2 Jul 2021 14:41:24 +0000 (16:41 +0200)]
Bug 27943: Add support for 7XX equal terms on authorities marc21 display

Currently when a MARC21 authority has 7XX field they do not display on
authority search result page. 7XX is equal term of 1XX based on LC rules.
Applying this patch will enable that feature, which is important for non latin
catalogues.

Test plan:
1) Add a new authority with 1XX and 7XX fields.
2) Try to search that authority and check if 7XX values are displayed
3) Apply this patch
4) Try to search that authority and you will see that 7XX values are displayed
   like "1XX = 7XX"

Sponsored-by: Keratsini-Drapetsona Municipal Library, Greece
Mentored-by: Andreas Roussos
Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Works for me!

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 22712: Make 'Show inactive funds' button on addorderiso2907.pl work for item...
Nick Clemens [Mon, 23 Oct 2023 19:56:21 +0000 (19:56 +0000)]
Bug 22712: Make 'Show inactive funds' button on addorderiso2907.pl work for item budgets

This requires enabling MarcItemFieldsToOrder, see bug 34645

Add an inactive Budget and some funds to your system

Import a file with multiple biblios

Confirm the button hids/displays the funds for all item orders

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 31393: Tidy
Tomas Cohen Arazi [Mon, 30 Oct 2023 12:00:31 +0000 (09:00 -0300)]
Bug 31393: Tidy

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 31393: Koha::Config: handle the special case for 'content' attribute
Julian Maurice [Mon, 26 Jun 2023 13:25:12 +0000 (15:25 +0200)]
Bug 31393: Koha::Config: handle the special case for 'content' attribute

<key content="value"></key>

was wrongly parsed as

{ key => 'value' }

whereas it should be

{ key => { content => 'value' } }

The 'content' attribute is used in shibboleth config

Test plan:
1 Run `prove t/Koha/Config.t`

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 32312: Add missing column descriptions to the statistics table
David Nind [Sun, 4 Dec 2022 01:33:32 +0000 (01:33 +0000)]
Bug 32312: Add missing column descriptions to the statistics table

This adds missing descriptions to the existing statistics database
columns.

It also improves some existing descriptions.

1. Go to Reports > Guided reports > Create guided report.
2. Choose 'Circulation' for the module to report on and select
   'Next'.
3. Choose 'Tabular' for the type of report and select 'Next'.
4. Scroll down to the statistics table section and note that there
   are no descriptions for:
   - statistics.other
   - statistics.location
   - statistics.ccode
   - statistics.categorycode
5. Note that:
   - the description for statistics.type is 'Type'
   - the description for statistics.itemtype is 'Item type'
6. Apply the patch.
7. Restart all the things (restart_all).
8. Reload the page.
9. Note that:
   . there are now descriptions for the columns in step 4
   . the description for statistics.type is now 'Transaction type'
     (to more clearly indicate what it contains)
   . the description for statistics.itemtype is now 'Koha item type'
     (consistent with other tables where this is used, such as items)
10. Sign off :D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35147: (QA follow-up) Capitalzation: Shibboleth Login
Katrin Fischer [Sat, 28 Oct 2023 22:44:56 +0000 (22:44 +0000)]
Bug 35147: (QA follow-up) Capitalzation: Shibboleth Login

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35147: Add classes to Shibboleth text on OPAC login page
Aleisha Amohia [Wed, 25 Oct 2023 00:40:26 +0000 (00:40 +0000)]
Bug 35147: Add classes to Shibboleth text on OPAC login page

This enhancement makes it easier for libraries to change the Shibboleth-related messages on the OPAC login page.

Libraries can employ OPACUserJS to change the text. For e.g., I can replace the message "If you do not have a Shibboleth account, but you do have a local login, then you may login below." by putting the following in OPACUserJS:

$(".shib_local_text").text("If you do not have a staff member account, but are a member of the library, then you may log in below.");

To test:

1. Go to <your-opac-url>/cgi-bin/koha/opac-user.pl , or disable the OpacPublic system preference. Ensure you are logged out of the OPAC.
2. In the staff interface, search for the OPACUserJS system preference under Koha Administration. Add the following JS and Save:

$(".shib_invalid").text("Test changing the invalid Shibboleth login message.");
$(".shib_title").text("Test changing the Shibboleth login heading.");
$(".shib_url").text("Test changing the Shibboleth account link text.");
$(".shib_local_title").text("Test changing the local login heading.");
$(".shib_local_text").text("Test changing the message that shows if you do not have a Shibboleth account.");

3. Refresh the OPAC and confirm the text changes to reflect your JS. Note: The invalid Shibboleth login will be a bit harder to test, so if you can't test, confirm the HTML in the patch looks correct.

Sponsored-by: New Zealand Council for Educational Research
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 32853: Fix cataloguing/value_builder/unimarc_field_125.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:53 +0000 (11:58 +0100)]
Bug 32853: Fix cataloguing/value_builder/unimarc_field_125.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 32856: Fix cataloguing/value_builder/unimarc_field_126.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:53 +0000 (11:58 +0100)]
Bug 32856: Fix cataloguing/value_builder/unimarc_field_126.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35111: Ignore SIGPIPE in background jobs worker
David Cook [Fri, 20 Oct 2023 01:15:00 +0000 (01:15 +0000)]
Bug 35111: Ignore SIGPIPE in background jobs worker

This change explicitly ignores SIGPIPE signals in the background jobs
worker.

Daemons like Starman ignore SIGPIPE so it makes sense to explicitly set this.
Differences in the inner workings of MySQL vs MariaDB client libraries have yielded
different behaviours in automatic reconnections and potentially SIGPIPE handling,
so this helps to make the overall behaviour more consistent.

Test plan:
0. Apply patch and run "restart_all"
1. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
2. Click "Save" > "MARCXML"
3. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
4. Click "Choose file", choose the MARCXML file, click "Upload file"
5. Click "Stage for import"
6. Note the job is marked as "100% Finished"

7. In a separate window run "docker restart koha-db-1"
8. Repeat steps 3-5 for uploading file and running stage for import
9. Note that the job is marked as "100% Finished" as you'd expect

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Added comment on the SIG PIPE line.
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 10762: Fix tests continued
Tomas Cohen Arazi [Sat, 28 Oct 2023 13:02:26 +0000 (10:02 -0300)]
Bug 10762: Fix tests continued

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 29523: Fix tests
Tomas Cohen Arazi [Sat, 28 Oct 2023 12:45:34 +0000 (09:45 -0300)]
Bug 29523: Fix tests

Some tests compare things to the output of `->to_api` and are exploding
because the (now mandatory) `user` parameter is not passed in the call.

In the case of IdP.t I just got rid of the use of `to_api` as we are
just trying to acknowledge a new user has been created and the API
representation of it is irrelevant.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 10762: Fix default values test
Tomas Cohen Arazi [Fri, 27 Oct 2023 20:16:27 +0000 (17:16 -0300)]
Bug 10762: Fix default values test

This patch adds the new default values to the data structure the result
is compared with.

It also fixes the tests count (probably an untested rebase issue)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 35173: Correctly concat error strings
Martin Renvoize [Fri, 27 Oct 2023 10:48:07 +0000 (11:48 +0100)]
Bug 35173: Correctly concat error strings

This patch moves the call to $sftp->error outside of the double quote
string and into a . concat to properly expose the error message as
apposed to outputting 'Net::SFTP::Foreign=HASH(0x559c9118f0c8)->error'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 months agoBug 35003: Make cancelled hold requests filter by branch
Lucas Gass [Fri, 6 Oct 2023 15:15:39 +0000 (15:15 +0000)]
Bug 35003: Make cancelled hold requests filter by branch

To recreate:
1. Make sure you have the "Default waiting hold cancellation policy" set to allow via circulation rules.
2. Make several holds at different branches  holds and set them to waiting
3. Request to cancel those holds, making sure you cancel some for different branches.
4. Go to waitingreserves.tt and notice that you see all of the holds from all branches.
5. APPLY PATCH and restart services
6. Vist the waitingreserves.tt page and notice that the "Holds with cancellation requests" table can now filters by branch.
7. Use the "View all libraries" and make sure you can see all the holds with a cancellation request.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 34136: (QA follow-up) Perltidy
Katrin Fischer [Mon, 23 Oct 2023 21:42:01 +0000 (21:42 +0000)]
Bug 34136: (QA follow-up) Perltidy

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
8 months agoBug 34136: (QA follow-up) Change Report to Reports as category in notices and slips
Katrin Fischer [Mon, 23 Oct 2023 21:38:14 +0000 (21:38 +0000)]
Bug 34136: (QA follow-up) Change Report to Reports as category in notices and slips

Looking at the other entries for the module in notices we most often
use the actual module name: patrons, suggestions, holds, etc.

So I updated "Report" to "Reports" to match that pattern.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
8 months agoBug 34136: Add ability to render a report using a notice template
Kyle M Hall [Tue, 27 Jun 2023 16:44:18 +0000 (12:44 -0400)]
Bug 34136: Add ability to render a report using a notice template

Sometimes it is useful to display the results of a report in a non-table format. We should be able to create notice templates to render reports.

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Create a new notice template using the new "Report" option from the
   "New notice" pulldown.
4) In the "Print" area, paste the following template:

[% FOREACH b IN data %]
<div class="panel panel-default">
  <div class="panel-heading">[% b.surname %], [% b.firstname %]</div>
  <div class="panel-body">Expiration: [% b.dateexpiry %]</div>
  <div class="panel-footer">ID: [% b.borrowernumber %]</div>
</div>
[% END %]

5) Create a report with the query: SELECT * FROM borrowers
6) Once the report is saved, use the new "Run with template" option to
   select the template you just created.
7) Note that instead of the results being a paged table, you instead
   see the results rendered as cards!

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
8 months agoBug 35043: Do not have \n or \t appear in PO files
Jonathan Druart [Thu, 12 Oct 2023 10:35:12 +0000 (12:35 +0200)]
Bug 35043: Do not have \n or \t appear in PO files

This is a trick, so that we won't have to deal with \t in PO files.
\n is not a problem, but it seems consistent to use the same method for
both.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 35043: Use Locale::PO->quote
Jonathan Druart [Thu, 12 Oct 2023 09:44:16 +0000 (11:44 +0200)]
Bug 35043: Use Locale::PO->quote

We have our own "quote_po" sub that is stating that Locale::PO::quote
is buggy because it does not deal with quoting new lines correctly.
However it seems that it is fixed now.

Ideally we could use Locale::PO::quote everywhere, but it does not
escape tab characters:
  $string =~ s/\\(?!t)/\\\\/g;           # \t is a tab

This means the following:
msgid "Tabulation (\\t)"
msgstr "Tabulation (\\t)"
become:
-msgid "Tabulation (\t)"
-msgstr "Tabulation (\t)"

And we are seeing the following on Weblate:
https://snipboard.io/BjQmDC.jpg

Note that Locale::PO has not been updated since 2014...

The real problem behind this is that we have 2 methods to quote strings.
At first glance it seems that Locale::PO::quote was not used before, but
with the introduction of the koha-i18n project we will have scripts that
will use Locale::PO->save_file_fromarray, which uses Locale::PO->quote
=> Those scripts will be used on the translation server for post
processing (security reason, marking potential XSS strings as fuzzy).

Test plan:
0. Do not apply the patch
1. gulp po:update --lang LANG # Replace LANG with your favorite language
   code
2. git commit -a -m"init PO files"
3. Apply this patch
4. Repeate 1.
5. git diff
   => The change is about the "Tabulation" and "New line" strings from
      tools/csv-profiles.tt
6. Translate them (replace the \t and \n with %s) and remove the fuzzy
   flag
7. install the template: cd misc/translator && perl translate install
   LANG
8. Enable the language, use it and go to the "Nouveau profil CSV" view
   => Notice that the \t and \n are correctly displayed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 35141: (QA follow-up) Increment the bad count
Marcel de Rooy [Fri, 27 Oct 2023 07:21:03 +0000 (07:21 +0000)]
Bug 35141: (QA follow-up) Increment the bad count

Also move earlier print to warn for consistency.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 35141: Prevent link_bibs_to_authorities from dying on invalid metadata
Nick Clemens [Tue, 24 Oct 2023 12:01:09 +0000 (12:01 +0000)]
Bug 35141: Prevent link_bibs_to_authorities from dying on invalid metadata

When fetching the record we need to eval in case of exception

To test:
1 - Apply first patch
2 - perl misc/link_bibs_to_authorities.pl
3 - Note it dies on parser error at record 369
4 - Apply this patch
5 - perl misc/link_bibs_to_authorities.pl
6 - The process completes - with warning thrown on record 369

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 35141: Catch ES search exceptions in link_bibs_to_authorities, warn, and continue
Nick Clemens [Tue, 24 Oct 2023 11:51:29 +0000 (11:51 +0000)]
Bug 35141: Catch ES search exceptions in link_bibs_to_authorities, warn, and continue

This patch simplay adds an eval and a warning to link_bibs_to_authorities to catch any errors while searching and continue linking.

To test:
1 - edit /etc/kohia/sites/kohadev/koha-conf.xml and add to elasticsearch stanza
    <request_timeout>0</request_timeout>
2 - perl misc/link_bibs_to_authorities.pl
3 - It dies immediately
4 - Apply patch
5 - perl misc/link_bibs_to_authorities.pl
6 - Now it tries every record, throwing warnings along the way, but completes

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 34678: Allow new entries to overwrite hold_fill_targets
Nick Clemens [Wed, 13 Sep 2023 17:03:32 +0000 (17:03 +0000)]
Bug 34678: Allow new entries to overwrite hold_fill_targets

When using background jobs, there is a possibility of a race condition where two jobs will be updating the holds queue for the same biblio. We should try to minimize those cases (see bug 34596)

In the meantime though, we should prevent jobs possibly dying, and allow the most recent update to succeed.

There is a possibility two updates wil assign different items to the same reserve, and that a reserve could end up in the queue twice, however, whichever one is filled first will delete both entries. as filling the hold deletes by reserve id (see bug 24359)

This patch adds a transaction to delete and then inset the new row

To test:
1 - prove -v t/db_dependent/Reserves.t
2 - It fails
3 - Apply patch
4 - t/db_dependent/Reserves.t
5 - It succeeds!

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 34678: Unit test
Nick Clemens [Wed, 13 Sep 2023 17:01:09 +0000 (17:01 +0000)]
Bug 34678: Unit test

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 35167: Make 'effective_not_for_loan_status' fallback to 0 if itype has it undef
Tomas Cohen Arazi [Thu, 26 Oct 2023 17:58:40 +0000 (14:58 -0300)]
Bug 35167: Make 'effective_not_for_loan_status' fallback to 0 if itype has it undef

This patch makes the effective not for loan status be set the item value
if not defined at itype level.

To test:
1. Apply the regressions tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/items.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 35167: Regression tests
Tomas Cohen Arazi [Thu, 26 Oct 2023 17:56:35 +0000 (14:56 -0300)]
Bug 35167: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 months agoBug 35119: Add back classes used for selenium tests
Martin Renvoize [Fri, 27 Oct 2023 14:46:13 +0000 (15:46 +0100)]
Bug 35119: Add back classes used for selenium tests

This patch re-instates the classes used for the selenium tests.. I
checked we weren't using them for javascript or css, but didn't think
about tests before.

8 months agoBug 29523: (follow-up) Adding documentation to swagger.yaml
Martin Renvoize [Mon, 23 Oct 2023 15:19:18 +0000 (16:19 +0100)]
Bug 29523: (follow-up) Adding documentation to swagger.yaml

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 29523: (follow-up) Comprehensive tests for redaction
Martin Renvoize [Mon, 23 Oct 2023 15:19:18 +0000 (16:19 +0100)]
Bug 29523: (follow-up) Comprehensive tests for redaction

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 29523: Add redaction for inaccessible objects
Martin Renvoize [Thu, 31 Aug 2023 12:13:54 +0000 (14:13 +0200)]
Bug 29523: Add redaction for inaccessible objects

This patch switches from removing inaccessible items from the responses
to instead redacting fields in innaccessible responses.

This allows for embed traversal and keeps counts etc correct but also
hides the data we want to hide.

We add support for an 'unredact_list' method at the Koha::* class level
allowing for individual classes to specify which fields they wish to
expose to restricted users regardless of their restriction.

It is to be used in combination with the is_accessible method introduced
earlier in this patchset which is used to denote whether the current
user should be allowed to see the full record or only a subset of it as
defined in the unredacted_list.

We undefine any fields not listed in the unredact_list for the API
response. This has the effect of still returning the full object of
keys, but setting most fields to a JSON null.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 29523: Remove no longer required methods
Martin Renvoize [Wed, 29 Jun 2022 11:25:35 +0000 (12:25 +0100)]
Bug 29523: Remove no longer required methods

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 29523: Remove the FIXME
Martin Renvoize [Tue, 28 Jun 2022 15:50:29 +0000 (16:50 +0100)]
Bug 29523: Remove the FIXME

This patch works through the unit tests and existing code to allow
removal of the FIXME I introduced earlier in the patchset.

We now require the `user` parameter be passed to `is_accessible` which
in turn makes `user` a required parameter for `to_api` in the
`Koha::Patron` case.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 29523: Cache the restricted branches list
Martin Renvoize [Thu, 3 Mar 2022 14:40:20 +0000 (14:40 +0000)]
Bug 29523: Cache the restricted branches list

This patch introduces a very localised cache of the restricted branches
list in the logged in patron object.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 29523: Pass the logged user around and use for validating
Martin Renvoize [Fri, 26 Nov 2021 15:35:05 +0000 (15:35 +0000)]
Bug 29523: Pass the logged user around and use for validating

In this patch I add 'user', containing the Koha::Patron object for the
logged in user in the params hash we pass around in to_api. I then use
that in a new 'is_accessible' method added to Koha::Patron.

The new method is really the equivilent of 'search_limited' in the plural
class and could perhaps be renamed 'is_limited' or something clearer for
the singular form 'is_filtered' or 'fitler_for_api' or something?

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
8 months agoBug 29523: (QA follow-up) Fix failing test in club holds
Martin Renvoize [Fri, 26 Nov 2021 14:47:12 +0000 (14:47 +0000)]
Bug 29523: (QA follow-up) Fix failing test in club holds

With this patch series, all singular objects need to 'use' their plural
counterparts.. otherwise the parent can't find search_related.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>