]> git.koha-community.org Git - koha.git/log
koha.git
12 months agoBug 34456: (QA follow-up) perltidy code
Kyle M Hall [Mon, 30 Oct 2023 17:31:47 +0000 (13:31 -0400)]
Bug 34456: (QA follow-up) perltidy code

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34456: (QA follow-up) Change download link language
Kyle M Hall [Mon, 30 Oct 2023 17:29:52 +0000 (13:29 -0400)]
Bug 34456: (QA follow-up) Change download link language

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34456: Add the ability to download a template rendered report as a file
Kyle M Hall [Wed, 2 Aug 2023 11:56:46 +0000 (07:56 -0400)]
Bug 34456: Add the ability to download a template rendered report as a file

Bug 34136 adds the ability to render a report using a notice template rather than displaying data in a table. It would be even more useful to be able to download the contents as a file where the notice subject can be used as the filename so the filename can be generated dynamically ( such as adding the current date as part of the filename ).

Test Plan:
1) Follow the test plan for Bug 34136
2) Run your report
3) Note under the Download menu the new item "Download as" with the
   subject line for your template
4) Click that link, note the file contains the contents of your report!

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 35171: (QA follow-up): tidy up POD
Victor Grousset/tuxayo [Mon, 30 Oct 2023 19:58:21 +0000 (20:58 +0100)]
Bug 35171: (QA follow-up): tidy up POD

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 35171: Add send_empty option to runreport
Nick Clemens [Thu, 26 Oct 2023 18:03:40 +0000 (18:03 +0000)]
Bug 35171: Add send_empty option to runreport

This patch adds a new 'send_empty' option to runreport.pl

To test:
1 - Create a report in Koha that will not return any results:
    SELECT barcode FROM items WHERE 1=2
2 - perl misc/cronjobs/runreport.pl 1
3 - Output is: NO OUTPUT: 0 results from execute_query
4 - perl misc/cronjobs/runreport.pl 1 --send_empty
5 - Output is: no results were returned for the report
6 - perl misc/cronjobs/runreport.pl 1 --send_empty --email
7 - It will die on an email error unless you have SMTP configured - this si good, it means we sent an email
8 - Bonus points: Test on a system that can correctly send emails, confirm it works :-)

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>
12 months agoBug 34008: Harmonize attribute names
Tomas Cohen Arazi [Mon, 30 Oct 2023 16:14:16 +0000 (13:14 -0300)]
Bug 34008: Harmonize attribute names

This patch harmonizes the attribute names with what is used for `items`
and `checkouts` in terms of terminology.

It also adapts the tests so they are less random failure-prone (they had
a fixed value for the item type, which might make things explode if the
chosen value already exists on the DB.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34008: (QA follow-up) 'item_type_id' should be used
Tomas Cohen Arazi [Mon, 30 Oct 2023 14:08:15 +0000 (11:08 -0300)]
Bug 34008: (QA follow-up) 'item_type_id' should be used

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34008: Add REST endpoint for list of itemtypes
Andreas Jonsson [Sat, 16 Sep 2023 10:13:15 +0000 (10:13 +0000)]
Bug 34008: Add REST endpoint for list of itemtypes

Test plan:
* Enable the system preference RESTBasicAuth
* curl -s --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes
  should give 401 Unauthorized
* curl -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes
  should produce JSON-list of itemtypes
* curl -s -u koha:koha --header "x-koha-embed: translated_descriptions" --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes
  should include the field translated_descriptions containing the translated descriptions, if any

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] perltidy -b t/db_dependent/api/v1/itemtypes.t # Resolve bad score of 44
[EDIT] chmod 755 t/db_dependent/api/v1/itemtypes.t
[EDIT] perltidy -b Koha/REST/V1/ItemTypes.pm
Lesson: Please run qa tools yourself and adjust accordingly?
Edit (tcohen): I restored the item_type_translated_description.yaml file
as the entire API was broken because of the lack of it.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 33664: DBRev 23.06.00.058
Tomas Cohen Arazi [Wed, 1 Nov 2023 20:08:48 +0000 (17:08 -0300)]
Bug 33664: DBRev 23.06.00.058

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 33664: (follow-up) Move check for 'received' to include Modify link
Katrin Fischer [Mon, 30 Oct 2023 15:34:19 +0000 (15:34 +0000)]
Bug 33664: (follow-up) Move check for 'received' to include Modify link

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 33664: Add ability to cancel order lines in closed baskets
Katrin Fischer [Fri, 28 Jul 2023 15:39:38 +0000 (15:39 +0000)]
Bug 33664: Add ability to cancel order lines in closed baskets

