koha.git
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 months agoBug 35819: (QA follow-up) Prevent warning on uninitialized retries count
Marcel de Rooy [Mon, 5 Feb 2024 11:13:15 +0000 (11:13 +0000)]
Bug 35819: (QA follow-up) Prevent warning on uninitialized retries count

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 c86e6ee82d27640c5c66c534d1e93ddbbbc2c4fa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35819: Adjust es_indexer_daemon
Jonathan Druart [Tue, 30 Jan 2024 08:30:38 +0000 (09:30 +0100)]
Bug 35819: Adjust es_indexer_daemon

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Add forgotten module
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c1d4716beba5aa0d2c77ad460b4e6982cfee236)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35819: Improve logging
Jonathan Druart [Fri, 26 Jan 2024 13:25:56 +0000 (14:25 +0100)]
Bug 35819: Improve logging

Log (warn) if the job will be processed later, but add a debug however.

Have a specific log for bad status

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 30e69ebc5644f8b3d0a79c5c36aeb5038b632a30)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35819: nack and not requeue if frame is invalid
Jonathan Druart [Tue, 23 Jan 2024 09:14:21 +0000 (10:14 +0100)]
Bug 35819: nack and not requeue if frame is invalid

If a frame cannot be correctly processed (most probably because the body
is not valid JSON) then we are not acking or nacking the frame and the
worker is stuck.

In this specific case we should nack without requeuing the frame.

NOTE that requeue must be 'true' or 'false', not 1 or 0, or the default
'true' will be used.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 83940925685af338be659ef7baa04a40bed9d97d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35819: Add simple delay
Marcel de Rooy [Fri, 19 Jan 2024 07:10:02 +0000 (07:10 +0000)]
Bug 35819: Add simple delay

Here I add 500 ms. In my testing with the 1s sleep from the test
plan, I might see one or two 'not found' lines. Obviously things
depend on the time needed before the txn commits. But it will
reduce a flood of these messages.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 0feb10df7f9473c8ccd14bea947c0957a839e059)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35819: Notify NACK and requeue when Job ID not found
Tomas Cohen Arazi [Tue, 16 Jan 2024 17:46:20 +0000 (14:46 -0300)]
Bug 35819: Notify NACK and requeue when Job ID not found

This patch makes the worker reject the incoming frame for putting the
message back in the queue, in the event the job id doesn't exist yet.
Which is the case when some actions are being triggered inside a
transaction which hasn't been commited to the DB yet.

To test you will need 3 KTD shells
(a) mysql:
   $ ktd --shell
  k$ sudo koha-mysql kohadev

(b) logs:
   $ ktd --shell
   # for restarting the worker and looking at the logs
  k$ sudo koha-worker --restart kohadev  ; tail -f /var/log/koha/kohadev/worker-*.log
(c) running the test:
   $ ktd --shell

1. Have (a), (b) and (c) terminals ready
2. On (c), run:
   $ perl -MKoha::Database -MKoha::BackgroundJob::BatchUpdateBiblioHoldsQueue -e 'Koha::Database->schema->txn_do( sub { Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue({ biblio_ids => [ 1 ] }); sleep 1;  } );'
=> FAIL:
   * (b) shows (once) an error about a job not existing
3. On (a) run:
   > SELECT * FROM background_jobs;
=> FAIL: Notice the job ID mentioned on 2 stands as 'new'.
4. Apply this patch
5. Ctrl+c on (b), and re-run to launch the worker with the patch applied
6. Repeat 2
=> SUCCESS (partial): The error about the job not existing is displayed
many times
7. Repeat 3
=> SUCCESS: The job ID mentioned on 6 stands as 'finished'.
8. Sign off :-D

Discussion:

* The `requeue` header I added is correct, but it is the default
  behavior anyway. I prefered to make it explicit, though.

* To avoid that bunch of retries, we should requeue with some delay. I
  didn't manage to make it work (yet) but there's a 'delay' plugin for
  rabbit [1]. We already install the 'stomp' plugin in
  koha-common.postinst. But this plugin requires downloading it. Which
  would require further investigation.

* As Nick and Marcel pointed, we need to revisit the whole architecture,
  the need of a MQ (DB polling wouldn't have this problem), etc. But
  that's for another place.

[1] https://hevodata.com/learn/rabbitmq-delayed-message/#:~:text=To%20delay%20a%20message%2C%20the,to%20queues%20or%20other%20exchanges.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 1a51c2e973a1b6ce1116bbc243853112be96f0ea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36175: Corrections to reduced due for booked items
Martin Renvoize [Thu, 29 Feb 2024 11:28:24 +0000 (11:28 +0000)]
Bug 36175: Corrections to reduced due for booked items

This patch fixes a mistake in the circulation controller such that the
proper reduceddue date is passed to the template when a checkout would
overlap with a booking.

I also take the oportunity to enhance the functionality to allow
librarians to set their own reduceddue date between now and the hard
reduceddue as required for the existing booking.

Test plan
1) Set an item to 'bookable'
2) Add a booking to that item for user A for a few days time.
3) Attempt to checkout the item to user B and note the warning that
   the item is booked for another user.
4) With the patch applied, a reduced due date of 1 day prior to the
   booking should be defaulted to in the displayed date picker.
5) You should be able to select any date between today and the day
   before the booking starts
