koha.git
3 months agoBug 29440: replace usage of removed GetMarcBiblio
David Gustafsson [Fri, 23 Sep 2022 15:32:51 +0000 (17:32 +0200)]
Bug 29440: replace usage of removed GetMarcBiblio

Signed-off-by: Michał Kula <148193449+mkibp@users.noreply.github.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 29440: defer biblio autolinking until records are indexed
David Gustafsson [Wed, 21 Sep 2022 15:43:32 +0000 (17:43 +0200)]
Bug 29440: defer biblio autolinking until records are indexed

Signed-off-by: Michał Kula <148193449+mkibp@users.noreply.github.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 29440: Fix QA-tool issues
David Gustafsson [Mon, 4 Apr 2022 14:41:00 +0000 (16:41 +0200)]
Bug 29440: Fix QA-tool issues

Signed-off-by: Michał Kula <148193449+mkibp@users.noreply.github.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 29440: Make authorities import behavior consistent with biblios
David Gustafsson [Tue, 9 Nov 2021 11:52:03 +0000 (12:52 +0100)]
Bug 29440: Make authorities import behavior consistent with biblios

The current behavior for when importing authorities, when match
option is enabled, is to insert as a new authority fetching from db
fails. This is both a bit confusing and not consistent with the biblio
case where an error is generated. Also clean up error and log messages
so both messages/errors and when messages/errors are issued are more
consistent for the biblio and authority case.

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Michał Kula <148193449+mkibp@users.noreply.github.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 29440: Refactor and clean up bulkmarcimport.pl
David Gustafsson [Wed, 15 Mar 2017 10:30:50 +0000 (11:30 +0100)]
Bug 29440: Refactor and clean up bulkmarcimport.pl

To test:
1) Import biblios using ./bulkmarcimport.pl -v -b -file biblios.mrc -insert -update -c=MARC21 -match "control-number,001" -n=1 -l "/tmp/import.log"
2) Verify in /tmp/import.log that one biblio has been inserted
3) Import again without the "-n" option, verify that one biblio has been
   updated and the rest inserted
4) In the staff interface search the catalog for some string appearing in
   the imported biblios to verify records have been indexed
5) View/edit some of the biblios the staff interface to very have been
   properly imported
6) Import authorities using ./bulkmarcimport.pl -v -m=MARCXML -a -file authorities.xml -insert -update -c=MARC21 -keepids="024a" -match "heading-main,100a" -l "/tmp/import.log" -yaml="/tmp/ids.yml"
7) Go to the authorities page and find the imported authority by for example search for a
   400 or 100 field value. Verify that the 001 field of the incoming record has been moved to 024a.
   Also check that the value of 024a appear as a key in /tmp/ids.yml.
8) Edit the authorities.xml file and change the value of field 400a
9) Import authorities again using the same options
10) Verify that the 400a field of the authority in Koha has not been
   updated (the import was skippped since revision did not change)
11) Edit authorities.xml, replace the value of field 005 in the file with field 005
    of the authority in Koha incremented by one
12) Import again with the same options
13) Verify that the 400a field of the authority in Koha now have been
    updated

Signed-off-by: Michał Kula <148193449+mkibp@users.noreply.github.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33036: (QA follow-up) Tidy code
Katrin Fischer [Mon, 18 Mar 2024 09:37:17 +0000 (09:37 +0000)]
Bug 33036: (QA follow-up) Tidy code

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33036: Improve REST API controller
Jonathan Druart [Thu, 14 Dec 2023 10:08:37 +0000 (11:08 +0100)]
Bug 33036: Improve REST API controller

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33036: Use Koha::Objects
Jonathan Druart [Thu, 14 Dec 2023 09:55:42 +0000 (10:55 +0100)]
Bug 33036: Use Koha::Objects

Better to use Koha::Objects everywhere and have the same pattern for the
different related objects.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33036: Add more tests
Jonathan Druart [Thu, 14 Dec 2023 09:29:32 +0000 (10:29 +0100)]
Bug 33036: Add more tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33036: Improve merge_with tests
Jonathan Druart [Thu, 14 Dec 2023 09:00:25 +0000 (10:00 +0100)]
Bug 33036: Improve merge_with tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33036: REST API: Merge biblio records implements merging of records
Zeno Tajoli [Wed, 15 Nov 2023 07:41:17 +0000 (08:41 +0100)]
Bug 33036: REST API: Merge biblio records implements merging of records

+ attached items, subscriptions etc via the API as an alternative to the web interface: cgi-bin/koha/cataloguing/merge.pl

This is a slightly improved version of Zenos patch: I (domm) have converted the code in Koha::Biblio to a more DBICy style and packed it into a transaction (as requested in Comment 23)

Even the QA script is happy now!

To test:
    1) you need an API user with the permissions "editcatalogue"
    2) two records: one to be merged into (with biblio_id, eg 262) and another one from
       which to merge (with biblio_id_to_merge, eg 9) which will be deleted!
       both records may/should have items, subscription, subscriptionhistory, serial, suggestions
       orders and holds
    3) check both records via the web
    4) Apply patch
    5) Write a JSON file with inside the field 'biblio_id_to_merge' and the biblionumber from wihich to merge.
       As example:
       {
         "biblio_id_to_merge" : 9
       }
     6) Execute an API call with correct headers and location. For example:
        curl -s -u koha:koha --header "Content-Type: application/json" --header "Accept: application/marc-in-json"
                  --request POST "http://127.0.0.1:8080/api/v1/biblios/262/merge" -d @file.json
        You must to setup the headers and to use a json file with parameters
     7) The record with the id 9 is deleted now, the record with 262 has all items, etc attached,
        the return is: return code 200 and the changed record 262 in marc-in-json format
     8) It is possible to override biblio data with an external bib record. You need to put external bib record
        into the json file in marc-in-json format. To write use the json file uploaded as example
        You need to fill the fields 'rules' and 'datarecord'. The field 'rules' must contains 'override_ext'
        To do the call:
         curl -s -u koha:koha --header "Content-Type: application/json" --header "Accept: application/marc-in-json"
                  --request POST "http://127.0.0.1:8080/api/v1/biblios/XXX/merge" -d @file_with_recod.json
      9) The record in 'biblio_id_to_merge' is deleted now, in biblio XXX now there are the bibliographic data
         of field 'datarecord' of json file, the return is: return code 200 and the changed record XXX in marc-in-json format
      10) Go into intranet and do a search. Select two or (better) more record.
      11) Merge them; merge must be a success.
      12) Test with prove -v t/db_dependent/Koha/Biblio.t
      13) Test with prove -v t/db_dependent/api/v1/biblios.t