At the moment it's only possible to cancel order lines while the
basket is still open or from the pending orders page during processing
a shipment. The latter requires you to add a shipment and fake an
invoice. To make things easier we want to optionally allow cancelling
order lines in closed baskets from the basket summary page.

Before applying the patch:

1) Set up data
* Create a new basket
* Create a few order lines, at least 3
* Close the basket
* Receive shipment and receive one order line

2) Verify current behaviour
* On basket summary page: you cannot cancel while the basket is closed
* On the pending orders page you can cancel

Apply patch, run database update, restart_all

3) Verify new behaviour
* Verify that nothing has changed on pending orders and basket summary
* Switch new system preference CancelOrdersInClosedBaskets to "Allow"
* Verify that pending orders hasn't changed a bit
* Verify that you now can cancel your order lines in the closed basket
  Exception: the received order line should not be cancellable

Test anything else that you think might make sense ;)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 35074: Add support for category_code to writeoff_debts
Martin Renvoize [Tue, 17 Oct 2023 11:39:44 +0000 (12:39 +0100)]
Bug 35074: Add support for category_code to writeoff_debts

This patch adds support for passing category_code as a limiter for the
writeoff_debts script.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 35074: Use patron relationship alias
Martin Renvoize [Fri, 27 Oct 2023 13:02:27 +0000 (14:02 +0100)]
Bug 35074: Use patron relationship alias

This patch updates the existing Koha::Account::Line->patron accessor to
use the new aliased 'patron' relation in the schema class

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 35074: Add patron relationship alias
Martin Renvoize [Fri, 27 Oct 2023 13:01:35 +0000 (14:01 +0100)]
Bug 35074: Add patron relationship alias

This patch adds the 'patron' relationship alias to the Acountline
DBIx::Class schema.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 32730: Add tests for Koha::Patron->get_lists_with_patron
Tomas Cohen Arazi [Wed, 1 Nov 2023 19:52:08 +0000 (16:52 -0300)]
Bug 32730: Add tests for Koha::Patron->get_lists_with_patron

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 32730: Add FIXME in POD to highlight return value
Tomas Cohen Arazi [Wed, 1 Nov 2023 19:15:07 +0000 (16:15 -0300)]
Bug 32730: Add FIXME in POD to highlight return value

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 32730: Add Patron Lists tab to patron details and circulation pages
Michael Hafen [Fri, 27 Jan 2023 18:14:32 +0000 (11:14 -0700)]
Bug 32730: Add Patron Lists tab to patron details and circulation pages

Test Plan:
1. Apply patch
2. create a patron list if there aren't any
3. search for a patron
4. observe the "Patron lists" tab showing the list that the patron is not in
5. try adding the patron to the list and removing them from the list to
   be sure the feature has full operation
6. click "Check Out" on the side bar menu to navigate to the circulation
   page for this patron
7. observe the "Patron lists" tab, and verify it operates as it did on the
   patron details page

Bug 32730: (follow-up) Minor corrections
   by Owen Leonard