6) Confirm you can checkout with the reduceddue date set.
7) Bonus point, confirm the field is required, so if you try to wipe it
   and then checkout, you will be blocked.

Signed-off-by: Kelly <kelly@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 6e56e4a0d1b74df33b64cc70bd38c0405597e108)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36140: Correct label for attribute invoice.tt
Lucas Gass [Tue, 20 Feb 2024 23:19:01 +0000 (23:19 +0000)]
Bug 36140: Correct label for attribute invoice.tt

To test:
1. Go to /cgi-bin/koha/acqui/invoice.pl?invoiceid=X  where X is the invoice number.
2. Look at the Invoice number with your dev tools, the for attribute is wrong. ( shippingdate )
3. Apply patch and look again, the attribute should correctly be invoicenumber.

Alternatively, just look at the diff of this trivial change. :)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 214fc675cf8f3d7962aa02c03ee9cfc6f18e7973)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36076: paycollect.tt add permission checks for manual credit and invoice
Fridolin Somers [Tue, 13 Feb 2024 09:49:17 +0000 (10:49 +0100)]
Bug 36076: paycollect.tt add permission checks for manual credit and invoice

In members/pay.tt one can see permission checks for manual credit and invoice :
CAN_user_updatecharges_manual_invoice
CAN_user_updatecharges_manual_credit

This is missing from members/paycollect.tt.
HTML is also missing classes manualcredit and manualinvoice.

Test plan :
1) Create a user with permissions to manage accounting
   (remaining_permissions under updatecharges) but without
   manual_invoice and manual_credit
2) Go to a patron account with an invoice
3) Click on "Make a payment", you dont see tabs manual credit/invoice
4) Click on "Pay" in "Actions" column
=> Without patch you see tabs manual credit/invoice
=> With patch you do not see them

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 52e7c8acf450e1b010c384619eca77a0f8846bfa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35963: (QA follow-up): tidy up code and fix exec permission
Victor Grousset/tuxayo [Wed, 28 Feb 2024 04:52:41 +0000 (05:52 +0100)]
Bug 35963: (QA follow-up): tidy up code and fix exec permission

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9b8cbf5c83a8f76f3b5eba5065aa5cb7aa26e1d2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35963: Fix bundled items table ordering and filtering
Julian Maurice [Wed, 7 Feb 2024 13:36:01 +0000 (14:36 +0100)]
Bug 35963: Fix bundled items table ordering and filtering

Using the many-to-many relationship results in the table alias `me` to
be used for table `item_bundles` instead of the expected table `items`.
This causes ordering and filtering to fail for columns Callnumber and
Barcode.
Using Koha::Items->search does not have this problem.

This patch also disables ordering by status because it does not work
(error message is: "Cannot find Koha::Object class for return_claim'")

Test plan:
1. Create an item bundle
   https://koha-community.org/manual/23.11/en/html/circulation.html#circulating-bundles
2. Add at least 2 items to this bundle
3. Verify that ordering/filtering by callnumber or barcode works
4. Run `prove t/db_dependent/api/v1/items/bundled_items.t`

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 2753eec1ce8ce57afc10162936967d1f39c2b0b8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35963: Add tests
Julian Maurice [Wed, 7 Feb 2024 13:36:01 +0000 (14:36 +0100)]
Bug 35963: Add tests

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 9344f4317083e9d70c3ff9e923447e80282ef01c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35952: Remove unnecessary line for OpacSuppressionMessage
Lucas Gass [Tue, 30 Jan 2024 20:38:15 +0000 (20:38 +0000)]
Bug 35952: Remove unnecessary line for OpacSuppressionMessage

To test:
1. Apply patch and restart all
2. Add an additional contetn entry for `OpacSuppressionMessage`, make
   sure it has a publication date in the past.
3. Make sure  OpacSuppression is set to 'hide'.
4. Suppress a record in the OPAC, ( 942$n )
5. Visit the detail page for that record and make sure you
   OpacSuppressionMessage customization displays.

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 c9f6a4981a69095029cf53a14fc799ed8581b196)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35554: Authority search popup width 800px
Fridolin Somers [Tue, 12 Dec 2023 19:57:36 +0000 (09:57 -1000)]
Bug 35554: Authority search popup width 800px

Authority search popup is only 700 pixels width.
Most popups use 800 pixels, like the z3950 one.

Test plan :
1) Edit a biblio record
2) Click on value builder in a field linked to authority (ie 700)
3) Check popup is 800 pixels wide
4) Same with advanced editor

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 112a76650cd8d84e41364fbdbc7610ac9badd511)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36009: Document background_jobs_worker.pl --queue elastic_index
Julian Maurice [Fri, 23 Feb 2024 09:59:45 +0000 (10:59 +0100)]
Bug 36009: Document background_jobs_worker.pl --queue elastic_index

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 972efe8b5c8d22796437af87bfdf880d2fd659bf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36009: Document koha-worker --queue elastic_index
Magnus Enger [Wed, 7 Feb 2024 07:51:36 +0000 (07:51 +0000)]
Bug 36009: Document koha-worker --queue elastic_index

To test:
- Copy the koha-worker script to the standard location:
  $ sudo cp debian/scripts/koha-worker /usr/sbin/koha-worker
- Check "sudo koha-worker --help" and verify elastic_index is
  mentioned in the list of "current queues"