To test with curl the step 8 you can customize the json file attached in bugzilla.
The marc-in-json record inside follows the MAR21 standard

Sponsored-by: Technische Hochschule Wildau
Co-authored-by: Zeno Tajoli <ztajoli@gmail.com>
Co-authored-by: Thomas Klausner <domm@plix.at>
Co-authored-by: Mark Hofstetter <<mark@hofstetter.at>>
Signed-off-by: Jan Kissig <jkissig@th-wildau.de>
Bug 33036: Update of test number.

File ../biblios.t was update with a new subutest.
So we need this update to have a 'OK' after test running.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33431: Fix remaining cases
Tomas Cohen Arazi [Thu, 6 Apr 2023 14:27:14 +0000 (11:27 -0300)]
Bug 33431: Fix remaining cases

This patch tweaks three remaining cases, that are not covered by tests.

To test:
1. Apply this patch
2. Make use of those places
=> SUCCESS: No behavior change

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33431: Make C4::Record use C4::Context->yaml_preference
Tomas Cohen Arazi [Thu, 6 Apr 2023 13:55:41 +0000 (10:55 -0300)]
Bug 33431: Make C4::Record use C4::Context->yaml_preference

This patch makes what the title says.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Rec*
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33431: Make C4::Circulation use C4::Context->yaml_preference
Tomas Cohen Arazi [Thu, 6 Apr 2023 13:48:04 +0000 (10:48 -0300)]
Bug 33431: Make C4::Circulation use C4::Context->yaml_preference

This patch removes manual YAML handling for sysprefs in C4::Circulation.

It also makes C4::Context->yaml_preference not warn when undef is
retrieved from the sysprefs.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Circulation*
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33171: Fix missing price when mapped from MarcItemFieldsToOrder
Matt Blenkinsop [Wed, 29 Nov 2023 11:11:37 +0000 (11:11 +0000)]
Bug 33171: Fix missing price when mapped from MarcItemFieldsToOrder

This patch fixes an issue where the price is not passed to the UI when read from MarcItemFieldsToOrder.

Test plan:
1) In Administration, copy and paste the following into MarcItemFieldsToOrder:
quantity: 975$q
budget_code: 975$h
price: 975$p
itype: 975$y
coded_location_qualifier: 975$a
barcode: 975$b
enumchron: 975$c
2) Save
3) Navigate to Acquisitions and find a basket
4) Click Add to basket and select From a new file
5) Choose the file attached to this bug
6) Upload file and click Stage for import
7) Click Add staged files to basket once the job is finished
8) Check the box next to the record
9) The price should show 10.00 under Item record 1
10) coded location qualifier, barcode, enumchron should also have values as per the other commit on this bug
11) Save and import, the basket should not have a value of 0 as the price has been read correctly
12) Check the database, the newest item should have values for price, coded_location_qualifier, barcode and enumchron

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33171: Add coded_location_qualifier, barcode, and enumchron to MarcItemFieldsToOrder
Kyle Hall [Wed, 8 Mar 2023 16:08:37 +0000 (11:08 -0500)]
Bug 33171: Add coded_location_qualifier, barcode, and enumchron to MarcItemFieldsToOrder

Some libraries would like to use the following item fields with the MarcItemFieldsToOrder system preference:
* coded_location_qualifier
* barcode
* enumchron

Test Plan:
1) Set up MarcItemFieldsToOrder, verify it is functioning
2) Test coded_location_qualifier, barcode, and enumchron
3) Note the fields are imported and set for the items

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35331: Fix URL parmameter in unit test
Katrin Fischer [Mon, 18 Mar 2024 08:44:24 +0000 (08:44 +0000)]
Bug 35331: Fix URL parmameter in unit test

method => op

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35331: (QA follow-up): Patron ILL history
Pedro Amorim [Thu, 16 Nov 2023 10:01:16 +0000 (10:01 +0000)]
Bug 35331: (QA follow-up): Patron ILL history

With the previous patches applied and successfull test plans, access the users ILL history page, visit:
/cgi-bin/koha/members/ill-requests.pl?borrowernumber=51

Notice you get an error.
Apply this patch, and try again, notice the error is gone and the custom plugin action is also in the patron's ILL history table

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35331: (QA follow-up): Avoid code pattern iterating on plugin responses
Pedro Amorim [Wed, 15 Nov 2023 15:26:33 +0000 (15:26 +0000)]
Bug 35331: (QA follow-up): Avoid code pattern iterating on plugin responses

(see bug 28010) Use plugin call pattern established in bug 28211.

Please utilize version 1.0.1 of the plugin to test this follow-up:
https://github.com/PTFS-Europe/koha-plugin-ill-actions/releases/tag/v1.0.1

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35331: Add plugin hook tests
Pedro Amorim [Tue, 14 Nov 2023 09:41:24 +0000 (09:41 +0000)]
Bug 35331: Add plugin hook tests

prove t/db_dependent/Koha/Plugins/Ill_hooks.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35331: CSRF follow-up
Pedro Amorim [Wed, 6 Mar 2024 10:25:08 +0000 (10:25 +0000)]
Bug 35331: CSRF follow-up

Update method to op

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35331: Add table actions hook to ILL table
Pedro Amorim [Mon, 13 Nov 2023 17:24:23 +0000 (17:24 +0000)]
Bug 35331: Add table actions hook to ILL table

