]> git.koha-community.org Git - koha.git/log
koha.git
7 months agoBug 36329: Add missing return codes
Tomas Cohen Arazi [Fri, 15 Mar 2024 12:18:32 +0000 (09:18 -0300)]
Bug 36329: Add missing return codes

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>
(cherry picked from commit 506087bc1541c94b46a4f8b405b8b1c131d526b9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36356: Fix rollback from FrameworkPlugin.t
Jonathan Druart [Tue, 19 Mar 2024 08:16:52 +0000 (09:16 +0100)]
Bug 36356: Fix rollback from FrameworkPlugin.t

rollback ineffective with AutoCommit enabled at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1651.

I have not investigated more than that. Reaching this was already the
end of a long road... (see comment 0)

Test plan:
0. Do not apply this patch
1. select count(*) from branches
Note the value
2. Run
  prove t/db_dependent/FrameworkPlugin.t
=> There is a warning
3. Repeat 1.
=> There are too many libraries!
4. Apply the patch, retry 1, 2, 3
=> No warning, no library added by the tests

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1d2165f84106cc27b804ac4c347817d25d1403aa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35921: Improve perfs of acqui-home.pl when there are many budgets
Julian Maurice [Thu, 25 Jan 2024 15:49:32 +0000 (16:49 +0100)]
Bug 35921: Improve perfs of acqui-home.pl when there are many budgets

When there are a lot of budgets with the same owner, most of the time of
acqui-home.pl is spent loading the same patron over and over.

This patch makes sure each borrower is loaded only once.

Test plan:
0. Do not apply the patch yet
1. Create a thousand budgets with the following command (make sure the
   budget_owner_id is an existing borrowernumber):
       perl -MKoha::Database -e '
           my $schema = Koha::Database->schema;
           my $period = $schema->resultset("Aqbudgetperiod")->create({
               budget_period_startdate => "2000-01-01",
               budget_period_enddate => "2999-12-31"
           });
           $schema->resultset("Aqbudget")->create({
               budget_owner_id => 1,
               budget_period_id => $period->id
           }) for (1..1000)
       '
2. Measure the time it takes to load acqui/acqui-home.pl (do it several
   times and keep the average time)
3. Apply the patch
4. Repeat step 2

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 24b33936a526187e17719294e236f186aec46d50)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 2d668f22dcde6c9aadc35aa17b886282dd184171)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 8a9bf27dc11ee12a882cace6443120e9f294d0b2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 7bce391462de5665722994a61d5138841bf8db65)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 52503c4f8752f2462beb8d70a532cccce482e56c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 06f9ca376b5acb39a84de0ab11ea78ab65e996bd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit c60a6d8cd994c7af5a5ce234525fae02a933ad0b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35532: Remove shortcut buttons from flatpickr
Martin Renvoize [Mon, 19 Feb 2024 10:31:19 +0000 (10:31 +0000)]
Bug 35532: Remove shortcut buttons from flatpickr

It doesn't make sense to have the shortcut buttons in the range picker
for bookings. This patch adds the ability to remove them entirely from
display and uses that option in the bookings modal.

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>
(cherry picked from commit fa745c3b1d13643e08cacd0cf3a0cb10d25fd8ec)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35532: Update date select field and add hint
Martin Renvoize [Mon, 19 Feb 2024 10:13:14 +0000 (10:13 +0000)]
Bug 35532: Update date select field and add hint

This patch updates the 'Period' select from 'Period' to 'Booking dates'
and adds a hint beneath it too.

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>
(cherry picked from commit 03b95cc32a9c41b93aefe15894a3b177da00c290)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35426: Improve layout of bookings modal form
Owen Leonard [Tue, 28 Nov 2023 18:46:11 +0000 (18:46 +0000)]
Bug 35426: Improve layout of bookings modal form

This patch changes the class on the bookings modal form's fieldset in
order to make the form work better in the small space offered by the
modal.

Also changed: The hint for the patron search field has been moved below
the field for consistency.

To test, apply the patch and search for a title in the staff interface.

- View the detail page.
- If you don't see a "Place booking" button in the toolbar,
  click "Items" in the sidebar menu.
  - Locate the "Priority" heading, and change the "Bookable" setting to
    "Yes."