- See https://wiki.koha-community.org/wiki/Testing_man_pages for
  how to check the "man" page. There should be a new paragraph
  about "Current queues" under "--queue"

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 3eff8d02b7ec4435a46972710786630518814cb0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36150: Update circulation-home.tt layout
Pedro Amorim [Thu, 22 Feb 2024 12:10:31 +0000 (12:10 +0000)]
Bug 36150: Update circulation-home.tt layout

Test plan:
Compare both pages:
<staff_url>/cgi-bin/koha/cataloguing/cataloging-home.pl
<staff_url>/cgi-bin/koha/circ/circulation-home.pl

Apply patch
Compare both pages again

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b7f9a86677323d72adabeacc3f123fc8ee4c7d7e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35398: (QA follow-up) Tidy code
Kyle M Hall [Tue, 2 Jan 2024 13:58:04 +0000 (08:58 -0500)]
Bug 35398: (QA follow-up) Tidy code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ab7a8db43dbb240f111e3ea7eef5b9e0a1a62652)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35398: Fix LRP support for EDI orders with single items
Martin Renvoize [Fri, 24 Nov 2023 13:06:37 +0000 (13:06 +0000)]
Bug 35398: Fix LRP support for EDI orders with single items

This patch corrects a mistake in the original implementaiton of bug
20595 where we introduced support for the LRP segments being used to
automatically assign items ordered via EDI to stock rotation plans.

Signed-off-by: Sophie Halden <sophie.halden@cheshiresharedservices.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 783a58a9d3f26622450c7785182b175c71f50d5e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35398: Unit test
Martin Renvoize [Wed, 28 Feb 2024 16:40:39 +0000 (16:40 +0000)]
Bug 35398: Unit test

This patch adds the begginings of unit tests for Koha::EDI.  Right now
we only test that a simple QUOTE message creates a basket, adds the item
to said basket and assigns that single item to a corresponding stock
rotation rota as defined by the LRP segment in the QUOTE message.

It lays the foundations for much more rigorous tests to be written to
cover the whole of EDI.pm however.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit de79e957ce82d53d9978551f1d7ef593884daa29)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35398: Add unit test for extraction of library_rotation_plan
Martin Renvoize [Tue, 27 Feb 2024 13:45:53 +0000 (13:45 +0000)]
Bug 35398: Add unit test for extraction of library_rotation_plan

This unit test addition adds an LRP segment to the test EDI message file
and adds the corresponding test to confirm is it extracted into the
field as expected.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6744b9979a5b7029f9d35d19e680f8a03fcd8a75)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35351: Adjust basket details template to avoid showing empty page-section
Owen Leonard [Thu, 16 Nov 2023 14:12:17 +0000 (14:12 +0000)]
Bug 35351: Adjust basket details template to avoid showing empty page-section

This patch makes a minor change to the markup of the basket details page
so that we don't display an empty div.page-section when there are no
orders.

Note: This patch includes whitespace changes, so please ignore
whitespace when viewing the diff.

To test, apply the patch and go to Acquisitions.

- Search for a vendor and add a basket if necessary.
- View the details of an empty basket.
- Under the "General information" or "Settings" sections there should be
  no empty white box.
- View the details of a basket which has orders (using the "Add to
  basket" process if necessary).
  - Orders should be displayed correctly.

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 dde374e2ad1fa69deaebf21c2a569ecdb4c12594)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35422: Fix translation of suggestions title tag
Owen Leonard [Tue, 28 Nov 2023 15:54:38 +0000 (15:54 +0000)]
Bug 35422: Fix translation of suggestions title tag

This patch corrects a missed instance of a string in the title tag which
should have been wrapped in the translation function [% t() %]

To test, apply the patch and go to Suggestions.

- Click "New purchase suggestion"
- The title of the page should be correct: "Add suggestion"
- Confirm that translation is improved:
  - Update and reinstall active translations (for instance fr-FR):
    perl misc/translator/translate update fr-FR
  - Check the corresponding po file, in this case fr-FR-messages.po
  - There should be an entry for the string "Add suggestion"

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 d485ff32b0949f1e39bb5325a4dbb49db89ec582)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35397: Fix SIP2AddOpacMessagesToScreenMessage system preference description
Tomas Cohen Arazi [Fri, 24 Nov 2023 13:06:35 +0000 (10:06 -0300)]
Bug 35397: Fix SIP2AddOpacMessagesToScreenMessage system preference description

The original syspref description contained an extra  '- Use' and reads
weird.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 58013fd61dff23c570ab39672e797f2695bd7193)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36000: Fix CGI::param warning in catalogue search
Marcel de Rooy [Tue, 6 Feb 2024 12:31:28 +0000 (12:31 +0000)]
Bug 36000: Fix CGI::param warning in catalogue search

Speaks for itself.

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 3cf72dee6b52bbfadbb46b40d6d8fec5f3e2bf48)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36088: Remove useless code form opac-account-pay.pl
Kyle M Hall [Tue, 13 Feb 2024 20:04:53 +0000 (15:04 -0500)]
Bug 36088: Remove useless code form opac-account-pay.pl