Test plan, k-t-d, apply patches:
1) Install FreeForm backend, enable ILLModule sys pref, run:
   bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) Navigate to ILL requests, visit:
   /cgi-bin/koha/ill/ill-requests.pl
3) Click '+New ILL request', select a type, enter an existing cardnumber (e.g. '42') and pick a library. Click 'Create'.
4) Visit ILL requests again, repeat 2)
5) Notice the row for the created request has the already existing action button 'Manage request'
6) Install the ILL actions plugin, located at:
   https://github.com/PTFS-Europe/koha-plugin-ill-actions/releases/tag/v1.0.0
7) Restart plack, run:
   koha-plack --restart kohadev
8) Repeat 4) and 5). Notice the row for the created request now has a new custom action in addition to the already existing core one.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 26597: Update the description of the PrefillGuaranteeField system preference
Emily-Rose Francoeur [Tue, 31 Oct 2023 12:58:51 +0000 (08:58 -0400)]
Bug 26597: Update the description of the PrefillGuaranteeField system preference

I updated the system preference description so that we now know this option is working from both the guarantee and guarantor forms.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 26597: (QA follow-up) Add missing filters
Hammat Wele [Wed, 31 May 2023 13:15:18 +0000 (13:15 +0000)]
Bug 26597: (QA follow-up) Add missing filters

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_da...
Hammat Wele [Tue, 30 May 2023 21:41:14 +0000 (21:41 +0000)]
Bug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_data input

This patch remove the REST API call in select_user function and retrieve the patron's data from borrower_data

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click Select
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 26597: (follow-up) Add disabling / enabled the save button while waiting from...
Hammat Wele [Wed, 22 Mar 2023 15:25:43 +0000 (15:25 +0000)]
Bug 26597: (follow-up) Add disabling / enabled the save button while waiting from api to respond

I've updated the test plan since the REST API route takes a little time to respond

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click Select
7) Wait until save button is enabled
8) Confirm guarantee's information is filled from the guarantor's record
9) Check that any preexisting information is not overwritten

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 26597: Fixing the populate of fields when using the REST API route
Hammat Wele [Tue, 13 Dec 2022 22:27:29 +0000 (22:27 +0000)]
Bug 26597: Fixing the populate of fields when using the REST API route

This attachment correct the populate of fields by using the api mapping.
Now All fields are populated following the selected PrefillGuaranteeField options

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 26597: Transfer informations from guarantor when adding a guarantor to an existin...
Hammat Wele [Wed, 7 Dec 2022 16:51:20 +0000 (16:51 +0000)]
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron

When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. This patch makes it so those informations are also transfered when adding a new guarantor relationship to an existing patron.

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on 'Search to add' in 'Patron guarantor' fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click 'Select'
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 29522: Unit test
Nick Clemens [Fri, 26 Jan 2024 13:15:12 +0000 (13:15 +0000)]
Bug 29522: Unit test

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 29522: [alternate] Skip relinking bibliographic records when merging authorities
Nick Clemens [Wed, 6 Sep 2023 15:48:12 +0000 (15:48 +0000)]
Bug 29522: [alternate] Skip relinking bibliographic records when merging authorities

If autolinking is enabled, there are scenarios where the authorities merge process
updates the record, then sends it to ModBiblio which then AutoLinks the record, undoing
the changes in the record (as the 'from' authority is not removed until the process is complete)

This patch simply disables the autolinking process when merging authorities

To test:

Set system preferences
    AutoCreateAuthorities = don't generate
    RequireChoosingExistingAuthority = don't require
    AutoLinkBiblios = Do
    CatalogModuleRelink = Do
    LinkerKeepStale = Don't
    LinkerModule = first match
    LinkerRelink = Do

1. Create an authority record
   1.1. Go to Authorities
   1.2. Click on "New authority" and choose an authority type (I chose Corporate name)*
   1.3. Fill in the mandatory fields (000, 003, 005, 008, 040)
   1.4. In tab 1, click on the label of the main heading (110 for Corporate name)
   1.5. Fill in subfield
   1.6. Copy content of subfield
   1.7. Click on "Save"
   1.8. Note the authority record number

2. Duplicate the authority record
   2.1. Click on "Edit" and choose "Edit as new (duplicate)"
   2.2. Click on "Save"
   2.3. Click on "No: Save as new authority"
   2.4. Note the authority record number (should be the number from step 1.8 +1)

3. Link one of the authority records to a bibliographic record
   3.1 In another tab, do a catalog search
   3.2. Click on "Edit record" under one of the search results
   3.3. Go to the relevant tab (for corporate name, I used field 710 in tab 7)
        3.3.a. If there are no empty fields for that tag, click the "Repeat this tag" button (two rectangles)
   3.4. Paste the text previously copied in subfield
   3.5. Click on "Link authorities automatically" at the top of the page
   3.6. Note the authority record number in subfield
        --> The linked authority record should be the first authority record (step 1.8)
   3.7. Click on "Save"

4. Merge the two authority records, keep the one that is not linked to the bibliographic record
   4.1. Go back to the tab with the authorities
   4.1. Go to Authorities
   4.2. Search for the aurhorities previous created
   4.2. Click on "Actions" and choose "Merge" for both records
   4.3. Select the record number that is NOT linked to the bibliographic record
   4.4. Click on "Next"
   4.5. Click on "Merge"

5. Check the bibliographic record
   5.1. Go back to the tab with the bibliographic record and refresh the page (Ctrl+F5)
   5.2. Hover the mouse cursor over the name or term, without clicking
   5.3. Note the record number that appears at the bottom of the screen
        --> The record number was not changed
6. Apply the patch
    6.1. Run prove t/AuthoritiesMarc_MARC21.t
    6.2. Repeat Previous steps 1, 2, 3, 4, 5
        --> The record number is change