- Click the "PLace booking" button in the toolbar.
  - The bookings modal form should appear, and the form layout should be
    improved.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 58cdd793579bc230c896d7849aac36f56466638b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 49068e15377b8610f18900db0b91f875ea946ff8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit d0981505ba799b78206e9945d3bd465e0a5c5ef7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 89fc242e97a83fc83748e4a5480c648ffe6dcb66)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit c6892074b82d81997f9ae91d18e7cf1edc78ad19)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 17460a41a165c187dbe1ca701490dd5d03acb990)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 4d8020258ff2ea0dae41325e7fab724831dc96aa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 5384aea5102c55c4891839d71c3902c7e22f3da4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit b351ab12de684b212d58d055b363621899465d70)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 8e370de1d9ea4ba9f1ba17f3ea8bbb28d5bc4479)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 6b8c52104c2d2930ed68b66578ebdda507065469)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 3496ebee89b9d3ee9d4c22fb772038038010bac1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit df39d76f305deec6cf7c938299cd1b05f8b32591)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit dab5694dad54616367d0ecba365a37711e86ad2f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 6fdc3fdba2efde5d5c1c07b775892a799420c316)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 3718d995d58d8f6a91b3f34a351885cb244b75d3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 3954808ac5052a53d5fa40502a4f7bd991be80ab)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 1b9371beb33dae4b661768609dca9930a91bfb56)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 03b0f31b9e63ce314c333ac6ffd68587a609e587)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 202628342ab9397e8b15aa5e62c0aaa041d3c8a0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 14388b6478858e298a9f0de104d5e839bc8cb430)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 687963b016bb9e3f74abebc64c830e53ab4d1e50)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit e07c6d072977b9e52dc2153fd36f03601e161c1a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit e2d54b1279b65507596ca3a08d6b44d1b15fe2b8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 3c0ac4cb9a4290c770aa8e4837b6d639b49c97e9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 304d8e17d643b758426584747477dbd6d856acf1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 4d2df6f9859ddc1f1d96008a6b3373380f0913d7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit eff15066b29e481728c023b4646d0e0947764662)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 23b05e812aa40ba452a951002d036b2d6c67441d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 60dcb2b0775ba4d47502e68af5d4aa3c127f0f81)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 293d9c66ce16742de770a1c4133ab60128f30b6d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit af47cc3056658182163c98585f364cec3bbba1b0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 638b5ef1b4a02b97c14b6166b1db7c4701fb741b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit c29390736f7c49d7276733ea96abfffb24ebcda7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 6b1b3718889f3674ac00eccbe3e0636a66f2c1a5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit e29e058851c1ffec5bcadab8bba357cd53142a2b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit bc42006019acf17e0c9b7284070e2f776dc77335)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 4e166e07c15a5726319e20bfef21dc543f0b58a4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit dee7ad88a0def133942b8b5a5121b0bf9899ac87)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit c73c27e02d37712648d6f253aac42c2bb40c1621)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 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>
(cherry picked from commit 1201a739676d37f805e886a6ac70c16b37eede14)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoRevert "Bug 34755: Backport Koha::Token change from bug 34478"
Fridolin Somers [Tue, 12 Mar 2024 13:14:27 +0000 (14:14 +0100)]
Revert "Bug 34755: Backport Koha::Token change from bug 34478"

This reverts commit 46c0419a11d56b078f1f8528e51bf1a78bd284e6.

7 months agoBug 34755: Backport Koha::Token change from bug 34478
David Cook [Mon, 4 Mar 2024 04:19:38 +0000 (04:19 +0000)]
Bug 34755: Backport Koha::Token change from bug 34478

This change includes the Koha::Token changes which uses
Koha::Session for generating and checking CSRF tokens.

0. Apply the patch and koha-plack --restart kohadev
1. Setup Keycloak OIDC SSO according to "Testing SSO"
wiki guide
2. In a regular window go to http://localhost:8080
3. In a private window go to http://localhost:8080 and click
the SSO "Log in with..." button, but don't log into Keycloak
4. In the regular window, login locally, and navigate to 5-6 pages
5. In the private window, log into Keycloak
6. Note that you are redirected back to Koha and logged in
successfully (no wrong_csrf_token error).

Signed-off-by: Olivier Hubert <olivier.hubert@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
7 months agoBug 35955: Add tests
Jonathan Druart [Tue, 27 Feb 2024 07:56:24 +0000 (08:56 +0100)]
Bug 35955: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0631153f06278d6acda3042a9243b5fb7bb9c5a4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35955: Cache CSRF token in template plugin
David Cook [Tue, 27 Feb 2024 06:05:24 +0000 (06:05 +0000)]
Bug 35955: Cache CSRF token in template plugin

This change uses the Koha::Cache::Memory::Lite cache to
cache the CSRF token, so that it is only generated once,
and is re-used by the Koha::Template::Plugin::Koha object
throughout the entire template processing for the HTTP request.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 108c955eac02707ccaa35081fbece1054a5dcda3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36066: (follow-up) Move 403 to 409 when status ne cancelled
Marcel de Rooy [Tue, 5 Mar 2024 14:54:02 +0000 (14:54 +0000)]
Bug 36066: (follow-up) Move 403 to 409 when status ne cancelled