The script opac-account-pay.pl sums the selected accountlines, formats the amount, pulls the currently active currency, and does nothing with any of this data.

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Note there is no change in behavior

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
PA amended title (missing 'Bug ####:'

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dd7ac62d3f184b7c76296389a16192a45fdadae0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36091: Spelling: Use "card number" instead of cardnumber in text
Owen Leonard [Wed, 14 Feb 2024 14:11:22 +0000 (14:11 +0000)]
Bug 36091: Spelling: Use "card number" instead of cardnumber in text

This patch replaces the term "cardnumber" with "card number" in labels
and text where the patron's library card number is referred to. Where
the database column is referenced "cardnumber" is kept.

A full test plan would be very time-consuming and I think examining the
patch should be verification enough for changes which are limited to
adding a space.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Verified that the patch only changes "visible" text, and not
references to the database column.
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f3feebbfe91764b684ee215b93e81e17fde74c94)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36099: count and holdcount template vars into JS vars should default to 0 if...
Pedro Amorim [Mon, 26 Feb 2024 10:03:22 +0000 (10:03 +0000)]
Bug 36099: count and holdcount template vars into JS vars should default to 0 if empty

Visit:
http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=4321
Notice you have 2 console errors:
1) Uncaught SyntaxError: Unexpected token ';'
2) Uncaught ReferenceError: biblionumber is not defined

Apply patch. Repeat. Notice no error shows.
Visit an existing biblionumber. Confirm all is well.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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 f94d763b6a5d671c4860db76263f72d0643b7555)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36157: Remove class from anchor link
Pedro Amorim [Fri, 23 Feb 2024 16:23:38 +0000 (16:23 +0000)]
Bug 36157: Remove class from anchor link

Test plan:
- Create a notice with the module of "Reports" -- add something to the "Print" section. Example from bug 34136:
[% FOREACH b IN data %]
<div class="panel panel-default">
  <div class="panel-heading">[% b.surname %], [% b.firstname %]</div>
  <div class="panel-body">Expiration: [% b.dateexpiry %]</div>
  <div class="panel-footer">ID: [% b.borrowernumber %]</div>
</div>
[% END %]

- Create and run a saved report. Example from the other bug:
SELECT * FROM borrowers

- Click on the "Run with template" dropdown and hover the template title.

- Notice it the styling of the hover. Apply patch. Repeat.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e17959b34ddff470b63c8d2fd6e8239ac812ba32)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36158: Update t iterator variable
Pedro Amorim [Fri, 23 Feb 2024 16:15:08 +0000 (15:15 -0100)]
Bug 36158: Update t iterator variable

It seems like its causing some sort of conflict with t('Hide SQL code') further down below in the code, but I'm not sure why.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ed4fb21e2cadd6f8ae0bb5f3b8c2cfc5003431f3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36156: None value selected on clone field/subfield linked to AV
Thibaud Guillot [Fri, 23 Feb 2024 12:12:42 +0000 (13:12 +0100)]
Bug 36156: None value selected on clone field/subfield linked to AV

When a field or subfield is linked to a list of authorized values and cloned, the selected value is repeated in the clone. This is linked to the default behavior of Select2Utils, so I've added a precise index (-1) to ensure that no value is selected in the clone.

Test plan:

1) Create a repeatable field and subfield and link a list of authorised values to the subfield.
2) Edit a record, clone the field and see which value is automatically selected in the clone.
3) Apply the patch
4) Repeat step 2

Sponsored by : BibLibre

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ed037fb2740418816b192abe06a250193ad05e40)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36098: Default to 'file' if pref does not exist
Jonathan Druart [Wed, 21 Feb 2024 08:42:16 +0000 (09:42 +0100)]
Bug 36098: Default to 'file' if pref does not exist

During the installer process there is a bunch of warnings
  "Use of uninitialized value $storage_method in string eq at"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e2440f2c617c48d77cc416857937b6fb18c34208)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36098: (follow-up) extend test to check driver
David Cook [Thu, 15 Feb 2024 23:07:02 +0000 (23:07 +0000)]
Bug 36098: (follow-up) extend test to check driver

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c42ede262a24503c1f350a8d2639a391b86278bf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36098: Fix storage_method pass
David Cook [Thu, 15 Feb 2024 22:49:19 +0000 (22:49 +0000)]
Bug 36098: Fix storage_method pass

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5572567143c10b424765149bd97c2aa99d577132)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36098: Allow to pass storage_method
Jonathan Druart [Thu, 15 Feb 2024 13:05:21 +0000 (14:05 +0100)]
Bug 36098: Allow to pass storage_method

Will need this on follow-up bugs.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 56d8ac247698f8755a8215245dffd000877d76e7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36098: (QA follow-up) Add POD to Koha::Session
Martin Renvoize [Thu, 15 Feb 2024 11:53:02 +0000 (11:53 +0000)]
Bug 36098: (QA follow-up) Add POD to Koha::Session

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 09de3f820b5333e3f23f149f6b8c101d24ba15ed)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36098: Add Koha::Session module to ease session handling
David Cook [Thu, 15 Feb 2024 02:49:18 +0000 (02:49 +0000)]
Bug 36098: Add Koha::Session module to ease session handling

This patch adds a Koha::Session module that makes it easier
to work with Koha sessions without needing the full C4::Auth module.

Test plan:
0. Apply the patch
1. Run the following unit tests:
prove ./t/db_dependent/Auth.t
prove ./t/db_dependent/Auth_with_cas.t
prove ./t/db_dependent/Koha/Session.t
2. Observe that they all pass

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0e6537d199fe49a9e91e1c75f9462ddf1c878fed)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35935: Ensure login branch will be used after incorrect login
Jonathan Druart [Tue, 30 Jan 2024 08:02:19 +0000 (09:02 +0100)]
Bug 35935: Ensure login branch will be used after incorrect login