This patch corrects an instance of an incorrect capital letter
("Patron Lists" -> "Patron lists") and makes minor tweaks to
indentation.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Edit: (tcohen) new files should be run through perltidy ALWAYS. Did it
and squashed it here.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 26170: DBIC booleans
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:53:51 +0000 (15:53 -0300)]
Bug 26170: DBIC booleans

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 26170: API behavior change tests
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:45:36 +0000 (15:45 -0300)]
Bug 26170: API behavior change tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 26170: DBRev 23.06.00.057
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:35:33 +0000 (15:35 -0300)]
Bug 26170: DBRev 23.06.00.057

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 26170: DBIC schema
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:26:31 +0000 (15:26 -0300)]
Bug 26170: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 26170: Add protected status for patrons
Magnus Enger [Thu, 15 Jun 2023 12:21:19 +0000 (12:21 +0000)]
Bug 26170: Add protected status for patrons

This set of patches makes it possible to protect patrons from being accidetally
deleted or merged with other patrons, from the UI and from (well behaved) cron
jobs. The following subroutines are affected:
- Koha::Patron::delete
- Koha::Patron::merge_with
- Koha::Patron::safe_to_delete
- C4::Members::GetBorrowersToExpunge

Please note:
- This does not intend to protect patrons from being edited, only from being
  deleted

To test:

* Tests
- Run the affected tests:
  prove t/db_dependent/Members.t
  prove t/db_dependent/Koha/Patrons.t

* Editing protected status and manual deletion
- Add a new user, note the presence of the "Protected" field under "Library
  management", but leave it at the default "No", for now.
- Note that "Protected" is displayed in the "Library use" section of the patron
  details.
- Note that More > Delete is avaiable as an action when the patron is saved
- Edit the user and set "Protected" to "Yes"
- Note that More > Delete is now disabled, with a note that the patron is protected

* Batch patron deletion
- Go to Tools > Batch patron deletion and anonymization
- Check the box for "Verify you want to delete patrons"
- Choose the category of your protected patron for "whose patron category is"
  and click "Next" to run the actual deletion
- Check that your protected patron was not deleted

* Merging patrons
- Make sure you have two patrons with similar names or the same category, so
  you can find them with one search. One should be protected, one not.
- Search for the patrons, tick their boxes and click on "Merge selected patrons"
- Select one of the patrons as the "patron to keep".
. Click on "Merge patrons"
- "No valid patrons to merge were found" should be shown
- Repeat this with the other patron as the "patron to keep"
(A future enhancement could be to not allow a protected patron to be selected for
merging in the first place.)

* misc/cronjobs/delete_patrons.pl
- Make sure you have a protected patron, in a category with at least one more
  patron.
- Run something like this (at least in ktd):
  $ perl misc/cronjobs/delete_patrons.pl --category_code <code> -v --confirm
  (Replace <code> with the actual categorycode.)
- Make sure the borrowernumber of the protected patron is not mentioned in the
  output of the script.
- Check the protected patron was not deleted
- Check the non-protected patrons were deleted

* REST API (with ktd)
- Make sure you still have a protected patron, and note their borrowernumber
- Enable RESTBasicAuth and restart all the things
- Run these two commands from the command line on the host:
  $ curl -u koha:koha --request GET "http://localhost:8081/api/v1/patrons/54"
  $ curl -u koha:koha --request DELETE "http://localhost:8081/api/v1/patrons/54"
  (Replace 54 with the actual borrowernumber of your protected patron.)
- The first curl command should give you the patron details. The second should
  give this output:
  {"error":"Protected patrons cannot be deleted","error_code":"is_protected"}

There could be more functions/scripts where patrons are deleted that I have not
thought about. Please report them on the bug if you find any!

Update 2023-10-19: Fix "More > Delete" on patron, so link can not be clicked.
Update 2023-10-19: Rebase

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 26170: Database update
Magnus Enger [Thu, 15 Jun 2023 12:13:45 +0000 (12:13 +0000)]
Bug 26170: Database update

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 33353: Add compatibility with Search::Elasticsearch 8.0
Julian Maurice [Tue, 28 Mar 2023 15:02:19 +0000 (17:02 +0200)]
Bug 33353: Add compatibility with Search::Elasticsearch 8.0