Test plan:
Run t/db_dependent/api/v1/acquisitions_orders.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4032da3f964f438e913ed19d40b0b73aa4bd2533)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36066: Only allow cancelled order deletion in API
Marcel de Rooy [Mon, 12 Feb 2024 09:54:04 +0000 (09:54 +0000)]
Bug 36066: Only allow cancelled order deletion in API

Note: I had trouble with listing orders in API without
status, although formally not required according specs.

Test plan:
Run t/db_dependent/api/v1/acquisitions_orders.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dcbda39c0a77a35b2bc4684a286bf26254046877)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36066: Add tests
Marcel de Rooy [Mon, 12 Feb 2024 09:54:04 +0000 (09:54 +0000)]
Bug 36066: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] As Victor discovered, the test with status new in subtest
'delete' needed the authorised user now.

Test plan:
Run t/db_dependent/api/v1/acquisitions_orders.t
Without the follow-up patch this should FAIL.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8bb61c4f8835a7b36d32c580e12fe40381a5f22b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35983: Remove extra selected=selected from dropdown menu
Lucas Gass [Fri, 2 Feb 2024 00:04:33 +0000 (00:04 +0000)]
Bug 35983: Remove extra selected=selected from dropdown menu

To test:
1. Admin > Circ & fine rules
2. Select a library at the top of the forms ( #selectlibrary )
3. Try to change the 'Refund lost item replacement fee' to "Refund lost item charge (only if unpaid)".
4. Press save and let the page reload.
5. Look at the dropdown again, the value is now set to "Refund lost item charge and restore overdue fine".
6. APPLY PATCH
7. Try steps 2 - 5 again but this time the value in the dropdown should not change.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit af5453bbd28089acfb99d5877eac939b7a87f2ff)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35916: Purchase suggestions bibliographic filter should be a "contains" search
Shi Yao Wang [Fri, 23 Feb 2024 19:16:27 +0000 (14:16 -0500)]
Bug 35916: Purchase suggestions bibliographic filter should be a "contains" search

Make all bibliographic information fields filter do a contain match
rather than an exact match

Test plan:
1. Create a purchase suggestion with a multi-word title (e.g. one day in december)
   1.1. Go to Acquisitions > Suggestions > New purchase suggestion
   1.2. Enter a title (e.g. one day in december)
   1.3. Click on Submit your suggestion

2. Search for one of the words in the title
   2.1. In the "Filter by" section, click on Bibliographic information
   2.2. In the title field, enter one of the words of the title (e.g. december)
   2.3. Click Go
   --> No results

3. Apply the patch
4. Redo step 2 and notice there is now a valid result

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>
(cherry picked from commit 3d7ea3bd99a0b6c68d7bcd763559d43910c4c9e7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36103: Remove the "Cancel hold" link for item level holds
Kyle M Hall [Tue, 27 Feb 2024 13:40:53 +0000 (08:40 -0500)]
Bug 36103: Remove the "Cancel hold" link for item level holds

This link is broken and doesn't make sense from a UI/UX perspective
and thus should be removed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c91a43ca1f1cbc9b4174ac435428086fc3ed03db)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35950: Adjust tests
Lucas Gass [Thu, 29 Feb 2024 21:03:13 +0000 (21:03 +0000)]
Bug 35950: Adjust tests

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 85f316f9c8cb0fa930d1432a95b2dd07e8333b6c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35950: Move AddReturn call into circulation.pl
Lucas Gass [Thu, 29 Feb 2024 20:48:25 +0000 (20:48 +0000)]
Bug 35950: Move AddReturn call into circulation.pl

There should be no change in beahavior. Following the test plan from Bug 35840.

To test:
1. APPLY PATCH, restart_all
2. Turn on RecordLocalUseOnReturn
3. Create a Statistical patron.
4. Check an item out to a regular patron.
5. Check the item out to a Statistical patron.
6. This should trigger a return and you will see 2 entries in the statistics table, one for localuse and one for a return.
7. Try checking out an item to the Stats patron that is NOT checked out.
8. You should only see 1 entry, localuse, in the statistics table.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 834bff631784cc9788e66b7baad6067a5df7cffc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35840: (QA follow-up) Tidy and critic fix
Martin Renvoize [Fri, 8 Mar 2024 14:40:01 +0000 (14:40 +0000)]
Bug 35840: (QA follow-up) Tidy and critic fix

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e0554260c7d67b7f41238b8c2c67d6912f4c07e9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35840: Add unit tests
Lucas Gass [Mon, 29 Jan 2024 19:38:50 +0000 (19:38 +0000)]
Bug 35840: Add unit tests

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8b14aca56cdf6ed4c6b9be1d0c771859245ed80f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35840: Add option to AddReturn to skip recording of localuse
Lucas Gass [Mon, 29 Jan 2024 18:26:28 +0000 (18:26 +0000)]
Bug 35840: Add option to AddReturn to skip recording of localuse