Signed-off-by: Barbara Petritsch <barbara.petritsch@wienmuseum.at>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35944: (QA follow-up) Tidy
Nick Clemens [Fri, 15 Mar 2024 11:37:54 +0000 (11:37 +0000)]
Bug 35944: (QA follow-up) Tidy

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35944: (QA follow-up) Check if there are bookings before other calculations
Nick Clemens [Fri, 15 Mar 2024 11:35:38 +0000 (11:35 +0000)]
Bug 35944: (QA follow-up) Check if there are bookings before other calculations

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35944: Add link to 'booked' biblio in checkouts table
Martin Renvoize [Mon, 26 Feb 2024 09:27:27 +0000 (09:27 +0000)]
Bug 35944: Add link to 'booked' biblio in checkouts table

This patch updates the checkouts table so handle 'booked' items
including linking to the biblio booking details page.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35944: Add message to SIP renewal attempt
Martin Renvoize [Mon, 26 Feb 2024 08:15:50 +0000 (08:15 +0000)]
Bug 35944: Add message to SIP renewal attempt

This patch adds a replacement for 'booked' to the SIP renewal handling
so we can display 'Item is booked for another borrower'.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35944: Add booking handling to CanBookBeRenewed
Martin Renvoize [Mon, 19 Feb 2024 12:31:07 +0000 (12:31 +0000)]
Bug 35944: Add booking handling to CanBookBeRenewed

This patch adds a bookings check to CanBookBeRenewed

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35944: Unit tests
Martin Renvoize [Tue, 20 Feb 2024 18:04:49 +0000 (18:04 +0000)]
Bug 35944: Unit tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36277: Avoid useless warnings
Tomas Cohen Arazi [Fri, 15 Mar 2024 12:05:55 +0000 (09:05 -0300)]
Bug 36277: Avoid useless warnings

As mentioned on bug 36329, this endpoint is only used with one of this
parameters:

* item_type
* collection_code

The other will be NULL both on the DB and the (deserialized) request
body. For the data from the DB, the author added `|| q{}` but missed to
do so on the incoming parameters when generates the hash key.

This generates the following warnings when using from the UI:

[2024/03/15 11:42:51] [WARN] Use of uninitialized value in sprintf at /kohadevbox/koha/Koha/REST/V1/TransferLimits.pm line 146.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36277: Improve algorithmic complexity of batch_add
Jonathan Druart [Thu, 14 Mar 2024 13:39:56 +0000 (14:39 +0100)]
Bug 36277: Improve algorithmic complexity of batch_add

The 2 nested loops are terrible in term of algorithmic complexity.
Especially if we are fetching from there.

The goal of this patch is to fetch all the limits outside of the loop.

If you have 100 libraries, it will remove 100^2 - 1 fetches!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36277: Do not fetch the whole library list
Jonathan Druart [Thu, 14 Mar 2024 13:06:28 +0000 (14:06 +0100)]
Bug 36277: Do not fetch the whole library list

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35934: Correct missed case of switching items.transfer to transfer in detail.tt
Emily Lamancusa [Mon, 29 Jan 2024 20:25:19 +0000 (15:25 -0500)]
Bug 35934: Correct missed case of switching items.transfer to transfer in detail.tt

To test:
1. Put an item with no holds/recalls in transit (manually or by checking
  it in at a branch other than its homebranch to trigger a ReturnToHome)
2. Go to the item's bib record
--> Note that the item's status will display as something like,
    "In transit from X to Y since 01/29/2024 Available"
3. Apply patch and refresh the page
--> Note that item now shows only the transit status, but not "Available"

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36224: Remove unused spsuggest from templates
Lucas Gass [Tue, 5 Mar 2024 16:00:39 +0000 (16:00 +0000)]
Bug 36224: Remove unused spsuggest from templates

To test:
-APPLY PATCH
-Review the OPAC results and staff interface results pages.
-Nothing should change, it would be impossible to end up inside of the [% IF koha_spsuggest %] condition because there is nothing like that in the scripts!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36292: Fixed 'See all charges' hyperlink for guarantees/guarantor linked charges
Laura Escamilla [Mon, 11 Mar 2024 14:43:26 +0000 (14:43 +0000)]
Bug 36292: Fixed 'See all charges' hyperlink for guarantees/guarantor linked charges

To test:
1. Add a guarantee / guarantor relationship for two patrons.
2. Add a manual fee to the guarantees' account.
3. Go to the guarantor's account and view the 'Details' tab. Under contact information there should be a Guarantees section. There you will see the charges for your guarantee. Click on ‘See all charges’. The link leads you no where.
4. Apply the patch and restart_all
5. Refresh the guarantor’s page and click on ‘See all charges’ again. This time it will take you down to the ‘Guarantees’ Charges’ panel.
6. Sign off and have a great day! :D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36298: In patrons search fix road type with authorized value
Fridolin Somers [Tue, 12 Mar 2024 10:18:18 +0000 (11:18 +0100)]
Bug 36298: In patrons search fix road type with authorized value

In new patrons search via API, the road type code is displayed in patron address instead of authorized value description.

Also road type is missing a space separator in DE and FR format.

Test plan :
1) Create two entries in authorized value category "ROADTYPE" :
   R1 "Road"
   R2 "Street"
2) Edit a patron (ie Delgado, Floyd) to set road type to "Road"
3) Perform a search on patrons (click on letter D)
4) Check you see in address "Road" and not "R1"
5) Edit authorized value category "ROADTYPE" to delete entry "R1"
6) Perform a search on patrons (click on letter D)
7) Check you see in address "R1"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35997: (QA follow-up) Number of tests
Marcel de Rooy [Fri, 15 Mar 2024 08:59:26 +0000 (08:59 +0000)]
Bug 35997: (QA follow-up) Number of tests

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35997: Cancelling a hold should remove the hold from the queue
Kyle M Hall [Mon, 5 Feb 2024 19:44:46 +0000 (14:44 -0500)]
Bug 35997: Cancelling a hold should remove the hold from the queue

Test plan:
1) Place a hold for a record for a patron
2) Build the holds queue
3) Note the holds queue contains a match for that patron and record
4) Cancel the holds queue
5) Reload the holds queue page, note the match for  that patron and
   record is gone!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35997: Add tests