For some reasons, with Search::Elasticsearch 8.0 JSON::true is
interpreted as 1 and Elasticsearch will always respond that it found "at
least 1 record". Something like this:

{
    total => {
        value => 1,
        relation => 'gte'
    }
}

Replacing JSON::true by \1 works with every version of
Search::Elasticsearch I tested (6.80, 7.717, 8.0)

Also worth noting:
Search::Elasticsearch will stop being supported by Elastic
https://github.com/elastic/elasticsearch-perl/issues/220

We might need to find an alternative for future versions of
Elasticsearch

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Philip Orr <philip.orr@lmscloud.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 33353: Add compatibility with Elasticsearch 8.x
Julian Maurice [Tue, 28 Mar 2023 14:41:08 +0000 (16:41 +0200)]
Bug 33353: Add compatibility with Elasticsearch 8.x

Elasticsearch 8 removed the support of types. This patch adapts the
requests accordingly.
With this patch, Koha will still be compatible with Elasticsearch 7.x
but will no longer work with Elasticsearch 6.x
Since Elasticsearch 6.x is no longer maintained, this should not be a
problem.

https://www.elastic.co/guide/en/elasticsearch/reference/7.17/removal-of-types.html

Tested with Search::Elasticsearch 6.80 and 7.717

Test plan:
1. Install Elasticsearch 8
   (use docker image: docker.io/koha/elasticsearch-icu:8.x)
2. Change the elasticsearch server location in $KOHA_CONF
3. Run misc/search_tools/rebuild_elasticsearch.pl -r -b -v
   It should fail
4. Apply the patch
5. Run misc/search_tools/rebuild_elasticsearch.pl -r -b -v
   It should end with "Total XXX records indexed"
6. Try to search some biblios and verify that it works the same as
   before

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Philip Orr <philip.orr@lmscloud.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 35180: DBIC schema
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:26:00 +0000 (15:26 -0300)]
Bug 35180: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34520: DBIC schema
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:24:43 +0000 (15:24 -0300)]
Bug 34520: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34587: Fix stray type definition
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:00:13 +0000 (15:00 -0300)]
Bug 34587: Fix stray type definition

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34587: Fix license issues
Tomas Cohen Arazi [Wed, 1 Nov 2023 12:26:03 +0000 (09:26 -0300)]
Bug 34587: Fix license issues

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34587: DBRev 23.06.00.056
Tomas Cohen Arazi [Tue, 31 Oct 2023 19:37:35 +0000 (16:37 -0300)]
Bug 34587: DBRev 23.06.00.056

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34587: Atomicupdate tweaks
Tomas Cohen Arazi [Tue, 31 Oct 2023 19:11:49 +0000 (16:11 -0300)]
Bug 34587: Atomicupdate tweaks

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34587: Updated cypress tests
Matt Blenkinsop [Fri, 27 Oct 2023 16:24:16 +0000 (16:24 +0000)]
Bug 34587: Updated cypress tests

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>
(cherry picked from commit 05cf3d9f6a7ddf163d2e144436a6ff8e5854d7e4)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34587: (QA follow-up) Tidy
Nick Clemens [Fri, 27 Oct 2023 15:36:06 +0000 (15:36 +0000)]
Bug 34587: (QA follow-up) Tidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34587: Add IR_A1 fields to COUNTER report
Pedro Amorim [Fri, 27 Oct 2023 11:54:42 +0000 (11:54 +0000)]
Bug 34587: Add IR_A1 fields to COUNTER report

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
12 months agoBug 34587: Fix ->validation->output in API endpoints
Matt Blenkinsop [Thu, 26 Oct 2023 09:09:10 +0000 (09:09 +0000)]
Bug 34587: Fix ->validation->output in API endpoints

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>
12 months agoBug 34587: (QA follow-up): squash
Pedro Amorim [Wed, 25 Oct 2023 13:58:22 +0000 (13:58 +0000)]
Bug 34587: (QA follow-up): squash