To test:
1. APPLY PATCH, restart_all
2. Turn on RecordLocalUseOnReturn
3. Create a Statistical patron.
4. Check an item out to a regular patron.
5. Check the item out to a Statistical patron.
6. This should trigger a return and you will see 2 entries in the statistics table, one for localuse and one for a return.
7. Try checking out an item to the Stats patron that is NOT checked out.
8. You should only see 1 entry, localuse, in the statistics table.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ffc722554e8a1a0da4cd788625f77bafd1cb1f92)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35911: Make archived suggestions not show in patron's account
Shi Yao Wang [Fri, 23 Feb 2024 20:01:43 +0000 (15:01 -0500)]
Bug 35911: Make archived suggestions not show in patron's account

Remove archived suggestions in patron's account page

Test plan:
1. Go to a patron's account in the staff interface
2. Go to the Suggestions tab
3. Click New purchase suggestion and create a suggestion
4. In another browser tab, go to Acquisitions > Suggestions
5. Click the small arrow next to the edit button to the right of the suggestion, and choose Archive (alternatively, check the suggestion's box and click Archive selected)
   --> Suggestion disappears from the suggestions management page (OK)
6. Go back to the tab with the patron's account and refresh
   --> Suggestion is still visible
7. Apply the patch
8. Redo step 6 and notice the suggestion is not visible anymore
9. Redo step 4 and 5 but this time, unarchiving the suggestion
10. Redo step 6 and notice the suggestion is back

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>
(cherry picked from commit ac71adbd23e2d3a6c599ac963b042576dca635f3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35718: Remove ES6 warnings branches.tt
Lucas Gass [Thu, 29 Feb 2024 22:20:12 +0000 (22:20 +0000)]
Bug 35718: Remove ES6 warnings branches.tt

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6a0db6c1c4f200114764a97fbb29d596e6fc593c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35718: Remove ES6 warns from JS system preferences
Lucas Gass [Fri, 5 Jan 2024 19:05:01 +0000 (19:05 +0000)]
Bug 35718: Remove ES6 warns from JS system preferences

To test:
1. Add some JS like this to any of the UserJS system preferences:

$(document).ready( function() {
    let something = 1;
    const another_thing = 2;

    let an_arrow_function = (a, b) => a + b;
    console.log( an_arrow_function(something, another_thing) );
});

2. Notice the icons and warnings to the left of the line numbers:

let is available in ES6
const is available in ES6
arrow_function_syntax is available in ES6

3. APPLY PATCH
4. Try steps 1 and 2 again, the warnings should be gone.
5. Check that the JavaScript still works, in my example it should console.log 3.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5e3ae14aa0c204a8fa980d574a998f4194523586)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36004: Fixed typo in successfully
Laura Escamilla [Tue, 6 Feb 2024 16:13:32 +0000 (16:13 +0000)]
Bug 36004: Fixed typo in successfully

To test:

1. Turn on the syspref 'OpacCatalogConcerns'

2. Go to view a record in the OPAC and click on "Report a concern" in
   the column located on the right-hand side.

3. Fill out the title on the form and leave everything else the same.
   Click on submit and notice that the message on the screen says "Your
   concern was sucessfully submitted."

4. Apply the patch.

5. Submit a new concern. Notice that the text now has "successfully"
   spelled correctly.

6. Sign off and have a great day! :D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6bf839d89244e316d7ec936c439fa0d770f3665e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36005: Fixed typo in "Your concern was successfully submitted." text
Laura Escamilla [Tue, 6 Feb 2024 16:28:41 +0000 (16:28 +0000)]
Bug 36005: Fixed typo in "Your concern was successfully submitted." text

To test:

1. Turn on the syspref 'CatalogConcerns'

2. Go to view a record in the staff intranet and click on "New catalog concern" which is located in the "+New" dropdown.

3. Fill out the title on the form and leave everything else the same. Click on submit and notice that the message on the screen says "Your concern was sucessfully submitted."

4. Apply the patch.

5. Refresh the page and submit a new concern. Notice that the message now has "successfully" spelled correctly.

6. Sign off and have a wonderful day! :D

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0fcf48c55f858d19f1b78337b4b83f61831564fb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36070: Fix CSS class
Pedro Amorim [Mon, 12 Feb 2024 13:06:10 +0000 (13:06 +0000)]
Bug 36070: Fix CSS class

1) Enable UseRecalls
2) Checkout an item to a patron:
   Top INTRA search bar: pick 'check out' and paste a patron
   cardnumber:
   23529000035676
   press enter