Kyle M Hall [Mon, 5 Feb 2024 19:44:46 +0000 (14:44 -0500)]
Bug 35997: Add tests

Test plan: see next patch

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36332: Add missing semicolon in moremember.tt
Jonathan Druart [Fri, 15 Mar 2024 13:56:26 +0000 (14:56 +0100)]
Bug 36332: Add missing semicolon in moremember.tt

It's fixing a JS error
Uncaught ReferenceError: script is not defined

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35796: Properly set patron_expiration value
Lucas Gass [Fri, 8 Mar 2024 21:32:21 +0000 (21:32 +0000)]
Bug 35796: Properly set patron_expiration value

To test:
1) Set an expiration on the password in a patron account and save.
2) Go to patron details (moremember.pl) and confirm the password has an expiration.
3) Edit the patron account without touching anything and save the account.
4) Go back to patron details (moremember.pl) and note that the expiration on the password has been removed.
5) APPLY PATCH
6) Try 1 - 4 again except this time password expiration is not removed.

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36274: Correct links leading to purchase suggestion page
Lucas Gass [Thu, 7 Mar 2024 23:09:56 +0000 (23:09 +0000)]
Bug 36274: Correct links leading to purchase suggestion page

To test:
1. APPLY PATCH
2. As a logged in OPAC user go to 'Your account' > Purchase suggestion. The form should display.
3. Make a suggestion and confirm it works.
4. Try to make a suggestion using title, author, isbn information from an item that already exists.
5. See the "A similar document already exists:" warning. Confirm the suggestion anyways.
6. Set MaxTotalSuggestions to 4 and NumberOfSuggestionDays to 2. Make sure you can still navigate to the purchase suggestion form.
7. Do an OPAC search that will yield no results as a logged in user.
8. Click the "Make a purchase suggestion" link, making sure it works.
9. Turn on AnonSuggestions and log out of the OPAC.
10. Do an OPAC search that will yield no results. Again click the "Make a purchase suggestion", confirm it works.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36305: (QA follow-up) Enforce op values in script
Marcel de Rooy [Fri, 15 Mar 2024 08:15:03 +0000 (08:15 +0000)]
Bug 36305: (QA follow-up) Enforce op values in script

Replacing a FIXME by TODO along the way.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36305: Implement op paramters
Kyle M Hall [Wed, 13 Mar 2024 16:19:31 +0000 (12:19 -0400)]
Bug 36305: Implement op paramters

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36305: Tidy forms
Kyle M Hall [Wed, 13 Mar 2024 16:00:52 +0000 (12:00 -0400)]
Bug 36305: Tidy forms

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36190: Fix problems found by test
Nick Clemens [Wed, 13 Mar 2024 10:52:28 +0000 (10:52 +0000)]
Bug 36190: Fix problems found by test

opac-shelves           - forms were stateless - changed to GET
sco-main               - forms stateless - changed to GET
                         ** untested because sco + auth is broken
smart-rules.tt         - JS form template - added placeholder 'cud-' op
ill-requests           - added cud- tp ops
                         ** tested comments, but not checkout, simple changes
boraccount             - removed repeated op - updated script
patroncards/edit-batch - add placeholder 'cud-' op
patroncards/manage     - add placheholder 'cud-' op
elasticsearch/mappings - separate forms - this could use a style follow-up, but makes more sense separate I think
reports/dictionary      - stateless - changed to GET
guided_reports_start    - stateless - changed to GET
suggestion/suggestion   - add placeholder 'cud-' op
inventory               - filed bug 36305, needs more handling

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36190: (QA follow-up) Tidy
Nick Clemens [Wed, 13 Mar 2024 10:51:08 +0000 (10:51 +0000)]
Bug 36190: (QA follow-up) Tidy

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36190: To not assume op is invalid if it is a TT variable
Jonathan Druart [Wed, 28 Feb 2024 13:11:01 +0000 (14:11 +0100)]
Bug 36190: To not assume op is invalid if it is a TT variable

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36190: Adjust the test
Jonathan Druart [Wed, 28 Feb 2024 13:06:12 +0000 (14:06 +0100)]
Bug 36190: Adjust the test

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35473: Also disable the plugin
Martin Renvoize [Mon, 15 Jan 2024 15:33:40 +0000 (15:33 +0000)]
Bug 35473: Also disable the plugin

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35473: Handle room reservations plugin conflict
Martin Renvoize [Thu, 11 Jan 2024 10:24:04 +0000 (10:24 +0000)]
Bug 35473: Handle room reservations plugin conflict

We now look for the existance of the room reservations 'bookings' table
prior to attempting to install the core bookings table and migrate it in
the same way the upstream plugin does before proceeding with installing
the core bookings tables.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36308: Update sip login parameters
Nick Clemens [Wed, 13 Mar 2024 17:51:29 +0000 (17:51 +0000)]
Bug 36308: Update sip login parameters

To test:
perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m patron_information --patron=koha
Login fails
Apply patch, restart all
perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m patron_information --patron=koha
Login succeeds

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add tests for Koha::Booking->_assign_item_for_booking
Martin Renvoize [Thu, 8 Feb 2024 11:52:09 +0000 (11:52 +0000)]
Bug 35248: Add tests for Koha::Booking->_assign_item_for_booking

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Refactor - Move assign_item_for_booking
Martin Renvoize [Wed, 7 Feb 2024 17:10:40 +0000 (17:10 +0000)]
Bug 35248: Refactor - Move assign_item_for_booking

This routine really belongs inside Koha::Booking rather than
Koha::Biblio. This patch moves it there, renames with _ to highlight
it's private nature.

Test plan
1) Confirm that t/db_dependant/Koha/Booking.t still passes, specifically
   the 'store' test.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add tests for Koha::Booking->store
Martin Renvoize [Wed, 7 Feb 2024 17:58:11 +0000 (17:58 +0000)]
Bug 35248: Add tests for Koha::Booking->store

This patch adds tests for the Koha::Booking->store method.