If a different branch is selected after an incorrect login, the previous
branch will be used.

To recreate:
* login with foo/bar, select CPL => FAIL
* login with koha/koha, select another branch => OK but CPL is picked!

It was caused by a dup of "branch" in CGI param list (and first was
picked).

This patch patch also removes "koha_login_context" to not have it twice.
You can also open the source of the page to confirm that form#loginform
contains "branch" and "koha_login_context" in hidden inputs.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Tested in KTD. Works as advertised.
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7c54394383234f33dcf5b6acb8ceabb72d0deca4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35949: Remove useless code pointing to branchreserves.pl in request.tt
Jonathan Druart [Tue, 30 Jan 2024 15:40:17 +0000 (16:40 +0100)]
Bug 35949: Remove useless code pointing to branchreserves.pl in request.tt

messagetransfert is never set (it is from circ/waitingreserves.pl, `git grep messagetransfert`) and branchreserves.pl does not exist!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4b6508e7ea24dd188090ebc1e6e3dba820ece645)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36176: Reject cud- for stable branches
Jonathan Druart [Wed, 28 Feb 2024 15:28:33 +0000 (16:28 +0100)]
Bug 36176: Reject cud- for stable branches

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
2 months agoUpdate release notes for 23.11.03 release v23.11.03
Fridolin Somers [Thu, 29 Feb 2024 10:26:32 +0000 (11:26 +0100)]
Update release notes for 23.11.03 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoIncrement version for 23.11.03 release
Fridolin Somers [Thu, 29 Feb 2024 10:22:42 +0000 (11:22 +0100)]
Increment version for 23.11.03 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 29510: (follow-up) Adapt GET /patrons/:patron_id
Tomas Cohen Arazi [Wed, 17 Nov 2021 21:09:02 +0000 (18:09 -0300)]
Bug 29510: (follow-up) Adapt GET /patrons/:patron_id

This patch makes GET /patrons/:patron_id rely on this new behavior from the
objects.find helper.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 62df2689de670b81539a3569b0c8ec9e744d3170)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 29510: Make objects.find call search_limited if present
Tomas Cohen Arazi [Wed, 17 Nov 2021 21:03:00 +0000 (18:03 -0300)]
Bug 29510: Make objects.find call search_limited if present

This patch makes objects.find implicitly update the passed
*$result_set* to use search_limited. This way no object leaks could
happen without noticing.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t
=> FAIL: Tests fail because search_limited is not used
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! Results are correctly filtered based on userenv!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 1f1f0837cd2058ff8e953e6ae719c7513ad35927)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 29510: Regression tests
Tomas Cohen Arazi [Wed, 17 Nov 2021 21:02:17 +0000 (18:02 -0300)]
Bug 29510: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit fe5dc0bdda78424437331cf83624c7606a3a54b4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35942: OPAC user can enroll several times to the same club
Kyle M Hall [Tue, 30 Jan 2024 15:58:02 +0000 (10:58 -0500)]
Bug 35942: OPAC user can enroll several times to the same club

Test Plan:

1) Create 3 clubs, 1 limited to library A, 1 limited to library B and one not limited
2) Use a patron with home library A.
3) Go to the opac-user page, "Clubs" tab show 0/2 (the one from library B is not listed)
4) Browse to /cgi-bin/koha/svc/club/enroll?id=1
5) Reload that page a couple times
6) Note the patron is now enrolled in the same club multiple times
7) Delete those enrollments
8) Apply this patch
9) Restart all the things!
10) Repeat steps 2-7, note the lack of duplicate enrollments!
11) Repeat steps 2-10 for the staff interface

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit affb8929fe7451a7dfec9498c55a97bac56129b3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35941: (QA follow-up) Tidy clubs-tab.pl
Kyle M Hall [Tue, 30 Jan 2024 14:32:12 +0000 (14:32 +0000)]
Bug 35941: (QA follow-up) Tidy clubs-tab.pl

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 7d2204f2ce0c60263b050c72541c71462527fe5b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35941: Limit club list to those from the logged in user
Jonathan Druart [Tue, 30 Jan 2024 13:53:03 +0000 (14:53 +0100)]
Bug 35941: Limit club list to those from the logged in user

clubs-tab get the patron's id from the parameter. At the OPAC we must
use the one from the logged in user, to prevent leak to other users

Test plan:
Have 2 clubs: A, B
Enroll to A with patron borrowernumber=1
Enroll to B with patron borrowernumber=2
Log in with patron 1 and hit:
  http://localhost:8080/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=1
=> OK
Now hit
  http://localhost:8080/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=2
=> oops

Apply this patch, try again.
The "borrowernumber" parameter is no longer used to fetch the club list.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e51ef7ef76a4ee523b302d724d80118185030e60)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 34623: Update jQuery-validate plugin to 1.20.0
Owen Leonard [Wed, 20 Dec 2023 16:12:55 +0000 (16:12 +0000)]
Bug 34623: Update jQuery-validate plugin to 1.20.0

This patch updates the jQuery validation plugin in both the staff
interface and the OPAC to the latest version, 1.20.0.

To test, apply the patch and clear your browser cache if necessary.