Tidy
$c->validation in API controllers
File permissions
.inc file filters

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>
12 months agoBug 34587: Move YOP to mus/yus instead of erm_usage_titles
Pedro Amorim [Tue, 24 Oct 2023 15:06:59 +0000 (15:06 +0000)]
Bug 34587: Move YOP to mus/yus instead of erm_usage_titles

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>
12 months agoBug 34587: Add tests for the custom report API endpoints
Matt Blenkinsop [Mon, 23 Oct 2023 13:58:05 +0000 (13:58 +0000)]
Bug 34587: Add tests for the custom report API endpoints

prove t/db_dependent/api/v1/erm_custom_reports.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>
12 months agoBug 34587: Add access_type and yop to the reports viewer
Matt Blenkinsop [Fri, 20 Oct 2023 15:45:26 +0000 (15:45 +0000)]
Bug 34587: Add access_type and yop to the reports viewer

Some report types include access_type and yop headers for each usage statistics

The hierarchy is as follows: yop - access_type - metric_type
I.e. for each yop there are report lines for access_type and then for each access_type there are also report lines for metric types

This patch adds helper functions to populate the report rows based on this hierarchy and the report data retrieved from the database

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>
12 months agoBug 34587: SushiCounter tests
Pedro Amorim [Tue, 29 Aug 2023 15:11:54 +0000 (15:11 +0000)]
Bug 34587: SushiCounter tests

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>
12 months agoBug 34587: Improve title uniqueness rules
Pedro Amorim [Mon, 23 Oct 2023 11:02:36 +0000 (11:02 +0000)]
Bug 34587: Improve title uniqueness rules

Improve robustness of unique matching here, to make sure we always match for same title if the case,

Some report rows may correspond to the same title as the previous row but have an empty match field, or alternatively come with a filled match field (e.g. DOI or Print_ISSN in TR_J4. Because of this we only verify a uniqueness match field if both current row and previous have it non-empty, otherwise we keep checking the remaining uniqueness match fields.

Example of this use-case, COUNTER report:
title    | publisher | platform  | Proprietary_ID | Print_ISSN | DOI     | YOP  | usages
examplet | examplep  | examplepl | 1              | 123        |        | 2020 | usages
examplet | examplep  | examplepl | 1              | 123        |someDOI | 2021 | usages

The above 2 rows is the same title, same publisher, same proprietary_id,
same Print_ISSN, etc. It just so happens that one was returned by SUSHI
with DOI and the other wasnt.
These 2 rows correspond to different usage statistics by YOP, not 2
different usage_titles

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>
12 months agoBug 34587: Add proprietary_id and platform to erm_usage_titles
Pedro Amorim [Tue, 24 Oct 2023 10:42:13 +0000 (10:42 +0000)]
Bug 34587: Add proprietary_id and platform to erm_usage_titles

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>
12 months agoBug 34587: Update database columns length
Pedro Amorim [Mon, 23 Oct 2023 12:37:32 +0000 (12:37 +0000)]
Bug 34587: Update database columns length

Some COUNTER files have long data in these fields and were causing new
database entries to fail

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>
12 months agoBug 34587: Improve SUSHI COUNTER error handling
Pedro Amorim [Mon, 23 Oct 2023 12:36:15 +0000 (12:36 +0000)]
Bug 34587: Improve SUSHI COUNTER error handling

This is doing a few things, checking for sushi errors:
1) Abort background job and provide error message if SUSHI returned
   {Severity} in response, this means SUSHI error, docs here:
https://app.swaggerhub.com/apis/COUNTER/counter-sushi_5_0_api/5.0.2#/SUSHI_error_model

2) Abort background job and provide error message if SUSHI provided
   proper response, but contains Exceptions in Report_Header

3) Abort background job and provide error message if SUSHI returned 0
   report items (e.g. everything is fine but there are no items for the
   harvest period provided

4) Abort background job and provide error message if COUNTER file
   created is larger than allowed by the database.