Test plan
1) Run t/db_dependent/Koha/Booking.t and confirm they all pass

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add unit tests for Koha::Bibilio->bookable_items
Martin Renvoize [Wed, 7 Feb 2024 16:38:20 +0000 (16:38 +0000)]
Bug 35248: Add unit tests for Koha::Bibilio->bookable_items

This patch adds basic unit tests for Koha::Biblio->bookable_items

Test plan
1) Run t/db_dependent/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add unit tests for Koha::Bibilio->check_booking
Martin Renvoize [Tue, 30 Jan 2024 16:38:08 +0000 (16:38 +0000)]
Bug 35248: Add unit tests for Koha::Bibilio->check_booking

This patch adds basic unit tests for Koha::Biblio->check_booking

Test plan
1) Run t/db_dependent/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add Koha::Biblio->bookings unit test
Martin Renvoize [Tue, 30 Jan 2024 14:00:17 +0000 (14:00 +0000)]
Bug 35248: Add Koha::Biblio->bookings unit test

This patch adds unit tests for the bookings relationship accessor on
Koha::Biblio objects.

Test plan
1) Run t/db_dependant/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add unit tests for Koha::Booking relations
Martin Renvoize [Tue, 30 Jan 2024 13:53:02 +0000 (13:53 +0000)]
Bug 35248: Add unit tests for Koha::Booking relations

This patch adds unit tests for the relations introduced in the new
Koha::Booking class.

Test plan
1) Run t/db_dependent/Koha/Booking.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Remove Koha::Booking->intersects
Martin Renvoize [Tue, 30 Jan 2024 11:09:17 +0000 (11:09 +0000)]
Bug 35248: Remove Koha::Booking->intersects

Another method left behind from an earlier iteration.. not actually
called anywhere in the final submission in Koha.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add test for Koha::Exceptions::Booking
Martin Renvoize [Tue, 30 Jan 2024 07:45:13 +0000 (07:45 +0000)]
Bug 35248: Add test for Koha::Exceptions::Booking

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Drop ->place_booking
Martin Renvoize [Tue, 30 Jan 2024 07:34:56 +0000 (07:34 +0000)]
Bug 35248: Drop ->place_booking

These methods were introduced and used in an earlier iteration of the
code, they are no longer called from anywhere (the code in
Koha::Booking->store handles all cases instead) and thus I choose to
remove them rather than add unit tests for them.. They are simple
methods that could be re-introduced as required at a future date.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add unit tests for Koha::Item->check_booking
Martin Renvoize [Mon, 29 Jan 2024 18:34:46 +0000 (18:34 +0000)]
Bug 35248: Add unit tests for Koha::Item->check_booking

This patch adds basic unit tests for the Koha::Item->check_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Unit tests for CanBookBeIssued
Martin Renvoize [Mon, 29 Jan 2024 16:32:09 +0000 (16:32 +0000)]
Bug 35248: Unit tests for CanBookBeIssued

Whilst writing the test, I found a minor flaw in the logic and fixed
that in CanBookBeIssued at the same time.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add unit tests for Koha::Item->find_booking
Martin Renvoize [Tue, 16 Jan 2024 12:47:18 +0000 (12:47 +0000)]
Bug 35248: Add unit tests for Koha::Item->find_booking

This patch adds basic unit tests for the Koha::Item->find_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35248: Add unit test for Koha::Item->bookings relation
Martin Renvoize [Tue, 16 Jan 2024 11:31:41 +0000 (11:31 +0000)]
Bug 35248: Add unit test for Koha::Item->bookings relation

This patch adds a simple unit test for the 'bookings' relation accessor
added to Koha::Item.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35788: Simplify code
Tomas Cohen Arazi [Mon, 15 Jan 2024 13:43:44 +0000 (10:43 -0300)]
Bug 35788: Simplify code

We should not load DateUtils and deal with DateTime objects and
formatting when we can use the DB for it, using \'NOW()' should be
enough.

This patch makes that change. To test:

1. Apply the previous patches
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Bookings.t
=> SUCCESS: Tests pass!
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: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35788: Test for current day booking
Tomas Cohen Arazi [Mon, 15 Jan 2024 13:35:04 +0000 (10:35 -0300)]
Bug 35788: Test for current day booking

The implemented tests checked past and future dates for filtering
bookings. But `> NOW()` excludes the current date, and this case was not
covered. It is now.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35788: Remove Koha::Template::Plugin::Biblio::BookingsCount
Jonathan Druart [Fri, 12 Jan 2024 13:19:33 +0000 (14:19 +0100)]
Bug 35788: Remove Koha::Template::Plugin::Biblio::BookingsCount

We need a new method filter_by_future in Koha::Bookings.

Additionally this TT plugin's method was not covered by tests. Neither
is the whole Koha::Booking[s] objects btw.

Test plan:
Confirm that the number of bookings is displayed in the "Bookings" tab
in the left menu of the bibliographic record detail page.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35787: Add unit test for filter_by_bookable
Martin Renvoize [Tue, 16 Jan 2024 09:47:10 +0000 (09:47 +0000)]
Bug 35787: Add unit test for filter_by_bookable

Trivial test added for filter_by_bookable

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35787: Remove Koha::Template::Plugin::Biblio::CanBook
Jonathan Druart [Fri, 12 Jan 2024 13:02:29 +0000 (14:02 +0100)]
Bug 35787: Remove Koha::Template::Plugin::Biblio::CanBook

We can replace it with biblio.items.filter_by_bookable, no need to have this TT method.

Additionally there was no test for it.

Test plan:
Make sure the Bookings tab on the left of the biblio detail page is
displayed when needed.

Note that there is also a "Place booking" button that should appear in
the toolbar.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35782: DBRev 23.12.00.007
Katrin Fischer [Fri, 15 Mar 2024 07:36:44 +0000 (07:36 +0000)]
Bug 35782: DBRev 23.12.00.007

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35782: Fix scoping problem with "biblio"
Jonathan Druart [Fri, 12 Jan 2024 14:22:52 +0000 (15:22 +0100)]
Bug 35782: Fix scoping problem with "biblio"