3) Enter an item barcode:
   39999000003154
   Press checkout
4) As user koha/koha, visit OPAC page for this biblio:
   opac-url/cgi-bin/koha/opac-detail.pl?biblionumber=76
5) Notice all sidebar actions on the right have hover effect except for
   'Place recall'

Apply patch, repeat test plan.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0bdd12ea2296710dcaa5b724f1fd4c1cf09c0f06)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36032: Use a single angle in the "Next" button
Raphael Straub [Thu, 8 Feb 2024 09:00:13 +0000 (09:00 +0000)]
Bug 36032: Use a single angle in the "Next" button

The "Next" pagination button in the OPAC result list has a double angle
whereas the "Previous" button only has a single angle. This patch fixes
that error.

To test:
1) Do a search in the OPAC with more than one page of results.
2) Observe that the "Next" button has a double angle whereas the
   "Previous" button has only a single angle.
3) Apply the patch.
4) Repeat steps 1 and 2.
5) Verify that the "Next" button now has a single angle.

Sponsored-by: Karlsruhe Institute of Technology (KIT)
Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c1ce64593718143c94c3b666f4f468e55a7fe92)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35538: Sort OPAC self registration library list by library name
Owen Leonard [Mon, 18 Dec 2023 19:05:10 +0000 (19:05 +0000)]
Bug 35538: Sort OPAC self registration library list by library name

This patch modifies opac-memberentry.pl so that the list of libraries is
sorted by library name instead of library code.

To test, apply the patch and restart services.

- If using the default testing data you'll have to go to Administration
  -> Libraries and edit one or more libraries so that the library name
  is alphabetically different than the library code. e.g. Centerville ->
  Zanzibar.
- Go the OPAC and click "Create an account" (requires the
  PatronSelfRegistration system preference).
- Under "Home library," the dropdown of libraries should be ordered by
  library name.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5998fe93f5a7fe5fa2b55fc18b94e68e99f2a879)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35357: Enhance unit tests
Kyle M Hall [Tue, 6 Feb 2024 17:11:12 +0000 (12:11 -0500)]
Bug 35357: Enhance unit tests

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Fixed typo in test output.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 285a0fc74da5747922bcc28626066a7067e4fb66)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35357: Remove item from holds queue when it is checked out
Kyle M Hall [Thu, 11 Jan 2024 14:31:45 +0000 (09:31 -0500)]
Bug 35357: Remove item from holds queue when it is checked out

Test Plan:
1) Place a hold on an item
2) Build the holds queue
3) Check out the item to a different patron than the one
   targeted in the holds queue
4) Verify the holds queue viewer still shows that item and patron
5) Apply this patch
6) Repeat stepts 1 through 3
7) Verify the holds queue viewer no longer shows that patron and item!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0eced8086634e0a77786ce4ea2bfc6e36f969b85)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35357: Add unit test
Kyle M Hall [Thu, 11 Jan 2024 14:25:26 +0000 (09:25 -0500)]
Bug 35357: Add unit test

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0e11bc0de539692e1ed856a36e6faf4f30335eed)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36056: Clarify subpermissions AND behavior
Tomas Cohen Arazi [Thu, 8 Feb 2024 21:29:54 +0000 (21:29 +0000)]
Bug 36056: Clarify subpermissions AND behavior

Working on bug 31791, I found myself wondering if our current recursive
code in C4::Auth::haspermission() would allow checking AND on
subpermissions.

As it is not documented in the POD or tested, I decided to write some
unit tests for it.

It turned out it was well supported, so I decided to submit the tests,
and a small tweak in the POD to reflect that.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Auth/haspermission.t
=> SUCCESS: Tests pass! The code supports AND on subpermissions!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit aa1049fdd37d87b73c434dfdea11ba691e7095da)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35469: Add 'manage_bookings' permission to biblios/checkouts
Martin Renvoize [Tue, 19 Dec 2023 13:30:14 +0000 (13:30 +0000)]
Bug 35469: Add 'manage_bookings' permission to biblios/checkouts

This patch adds the manage_bookings subpermission check to the
biblios/{biblio_id}/checkouts endpoint and updates the corresponding
unit test too.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5e0afb772a4a2b100ee14c1da0c323fcc32d0fb2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35469: Add 'manage_bookings' subpermission to /checkouts
Martin Renvoize [Fri, 15 Dec 2023 11:37:43 +0000 (11:37 +0000)]
Bug 35469: Add 'manage_bookings' subpermission to /checkouts