5) Provide error message if manual upload file size exceeds the max
   allowed by the database

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>
12 months agoBug 34587: Fix total added objects in job report
Pedro Amorim [Mon, 23 Oct 2023 10:59:57 +0000 (10:59 +0000)]
Bug 34587: Fix total added objects in job report

Remove obsolete total_records code, this was a leftover from when this code was in UsageDataProvider.pm
Add a new job_callback 'added_usage_objects' to handle total objects added (titles, platforms, databases, items)
Update job report include file

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>
12 months agoBug 34587: Fix 'Import logs' sorting by import date
Pedro Amorim [Mon, 23 Oct 2023 09:59:24 +0000 (09:59 +0000)]
Bug 34587: Fix 'Import logs' sorting by import date

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>
12 months agoBug 34587: Add report type and provider name to failed background job report
Matt Blenkinsop [Wed, 20 Sep 2023 16:51:01 +0000 (16:51 +0000)]
Bug 34587: Add report type and provider name to failed background job report

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>
12 months agoBug 34587: Fix dry run and end date in the cronjob
Matt Blenkinsop [Wed, 20 Sep 2023 14:57:14 +0000 (14:57 +0000)]
Bug 34587: Fix dry run and end date in the cronjob

The cronjob always logs a dry run even on a live harvest and the end date parameter was not working correctly. This patch addresses both issues

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>
12 months agoBug 34587: Add try catch blocks to object creation
Matt Blenkinsop [Wed, 20 Sep 2023 13:13:12 +0000 (13:13 +0000)]
Bug 34587: Add try catch blocks to object creation

Currently a harvest fails completely if a single title fails to harvest. Rather than failing the entire job, this patch introduces try catch blocks to stop this and allow the job to continue. Failed imports are recorded and displayed in the background job UI on job completion

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>
12 months agoBug 34587: Remove counter files from API embedding to improve performance
Matt Blenkinsop [Tue, 19 Sep 2023 12:07:55 +0000 (12:07 +0000)]
Bug 34587: Remove counter files from API embedding to improve performance

Rather than fetching the counter files and embedding the counter logs, we now add a foreign key to the data provider in the counter logs table and fetch them directly.

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>
12 months agoBug 34587: Update field lengths to 255 characters
Matt Blenkinsop [Mon, 18 Sep 2023 16:00:28 +0000 (16:00 +0000)]
Bug 34587: Update field lengths to 255 characters

(cherry picked from commit 9f384df2ad5f4c037b052e8914d7e4b3e5f26670)
(cherry picked from commit 02c9a57af9f27cf528a2eb924876037890cf5504)

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>
12 months agoBug 34587: Add Create from registry button
Matt Blenkinsop [Tue, 12 Sep 2023 14:53:33 +0000 (14:53 +0000)]
Bug 34587: Add Create from registry button

Currently there is no option to go back to using the registry API to create a provider once "Create manually" has been clicked

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>
12 months agoBug 34587: Fix url validation
Matt Blenkinsop [Fri, 8 Sep 2023 14:33:50 +0000 (14:33 +0000)]
Bug 34587: Fix url validation

We need to check whether the url ends in a trailing "/" and also whether it ends in "/reports" for a SUSHI harvest. Two new functions are added to manage this and prevent failed harvests.

report_type is also now lowercase in the url and the dates are truncated to YYYY-MM format

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>
12 months agoBug 34587: New sushi counter class
Pedro Amorim [Tue, 29 Aug 2023 12:52:00 +0000 (12:52 +0000)]
Bug 34587: New sushi counter class

Moves a lot of the logic for creating a counter file and parsing a SUSHI response to a new class to simplify logic

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>
12 months agoBug 34587: Move everything into a ERM/EUsage subfolder
Pedro Amorim [Tue, 29 Aug 2023 11:39:40 +0000 (11:39 +0000)]
Bug 34587: Move everything into a ERM/EUsage subfolder

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>
12 months agoBug 34587: Add borrowernumber to counter logs display
Matt Blenkinsop [Thu, 24 Aug 2023 14:40:47 +0000 (14:40 +0000)]
Bug 34587: Add borrowernumber to counter logs display

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>
12 months agoBug 34587: Add integration with the counter registry API
Matt Blenkinsop [Thu, 24 Aug 2023 14:09:57 +0000 (14:09 +0000)]
Bug 34587: Add integration with the counter registry API