The "biblio" Koha::Biblio object we send from the controller needs to be
accessible from the include files.
To avoid a clash we rename it biblio_info

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 35782: Replace TT plugin's method Biblio::HoldsCount
Jonathan Druart [Fri, 12 Jan 2024 07:44:12 +0000 (08:44 +0100)]
Bug 35782: Replace TT plugin's method Biblio::HoldsCount

We can use biblio.holds.count instead.

The main idea here is to make sure we are passing a Koha::Biblio object
as 'biblio' to all the templates including biblio-view-menu.inc

Test plan:
1. Go to the biblio detail view, click on the different entries in the menu
on the left. Confirm that the "Holds" tab always has the correct number
of Holds display in the parenthesis.

2. Run a search and confirm that the number of holds are still displayed
for each result.

QA:
git grep biblio-view-menu.inc
notice the tt list, open the corresponding perl controllers and confirm
that 'biblio' is passed and that it is a Koha::Biblio object.
The only missing place I found was in viewlog.
Note that we are not removing the TT method yet, we are marking it as
deprecated and also display a warning during the update DB process in
case one of the notice templates is using it.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36233: Set select2 width to 100%
Nick Clemens [Thu, 14 Mar 2024 10:58:48 +0000 (10:58 +0000)]
Bug 36233: Set select2 width to 100%

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36233: (follow-up) Fix width and enable clear option
Nick Clemens [Wed, 6 Mar 2024 19:24:30 +0000 (19:24 +0000)]
Bug 36233: (follow-up) Fix width and enable clear option

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36233: Use select2 to load vendors on invoice search
Nick Clemens [Tue, 5 Mar 2024 14:52:16 +0000 (14:52 +0000)]
Bug 36233: Use select2 to load vendors on invoice search

This patch moves the dropdown to use select2 and avoids loading all
vendors at page load.

To test:
 1 - Create some extra vendors in your system, ideally over 20
 2 - Search for a vendor in acquisitions
 3 - Click 'Invoices'
 4 - Note the dropdown of all vendors 'Vendor:' in search bar on left
 5 - The vendor you came from shoudl eb selected
 6 - Apply patch
 7 - Repeat
 8 - Note only a partial list of vendors is loaded, confirm current vendor still selected
 9 - Search in the dropdown and confirm vendors are returned
10 - Select a vendor and search
11 - confirm selection is retained

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33898: Implement reaping for database polling
Kyle M Hall [Fri, 8 Mar 2024 11:07:52 +0000 (06:07 -0500)]
Bug 33898: Implement reaping for database polling

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 33898: Alternative approach with receive frame timeout
Marcel de Rooy [Fri, 8 Mar 2024 07:37:19 +0000 (07:37 +0000)]
Bug 33898: Alternative approach with receive frame timeout

See bug 33898 comment6.

Test plan:
Based on comment12: Stage MARC import and manage. Look at the same
time to the results of ps aux|grep Z. Verify that the lines with
[background_jobs] <defunct> disappear within 10 seconds.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 32671: Prevent selenium/basic_workflow.t to fail if run on slow servers
Jonathan Druart [Mon, 11 Mar 2024 15:41:12 +0000 (16:41 +0100)]
Bug 32671: Prevent selenium/basic_workflow.t to fail if run on slow servers

When submitting the form to create a new patron we are doing a POST
memberentry.pl that is redirecting to moremember.pl

The selenium test is expecting for the end of the request to test the
page's title against "Patron details for ".

But it's only waiting for the POST response (302), not the GET
moremember that will display the patron's details.

You can simulate a slow server using cpulimit: `cpulimit -b -p $PID -l 1`
replacing $PID with the pid of the starman process.

Note that other tests are failing using 1%, but... baby steps.

The current failre:
 #   Failed test at t/db_dependent/selenium/basic_workflow.t line 122
 Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 125
 #                   'Add patron (test cat description) › Patrons › Koha'
 #     doesn't match '(?^u:Patron details for test_patron_surname)'

The next one (NOT fixed by this patch):

 #   Failed test at t/db_dependent/selenium/basic_workflow.t line 256.
 #                   '
 #
 #             Checkouts (0)#         #         '#     doesn't match '(?^u:Checkouts \(1\))'
 t/db_dependent/selenium/basic_workflow.t .. 14/22 #   Failed test at t/db_dependent/selenium/basic_workflow.t line 256.
 #                   '
 #
 #             Checkouts (1)
 #
 #         '
 #     doesn't match '(?^u:Checkouts \(2\))'
 t/db_dependent/selenium/basic_workflow.t .. 16/22 #   Failed test at t/db_dependent/selenium/basic_workflow.t line 256.
 #                   '
 #
 #             Checkouts (2)
 #
 #         '
 #     doesn't match '(?^u:Checkouts \(3\))'

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36215: (QA follow-up) Fix &? confusion
Katrin Fischer [Fri, 15 Mar 2024 06:57:58 +0000 (06:57 +0000)]
Bug 36215: (QA follow-up) Fix &? confusion

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36232: Fix error in DBRev dealing with OAI-PMH:AutoUpdateSetsEmbedItemData typo
Tomas Cohen Arazi [Mon, 11 Mar 2024 12:44:35 +0000 (09:44 -0300)]
Bug 36232: Fix error in DBRev dealing with OAI-PMH:AutoUpdateSetsEmbedItemData typo

This patch fixes the case of the wrong syspref variable co-existing with
the good one.

OAI-PMH:AutoUpdateSetsEmbedItemData is the only case, as the rest of the
mispelled ones are just case fixes, which would not trigger the same
situation as the `systempreferences` table collation is
case-insentitive.

To test:
1. Run:
   $ ktd --shell
  k$ koha-mysql kohadev
   > INSERT INTO systempreferences VALUES ('OAI-PMH:AutoUpdateSetEmbedItemData',0,'','','YesNo');
   > UPDATE systempreferences SET variable = 'IllCheckAvailability' WHERE variable = "ILLCheckAvailability";
   > INSERT INTO systempreferences VALUES ('IllCheckAvailability',0,'','','YesNo');