This patch adds the 'manage_bookings' permission to allow fetching of
checkouts on the API should the user have 'manage_bookings' but not have
'circulate_remaining_permissions'

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 30b3a8c3820245c5b639818b0515f9c25c47b2c5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35773: Add manage_bookings subpermission to patron searching
Martin Renvoize [Thu, 11 Jan 2024 15:22:49 +0000 (15:22 +0000)]
Bug 35773: Add manage_bookings subpermission to patron searching

This quickly fixes the issue to allowing those who have the
manage_bookings subpermission to also search for users.

It's deliberately bare as I'm keen to subsequently remove it again in
bug 29509 where we will deal with this properly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 52fbb93cda407c406bc7da329446c9d02fe2a1e6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35924: (QA follow-up): Comment magic number (patron.privacy < 2)
Victor Grousset/tuxayo [Sun, 3 Mar 2024 00:07:30 +0000 (01:07 +0100)]
Bug 35924: (QA follow-up): Comment magic number (patron.privacy < 2)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0233c1d93fe0b490deffcad9e8b51f1bb57747bd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35924: Hide the print checkins button on the checkin screen for patron's who...
Kyle M Hall [Mon, 29 Jan 2024 11:54:56 +0000 (06:54 -0500)]
Bug 35924: Hide the print checkins button on the checkin screen for patron's who always anonymize

Test Plan:
1) Set a patron's privacy to "Never"
2) Check out a few items to a patron
3) Check in one item
4) Note the "Print checkin slip" diplays
3) Apply this patch
4) Check in an  item
5) Note the option is now missing
6) Set the patron's privacy to "Forever" or "Default"
7) Check in an item
8) Note the print checkins option is back!

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 19f38a286d52b4add421024e31ae232bc216a746)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35924: Hide the print checkins button on the patron screens for patron's who...
Kyle M Hall [Mon, 29 Jan 2024 11:51:14 +0000 (06:51 -0500)]
Bug 35924: Hide the print checkins button on the patron screens for patron's who always anonymize

If a patron anonymizes their checkins, the checkin slip cannot retrieve any info to print the checkin slip. We should not show the button in this scenario

Test Plan:
1) Set a patron's privacy to "Never"
2) Note the "Print checkin slip" option in the Print button on the
   patrons toolbar displays
3) Apply this patch
4) Reload the page
5) Note the option is now missing
6) Set the patron's privacy to "Forever" or "Default"
7) Reload the page
8) Note the print checkins option is back!

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7253c38b8a24fb066b90dbaa25db9f12f1287d32)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36134: Read complete Elasticsearch configuration in about.pl
Lari Taskula [Tue, 20 Feb 2024 01:47:53 +0000 (01:47 +0000)]
Bug 36134: Read complete Elasticsearch configuration in about.pl

When enabling Elasticsearch authentication in Koha using userinfo
parameter of Search::Elasticsearch, about.pl breaks and gives an
internal server error.

This patch reads the complete Elasticsearch configuration for
about.pl including userinfo causing about.pl to recover.

To test:
1. In Elasticsearch 7 settings, set "xpack.security.enabled: true"
2. Add <userinfo>elastic:password</userinfo> to KOHA_CONF elasticsearch
   settings
3. Restart plack and navigate to about.pl
4. Observe internal server error
5. Apply patch
6. Refresh about.pl
7. Observe it working again

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5511482951f812140f134b0ddfc5f3cab2807c77)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36212: Add check on barcode before searching items
Marcel de Rooy [Fri, 1 Mar 2024 09:39:35 +0000 (09:39 +0000)]
Bug 36212: Add check on barcode before searching items

Test plan:
Add an item to your database that has no barcode.
Run t/db_dependent/Circulation.t
It will fail without this patch, pass with this patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8413b376798097725cfd2ca3eb7a12427ad08163)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36010: Fix Items/AutomaticItemModificationByAge.t failing since Bug 32029
Fridolin Somers [Thu, 8 Feb 2024 11:23:30 +0000 (12:23 +0100)]
Bug 36010: Fix Items/AutomaticItemModificationByAge.t failing since Bug 32029

UT is failing in jenkins.
Change to use biblio.copyrightdate instead of bilio.medium

Run prove t/db_dependent/Items/AutomaticItemModificationByAge.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2e6a2c3b5b6d0464215189e29954d06e5f6e236b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 32029: Automatic item modifications by age add biblio table
Fridolin Somers [Fri, 28 Oct 2022 07:59:26 +0000 (21:59 -1000)]
Bug 32029: Automatic item modifications by age add biblio table

In automatic item modifications by age missing,
conditions can be on columns of tables items or biblioitems.
Table biblio is missing.