The counter registry offers an API that provides SUSHI information for each provider. This will be incredibly useful for creating new providers as we can use the correct information from the registry for harvesting urls etc. This reduces the risk of user input errors when creating providers and gives greater reliability to the data required to successfully harvest from the SUSHI API

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>
12 months agoBug 34587: Improve error handling for connection testing
Matt Blenkinsop [Wed, 23 Aug 2023 11:05:25 +0000 (11:05 +0000)]
Bug 34587: Improve error handling for connection testing

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>
12 months agoBug 34587: Remove q_header parameter from API specs
Matt Blenkinsop [Tue, 22 Aug 2023 13:23:25 +0000 (13:23 +0000)]
Bug 34587: Remove q_header parameter from API specs

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>
12 months agoBug 34587: File upload - Background job
Pedro Amorim [Mon, 21 Aug 2023 14:50:45 +0000 (14:50 +0000)]
Bug 34587: File upload - Background job

ErmSushiHarvester background job will now be initiated by either
enqueue_counter_file_processing_job or by enqueue_sushi_harvest_jobs
from Koha/ERM/UsageDataProvider.pm, the former if triggered by a manual
file upload, the latter if by the 'run now' button or by the cron script.

This commit also includes some rewording/refactoring, namely:
- COUNTER file validation now happens in the API, before enqueuing the job.
- Removal of no longer used POST /erm/counter_files endpoint
- Koha/ERM/UsageDataProvider.pm:
-- run method is now enqueue_sushi_harvest_jobs
-- new enqueue_counter_file_processing_job method
-- harvest method is now harvest_sushi
-- new set_background_job_callbacks method to set the background job callbacks
- REST/V1/ERM/UsageDataProviders
-- run method is now process_SUSHI_response
-- new process_COUNTER_file endpoint

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>
12 months agoBug 34587: Code tidying
Matt Blenkinsop [Thu, 17 Aug 2023 12:21:54 +0000 (12:21 +0000)]
Bug 34587: Code tidying

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>
12 months agoBug 34587: Remove begin_date and end_date as usage_data_providers properties/columns
Pedro Amorim [Wed, 9 Aug 2023 11:05:50 +0000 (11:05 +0000)]
Bug 34587: Remove begin_date and end_date as usage_data_providers properties/columns

(cherry picked from commit 9339eed9358301f7bf17934e2e13fc17205d9cd0)

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>
12 months agoBug 34587: Accept date inputs upon confirming 'run now' button
Pedro Amorim [Tue, 8 Aug 2023 11:15:12 +0000 (11:15 +0000)]
Bug 34587: Accept date inputs upon confirming 'run now' 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>
12 months agoBug 34587: Add a report row for each existing metric_type in a sushi result's perform...
Pedro Amorim [Mon, 7 Aug 2023 14:14:40 +0000 (14:14 +0000)]
Bug 34587: Add a report row for each existing metric_type in a sushi result's performance instance, instead of for reach existing metric_type in the sushi response header, because that might not exist.

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>
12 months agoBug 34587: Make start and end dates in providers summary data dependent
Matt Blenkinsop [Tue, 8 Aug 2023 16:06:48 +0000 (16:06 +0000)]
Bug 34587: Make start and end dates in providers summary data dependent

Currently the start and end dates in the summary tab are based on the earliest and latest harvest run, rather than the earliest and latest data harvested. This should be changed so that we can see the period of data harvested for each 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>
12 months agoBug 34587: Fix keyword search in yearly filtered reports
Matt Blenkinsop [Mon, 7 Aug 2023 12:01:51 +0000 (12:01 +0000)]
Bug 34587: Fix keyword search in yearly filtered 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>