Test various pages in the staff client to confirm that form validation
works as expected:

 - Patron password change form:
   - Password must conform to minPasswordLength
   - Password must not contain leading/trailing spaces
   - Passwords must match

 - Administration -> Add or edit budget:
   - Description, start date, and end date are required
   - Start date must be before end date

 - Administration -> Add or edit Z39.50/SRU server:
   - Server name, hostname, port, and database are required
   - Port, rank, and timeout must be a number

Perform the same check of the "Change password" form in the OPAC.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit 8deffec3155f54b7209f1465942fd8fbea23da5e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36072: opac-request-article should check syspref
Marcel de Rooy [Tue, 13 Feb 2024 12:36:44 +0000 (12:36 +0000)]
Bug 36072: opac-request-article should check syspref

Note: This is handled now just like opac-reserve.

Test plan:
Disable ArticleRequests and hit the page.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8afcbe0bbb556cb19ff2e33e56cf3bcb8dd13d11)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36092: Pass sessionID at the end of get_template_and_user
Jonathan Druart [Wed, 14 Feb 2024 08:45:45 +0000 (09:45 +0100)]
Bug 36092: Pass sessionID at the end of get_template_and_user

It seems safer to pass the logged in user and session info at the end of
the sub.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 199b47e51220a22110436a2357481dc89d498537)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36092: Pass the sessionID from checkauth if we hit auth
Jonathan Druart [Wed, 14 Feb 2024 09:33:11 +0000 (10:33 +0100)]
Bug 36092: Pass the sessionID from checkauth if we hit auth

If we hit the auth page we were not passing sessionID to the template

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 95098d23e0c0bfc5291464a625ff6422b8288888)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 36092: Add test
Jonathan Druart [Wed, 14 Feb 2024 09:56:17 +0000 (10:56 +0100)]
Bug 36092: Add test

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit eb3166a6650d25cb7410e50966ab507173771b13)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35918: Fix auto library connect (AutoLocation)
Jonathan Druart [Fri, 26 Jan 2024 07:58:17 +0000 (08:58 +0100)]
Bug 35918: Fix auto library connect (AutoLocation)

This code is a bit weird, its purpose it to auto select the library depending on the IP.
A problem appears if the same IP is used, then the user's choice will
might be overwritten randomly by another library.

To recreate the problem:
Turn on AutoLocation
Use koha/koha @CPL for test
And the following config:
*************************** 1. row ***************************
branchcode: CPL
branchname: Centerville
  branchip: 172.18.0.1
*************************** 2. row ***************************
branchcode: FFL
branchname: Fairfield
  branchip: 172.18.0.1
*************************** 3. row ***************************
branchcode: FPL
branchname: Fairview
  branchip: 172.18.0.4

Connect and select CPL. Randomly FFL will be picked instead.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Tested this on top of 35890 and 35904 because git bz said they were required dependencies.
Figured out the IP Koha was seeing me as coming from in /var/log/koha/kohadev/plack.log.
Added that IP to the branchip for Centerville, Fairfield and Fairview. Set AutoLocation = Yes.
After this I could recreate the problem: If i left the "Library" field in the login screen
at "My Library" I got logged into a random library selected from the three i had set
branchip for. Applying the patches fixed this, as expected.
Tests pass, with AutoLocation off.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 4efe74fe12075298680965db3605f717f1da10d0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35918: Add test
Jonathan Druart [Fri, 26 Jan 2024 07:57:03 +0000 (08:57 +0100)]
Bug 35918: Add test

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e00cfb3c7b3954e545ad4b363bff48a8f4345d0a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35890: Add tests for AutoLocation
Jonathan Druart [Thu, 25 Jan 2024 08:36:01 +0000 (09:36 +0100)]
Bug 35890: Add tests for AutoLocation

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 85717a99c7ba20d3bef8e9ba15df6d0a86f368c6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35890: Reject login if IP is not valid
Jonathan Druart [Wed, 24 Jan 2024 15:25:30 +0000 (16:25 +0100)]
Bug 35890: Reject login if IP is not valid

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 94e570d6af38c0061aeaad2ea25ab26bed2186f5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35890: Remove var loggedin
Jonathan Druart [Wed, 24 Jan 2024 15:24:51 +0000 (16:24 +0100)]
Bug 35890: Remove var loggedin

It is never used and add confusion

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 0ce8cc4c05bc96503172018775ba574e41b40ecb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35904: (QA follow-up): tidy up code
Victor Grousset/tuxayo [Thu, 15 Feb 2024 03:18:37 +0000 (04:18 +0100)]
Bug 35904: (QA follow-up): tidy up code

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit beb0f55006d60eb269ffd5ca6148a8293f8104df)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 months agoBug 35904: Make C4::Auth::checkauth testable easily
Jonathan Druart [Thu, 25 Jan 2024 09:35:41 +0000 (10:35 +0100)]
Bug 35904: Make C4::Auth::checkauth testable easily

This patch suggests to add a new flag do_not_print to
C4::Auth::checkauth to not print the headers and allow to test this
subroutine more easily.

We do no longer need to mock safe_exit and redirect STDOUT to test its
return values.

There are still 3 left:
1.
733         # checkauth will redirect and safe_exit if not authenticated and not authorized
=> Better to keep this one, not trivial to replace

2.
806         # This will fail on permissions
This should be replaced but testing $template->{VARS}->{nopermission}
fails, I dont' think the comment is better.

3.
828         # Patron does not have the borrowers permission
Same as 2.