Test plan :
1) Create an automatic item modifications by age with a condition on a column of biblio table
2) Create a record and item matching the rule
3) Run misc/cronjobs/automatic_item_modification_by_age.pl -c -v
=> Check only matching items are impacted

Signed-off-by: Philip Orr <philip.orr@lmscloud.de>
Bug 32029: (follow-up) unit test

Signed-off-by: matthias le gac <matthias.le-gac@inlibro.com>
Bug 32029: (follow-up) tidy

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4e480d48f67c2eb942be4c8516533a327c7e2ba5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36170: Wrong error variable in memberentry
Jonathan Druart [Wed, 21 Feb 2024 12:46:29 +0000 (13:46 +0100)]
Bug 36170: Wrong error variable in memberentry

It is hidding an important error.

$@ is never set here, we need $_ (inside a try-catch)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cd9de702e2bb9aff991e92b04d2889c91a3dcd58)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34234: Respect display_order in additem.tt and detail.tt
Lucas Gass [Fri, 12 Jan 2024 17:35:24 +0000 (17:35 +0000)]
Bug 34234: Respect display_order in additem.tt and detail.tt

1. APPLY PATCH
2. EnableItemGroups
3. Find a record and add some new item groups with display orders that are different from the order in which the groups were added
4. Check the checkbox next to one or more items and click the link to "Add/move to item group"
5. Ensure display order is correct
6. Now add a new item to the record and scroll down to the dropdown underneath "+ Add to item group"
7. Display order should be correct.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bcfc786f17fad8b7c866ee6063d2953d7b5d925d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35892: Populate order price using GetMarcPrice if no price specified
Nick Clemens [Thu, 25 Jan 2024 19:03:00 +0000 (19:03 +0000)]
Bug 35892: Populate order price using GetMarcPrice if no price specified

Previously this happened after the fact, automagically, if no price was included in the order record. We should
rather load the Marc price into the order form if we don't have a price form the '...ToOrder' system preferences

To test:

Setup -- Set systempreferences below

MarcFieldsToOrder:
price: 949$g
quantity: 949$k
budget_code: 949$l
discount: 949$m
sort1: 949$n
sort2: 949$q

MarcItemFieldsToOrder:
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l

Stage the attached bib-303.marcxml file
Add to basket from the staged file
Note that item prices are populated as '6.50' from 949$g
Cancel
Update MarcFieldsToOrder and map price to "020$c"
Add to basket from the staged file
Note the price is not populated, because 020$c contains a dollar sign
Cancel
Apply patch, restart all
Add to basket from the staged file
Note the price is now correctly populated from fallback to GetMarcPrice

Note: GetMarcPrice does some automatic munging, that's why 020$c on it's own doesn't work - this could be done to fields in MarcFieldsToOrder/MarcItemFieldsToOrder but this would be an enhancement.
This bug simply restores the previous behavious, but does it on the front end and is more obvious to the user

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>
(cherry picked from commit c3035f7e1b469acaebfc6e388d60a9684f744ba5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 31427: Remove a few refs to CanBookBeRenewed
Marcel de Rooy [Fri, 1 Mar 2024 10:29:56 +0000 (10:29 +0000)]
Bug 31427: Remove a few refs to CanBookBeRenewed

Actually, the module is not even needed anymore here.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3b8a3c7b869fefbe6809ecbd00311d433d1d7904)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 31427: (follow-up) Unit tests
Martin Renvoize [Thu, 26 Oct 2023 08:08:04 +0000 (09:08 +0100)]
Bug 31427: (follow-up) Unit tests

This patch adds a unit test for error precidence where autorenewals is
involved.

It is not comprehensive however, and I'm a little confused by the logic
around cron vs non-cron handling...

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a71c21d2ffc9ea6863bf897270fdcdc923813286)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 31427: Get auto renewal errors before other renewal errors
David Cook [Thu, 20 Jul 2023 03:22:22 +0000 (03:22 +0000)]
Bug 31427: Get auto renewal errors before other renewal errors