=> FAIL: The last command fails because the good and wrong values cannot
coexist
2. Set the version to a prior one:
   > UPDATE systempreferences SET value="23.1200004" WHERE variable like 'version';
3. Run:
  k$ updatedatabase
=> FAIL: You get this error:
ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry 'OAI-PMH:AutoUpdateSetsEmbedItemData' for key 'systempreferences.PRIMARY' at ...
4. Apply this patch
5. Repeat 3
=> SUCCESS: It works!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Mohd Hafiz Yusoff <mhby87@gmail.com>
Signed-off-by: Mohd Hafiz Yusoff <mhby87@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36130: Fetch all batches for the table
Pedro Amorim [Mon, 19 Feb 2024 13:12:25 +0000 (13:12 +0000)]
Bug 36130: Fetch all batches for the table

Test plan, ktd:
- Add 'FreeForm' backend and enable ILLModule, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
- Install a metadata enrichment plugin, e.g.:
https://github.com/PTFS-Europe/koha-plugin-api-pubmed/releases
- Add 21 batches, run the following command in kshell:
for x in {1..21}; do echo "INSERT INTO illbatches (name, backend, library_id, status_code, patron_id) VALUES ('$x', 'FreeForm', 'CPL', 'NEW', 52);"; done | koha-mysql kohadev
- Visit ILL batches page:
<INTRA_URL>/cgi-bin/koha/ill/ill-requests.pl?method=batch_list
- Notice only 20 batches show.
- Apply patch. Notice 20 batches show but now there is a page 2 link.
- Test page 2 works as expected, delete a batch, notice only 1 page with 20 batches shows again.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Edith Speller <edith.speller@ukhsa.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36251: (bug 35329 follow-up) Fix patron search by first letter when placing a...
Jonathan Druart [Thu, 7 Mar 2024 07:50:54 +0000 (08:50 +0100)]
Bug 36251: (bug 35329 follow-up) Fix patron search by first letter when placing a hold

Most of the patrons searches open in a modal. Except:
* the main one (members-home)
* when placing a hold
* when requesting an article
(did I miss one?)

The patron-search.inc BLOCKs need a parent block to know where to locate
the elements (form, table, etc), because we can have several patron
searches on the same page.

Bug 35329 reused '#searchresults':
  10 [% SET search_results_block_id = 'searchresults' %]
which is used on the main patron search.
The ones in the modal are correctly handled: we build the parent node in
the "patron_search_modal" block.
But for the 2 others the parent block id is wrong.

On reserve/request.tt we have one already, so we set the TT variable from the
.tt file
On circ/request-article we don't have one already, so we can reuse
searchresults (could be more specific however to include 'patrons'...)

Test plan:
Browse patrons by first letter when placing a hold and requesting an
article

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36215: Remove limit on fetching bookings
Nick Clemens [Wed, 6 Mar 2024 17:59:10 +0000 (17:59 +0000)]
Bug 36215: Remove limit on fetching bookings

This removes the paging from the bookings request so we take into
account all bookings.

We may want to replace this with date bounded paging in the future, but
lets not try to optimise until we need to.

To test:
 1 - Find a record detail page in Koha staff interface
 2 - Click on a barcode to go to items tab
 3 - Edit 'bookable' to 'yes'
 4 - Return to details page
 5 - Place 5 bookings on a record
 6 - Set system preference RESTDefaultPageSize  2
 7 - Click the 'Bookings' tab on the record details
 8 - Confirm onyl 2 bookings shown in calendar view
 9 - Apply patch, reload
10 - All bookings now show in calendar

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36235: Encode system preference data with encodeURIComponent
Lucas Gass [Tue, 5 Mar 2024 16:25:46 +0000 (16:25 +0000)]
Bug 36235: Encode system preference data with encodeURIComponent

To test:
1. Add some data to a freetext system preference like IntranetUserJS or AdditionalFieldsInZ3950ResultAuthSearch that includes a semicolon;
2. Save the pref and reload the page or check the DB. Everything after the semicolon is removed.
3. Apply patch, try again. Data should remain as is.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36177: Add Cypress tests
Jonathan Druart [Thu, 21 Sep 2023 14:49:22 +0000 (16:49 +0200)]
Bug 36177: Add Cypress tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36177: Cypress tests - cypress-mysql config
Jonathan Druart [Fri, 22 Sep 2023 09:16:21 +0000 (11:16 +0200)]
Bug 36177: Cypress tests - cypress-mysql config

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36177: Cypress tests - yarn add cypress-mysql
Jonathan Druart [Fri, 22 Sep 2023 09:09:18 +0000 (11:09 +0200)]
Bug 36177: Cypress tests - yarn add cypress-mysql

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36193: cud- treatment for tools/stockrotation.pl
Tomas Cohen Arazi [Wed, 6 Mar 2024 15:44:18 +0000 (12:44 -0300)]
Bug 36193: cud- treatment for tools/stockrotation.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36193: cud- treatment for catalogue/stockrotation.pl
Tomas Cohen Arazi [Wed, 6 Mar 2024 11:53:59 +0000 (08:53 -0300)]
Bug 36193: cud- treatment for catalogue/stockrotation.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36193: Make restore icon consistent in cash registers
Tomas Cohen Arazi [Wed, 6 Mar 2024 11:53:06 +0000 (08:53 -0300)]
Bug 36193: Make restore icon consistent in cash registers

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
3 months agoBug 36193: (follow-up) Use buttons and don't nest forms
Nick Clemens [Tue, 5 Mar 2024 16:21:31 +0000 (16:21 +0000)]
Bug 36193: (follow-up) Use buttons and don't nest forms

When changing action links into forms, we should use a submit button rather than JS to submit

Receipt cancelling needed a form embedded in the page as we cannot nest forms

Fixed searching on invoice.pl

Fixed resetting mappings (original button did not need cud-)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>