2. and 3. should be investigated a bit more.

This patch also move duplicated code to set patron's password to a
subroutine set_weak_password.

Test plan:
Read the code and confirm that everything makes sense.
QA: Do you have a better way for this? Yes it's dirty!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit db173d3276455a43939dca68ccc6502839fa2a55)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 35930: Add guards for plugins_enabled
Andreas Jonsson [Mon, 12 Feb 2024 11:16:02 +0000 (11:16 +0000)]
Bug 35930: Add guards for plugins_enabled

The 'new' method in Koha::Plugins returns undefined if
plugins are disabled.  Therefore, calls to this method
must be guarded by a check that plugins actually are enabled.

Test plan:

* Code inspection of patch, alternatively
* Activate the ill system by installing a backend such as
  koha-illbackend-libris:
  https://github.com/Libriotech/koha-illbackend-libris
* Make sure plugins are disabled in koha-conf.xml
* In the staff interface, go to ILL requests.
* The page should load without getting an error 500.

PA amended commit message: This is not related to ILL backends being plugins or not
This is about ILL batches, where checking for metadata enrichment plugins was missing 'enable_plugins' guard
Additionally, unrelated to batches, it's also about ILLAvailability, where checking for ILL availabililty plugins was missing enable_plugins guard

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Hans Pålsson <hans.palsson@hkr.se>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit fee4368cd81e4318bed14f0a082c978badca4256)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 35518: Tidy the moved blocks
Martin Renvoize [Thu, 8 Feb 2024 15:55:43 +0000 (15:55 +0000)]
Bug 35518: Tidy the moved blocks

This patch just tidies the moved blocks to get us past the QA script
check.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit b577b6567045184adcb5bb55b7e5c70428e124ee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 35518: Check authentication and set userenv before fetching userenv variables
Nick Clemens [Fri, 26 Jan 2024 14:10:01 +0000 (14:10 +0000)]
Bug 35518: Check authentication and set userenv before fetching userenv variables

Currently we get the userenv before we have set it correctly for the session

To test:
 1 - Sign in as a user with fast cataloging permission
 2 - Bring up a patron, type gibberish into barcode field to get a fast cataloging link
 3 - Check the link, it should have your current signed in barcode
 4 - Sign in to a different browser with a different user and at a different branch
 5 - Bring up a aptron in circulation and type gibberish into barcode field to get a fast cataloging link
 6 - It may have your branch, but it may also have the other user's branch from the other window
 7 - Keep entering gibberish to get a link until one user has the correct branch
 8 - Then switch to the other browser, and keep entering gibberish, watch the branchcode change
 9 - Apply patch, restart all
10 - Test switching between browsers. generating fast cataloging links
11 - Users should now consistently have the correct branch

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 90b6f68616e2ba5ca3fcbbd9698c97ef41a45593)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 36034: Add test
Jonathan Druart [Wed, 14 Feb 2024 07:49:33 +0000 (08:49 +0100)]
Bug 36034: Add test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a77adbe76e13f79c5b965f9677b0960fb44aabfc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 36034: (bug 34893 follow-up) fix capture of return values from checkpw
Andreas Jonsson [Thu, 8 Feb 2024 10:57:03 +0000 (11:57 +0100)]
Bug 36034: (bug 34893 follow-up) fix capture of return values from checkpw

Adapt code to the change of return value type of checkpw
introduced in bug 34893

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 5f9e9e5df2377dd3b9e47354e9eee147bc048792)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 35962: (bug 35843 follow-up 2) Fix BackgroundJob.t on D10
Jonathan Druart [Tue, 6 Feb 2024 07:32:31 +0000 (08:32 +0100)]
Bug 35962: (bug 35843 follow-up 2) Fix BackgroundJob.t on D10

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d130a6c66b6cc6fb3221c0ea7e26f2d0825f4f72)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 35962: (bug 35843 follow-up) Fix BackgroundJob.t on D10
Jonathan Druart [Wed, 31 Jan 2024 15:44:47 +0000 (16:44 +0100)]
Bug 35962: (bug 35843 follow-up) Fix BackgroundJob.t on D10

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d7669ae2a96d570a6f4de2b60bd207799c69142b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 35940: Close modal before typing
Matt Blenkinsop [Wed, 31 Jan 2024 16:36:27 +0000 (16:36 +0000)]
Bug 35940: Close modal before typing

Tests currently fail due to a modal remaining open. This patch closes the modal to make the tests pass

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 269d6f644480d89e7752e58d299b678dcef93617)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 35940: (bug 35477 follow-up) Fix cypress tests
Jonathan Druart [Tue, 30 Jan 2024 13:30:31 +0000 (14:30 +0100)]
Bug 35940: (bug 35477 follow-up) Fix cypress tests

AssertionError: Timed out retrying after 10000ms: Expected to find element: `main div[class='dialog message']`, but never found it.

We moved from message to alert.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f1b32b5316f6b204d6451a1902a0e510fa498f90)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 34862: (follow-up) Fix some misplaced messages and add missing
Owen Leonard [Thu, 9 Nov 2023 18:06:03 +0000 (18:06 +0000)]
Bug 34862: (follow-up) Fix some misplaced messages and add missing

This patch fixes some templates where the messages include was appearing
in the wrong place, for instance above the left-hand sidebar instead of
at the top of the main content.