This patch changes CanBookBeRenewed so that automatic renewal
errors pop up before other renewal errors. This means that a book
will be considered "auto_too_soon" before things like "too_many" or
"restricted". (Otherwise, you'll get an email saying you can't renew
a book the day after using your last auto renewal, even though the
earliest renewal isn't available until later.)

Test plan:
0. Apply patch
1. prove t/db_dependent/Circulation.t
2. prove t/db_dependent/Holds.t
3. prove t/db_dependent/Koha/Account/Line.t
4. prove t/db_dependent/Koha/Account.t

Additional tests:
5. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RestrictionBlockRenewing
6. Change to "block"
7. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=AutoRenewalNotices
8. Change to "according to patron messaging preferences"
9. Go to http://localhost:8081/cgi-bin/koha/admin/smart-rules.pl
10. Set "Automatic renewal" to "Yes" and "No renewal before" to 4
11. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
12. Checkout 39999000001310 with a due date 4 days in the future
13. Add a manual restriction
14. Run `perl ./misc/cronjobs/automatic_renewals.pl`
15. Note that it says something like the following:
Issue id: 1237 for borrower: 51 and item: 73 would not be renewed. (auto_too_soon)

Instead of something like the following:
Issue id: 1237 for borrower: 51 and item: 73 would not be renewed. (restriction)

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5d7a9395fbc58b49746e7674f33bdecf530eee1b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36100: (QA follow-up) Move 400 to 409
Marcel de Rooy [Fri, 1 Mar 2024 07:58:00 +0000 (07:58 +0000)]
Bug 36100: (QA follow-up) Move 400 to 409

Duplicate exceptions tend to generate a 409 in our REST API.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3e164d200acd683119225d4ebd01ad0334f563fb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36100: Update unit tests for add
Martin Renvoize [Thu, 15 Feb 2024 12:33:26 +0000 (12:33 +0000)]
Bug 36100: Update unit tests for add

This patch updates the unit tests for booking add to confirm that
without readOnly we still return an error should a user attempt to
submit a booking with a booking_id that would clash.

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>
(cherry picked from commit d810b3663bf855101d75673abc77d05bf65596dd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36100: Remove readOnly from bookings definition.
Martin Renvoize [Thu, 15 Feb 2024 10:15:12 +0000 (10:15 +0000)]
Bug 36100: Remove readOnly from bookings definition.

Whilst readOnly feels correct here, swagger doesn't work that way at our
version. It must be removed to restore the ability to edit exising
bookings.

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>
(cherry picked from commit e8a2f4df7368ad7e3de4c992e89f96e8ec242da1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 36047: Remove jQuery selector from conditional
Julian Maurice [Thu, 22 Feb 2024 15:42:27 +0000 (15:42 +0000)]
Bug 36047: Remove jQuery selector from conditional

This prevents the jQuery from breaking if the reason contains an
apostrophe character.

1. Create a suggestion
   1.1. Go to Acquisitions > Suggestions
   1.2. Click New purchase suggestion
   1.3. Enter a title
   1.4. Click Submit your suggestion

2. Update the suggestion to accepted and add a reason with an apostrophe
   2.1. In the suggestions list, check the box next to the suggestion
   2.2. At the bottom of the screen, choose Mark selected as: Accepted
   2.3. In With this reason, choose Others...
   2.4. Enter a reason with an apostrophe (my case was in French :
        Disponible en impression à la demande (POD). S'attendre à un
        long temps d'attente)
   2.5. Click Submit

3. Order the suggestion
   3.1. Go to Acquisitions
   3.2. Search for a vendor
   3.3. Click New > Basket
   3.4. Enter a basket name
        (Optional: for testing I like to change Create items when:
        cataloging the record)
   3.5. Click Save
   3.6. Click Add to basket
   3.7. Click From a suggestion
   3.8. Click Order next to the suggestion
   3.9. Enter order details
   3.10. Click Save
   3.11. Click Close basket
   3.12. Click Yes, close

4. Receive the order
   4.1. Click Receive shipments
   4.2. Enter a Vendor invoice number
   4.3. Click Next
   4.4. Click Receive next to the order
        --> Page stays In processing forever

Apply patch. Repeat. Notice the page now renders correctly.
Extra: Add an entry containg an apostrophe to the SUGGEST authorized
values category and repeat test plan. Confirm everything works as
expected.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4515581effb9ff17e5a74c5b624805d330082c27)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35913: Restore price fall back to MarcFieldsToOrder if not set by MarcItemFieldsT...
Nick Clemens [Thu, 25 Jan 2024 19:56:31 +0000 (19:56 +0000)]
Bug 35913: Restore price fall back to MarcFieldsToOrder if not set by MarcItemFieldsToOrder

To test:
Setup -- Set systempreferences below

MarcFieldsToOrder:
price: 949$g
quantity: 949$k
budget_code: 949$l
discount: 949$m
sort1: 949$n
sort2: 949$q

MarcItemFieldsToOrder:
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
price: 949$g
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l

Stage the attached bib-303.marcxml file
Add to basket from the staged file
Select the biblio
Note items have prices
Cancel
Remove 'price' mapping from MarcItemFieldsToOrder
Apply patch
Add to basket from file again
Note item prices, and other fields, come through as expected

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 649e1de1903f241d0fa0cf2ac6d15957a4c3ae46)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>