The patch also adds the new include to some templates which lacked it.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit daeccd84c6858c919f8439ae52ddf254b7cfc176)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 34862: Manual changes
Jonathan Druart [Thu, 21 Sep 2023 13:12:45 +0000 (15:12 +0200)]
Bug 34862: Manual changes

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e37ec44cb50973657c71a1b153a1902096ecc61c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 34862: Add messages.inc
Jonathan Druart [Thu, 21 Sep 2023 13:08:54 +0000 (15:08 +0200)]
Bug 34862: Add messages.inc

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7f06a4bd0045b8c07069bf73870cae70b24a0d02)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 34862: Include messages.inc
Jonathan Druart [Thu, 21 Sep 2023 13:10:48 +0000 (15:10 +0200)]
Bug 34862: Include messages.inc

Generated using `perl add_blocking_errors.pl`

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a19d36cf1404c1a6ad43fceb2bc4e785e5768a79)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 34862: Remove blocking_errors where there is no main
Jonathan Druart [Thu, 21 Sep 2023 12:13:22 +0000 (14:13 +0200)]
Bug 34862: Remove blocking_errors where there is no main

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 29cf57064b29a4c4aaf221ccf9159b017909a3c7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 18397: (follow-up) Some tiny style and spelling changes
Katrin Fischer [Wed, 31 Jan 2024 12:55:01 +0000 (12:55 +0000)]
Bug 18397: (follow-up) Some tiny style and spelling changes

* cc is an abbreviation, so updated to CC
* Adding consistency with punctuation for error messages
* Updated a borrower to patron

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e8c3142d81879eb453468279baa69fa6245c286e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 18397: Add message delivery details to the notices tab
Martin Renvoize [Wed, 8 Nov 2023 16:41:02 +0000 (16:41 +0000)]
Bug 18397: Add message delivery details to the notices tab

This patch adds further delivery details to the notices tab in patron
details in the staff client.

Once a message is sent, we display the 'from:', 'to:' and 'cc:'
addresses in the 'Delivery note' column when they exist.

Test plan
1. Enable KTD to send email [1] (without email configured the
   delivery note displayed "Unhandled email failure, check the logs for
   further details").

2. Add email addresses to two patrons and to KohaAdminEmailAddress,
   and run misc/cronjobs/process_message_queue.pl after generating
   notices.

3. For the two patrons with email addresses, make one a guarantor.

4. Sent Welcome messages (Patron account > More > Send welcome email) -
   nothing in delivery note column.

5. Checkout out an item to the guarantee (item checkout email enabled) -
   nothing in delivery note column.

6. Send the notices by running misc/cronjobs/process_message_queue.pl
   again.

7. Now the 'Delivery note' columns should contain from:, to: and cc:
   address details.

[1] Option 1 - smpt-sink (aka the sandboxes way)
    - Install the postfix package inside ktd (sudo apt install postfix)
      When asked in the wizard, I named mine 'local'
    - Start smpt-sink with
      `nohup smtp-sink -u root -D mail 127.0.0.1:25 100 </dev/null >/dev/null 2>&1 &`

    Option 2 - To test sending emails using a Google account:
    - Set up an App password for your Google Account
    - Edit /etc/koha/sites/kohadev/koha-conf.xml file and add this
      configuration near the end (where <user_name> = your Google email
      address; <password> = your APP password, not your Google account
      password):

      <smtp_server>
        <host>smtp.gmail.com</host>
        <port>587</port>
        <timeout>5</timeout>
        <ssl_mode>STARTTLS</ssl_mode>
        <user_name>GOOGLEACCOUNTUSER</user_name>
        <password>GOOGLEAPPPASSWORD</password>
        <debug>1</debug>
      </smtp_server>

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 137376ab4b624ae01d20e2106196c46a39dd8581)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 35479: (QA follow-up): Tidy
Pedro Amorim [Mon, 18 Dec 2023 12:51:16 +0000 (12:51 +0000)]
Bug 35479: (QA follow-up): Tidy

Signed-off-by: Pedro Amorim <pedro.amorim@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 d7a633048e6681e356be24c8192803181abd2383)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 months agoBug 35479: (follow-up) Match formatting for other cronjob logs
Nick Clemens [Tue, 5 Dec 2023 13:40:48 +0000 (13:40 +0000)]
Bug 35479: (follow-up) Match formatting for other cronjob logs

To test:
1 - Install the Kitchen Sink plugin
2 - Restart all
3 - Enable 'CronjobLog' system preference
4 - perl misc/cronjobs/plugins_nightly.pl
5 - Note you see on the command line 'Remember to clean the kitchen' - this indicates the plugin cron ran
6 - Tools->log viewer, select 'cronjob' and view
7 - Note you only see 'plugins_nightly.pl' Run and End lines
8 - Apply patches
9 - perl misc/cronjobs/plugins_nightly.pl
10 - View logs agian
11 - Note you now see Run and End lines for 'Koha::Plugin::Com::ByWaterSolutions::KitchenSink'
12 - Confirm they look like the other lines
13 - Edit KitchenSink.pm and add 'die "Kittens";' to the cronjob nightly
14 - perl misc/cronjobs/plugins_nightly.pl
15 - View logs, confirm there is a FAILED error message for the KitchenSink cron

Signed-off-by: Pedro Amorim <pedro.amorim@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 ea30aaff625b1171ac30cb80c67f8eea69c08de3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>