Commit Graph

61422 Commits

Author SHA1 Message Date
Martin Renvoize b80dafc210
Bug 23909: Apply hold policy to OPAC REST self-checkout
The OPAC REST self-checkout path (guarded by OpacTrustedCheckout) is
functionally SCO-over-API, so it should honour the same hold policy
as the SCO web interface. Previously _check_availability unconditionally
promoted RESERVED, RESERVE_WAITING, TRANSFERRED and PROCESSING from
the confirmation hash to the blockers hash for any public caller. This
meant the OPAC REST endpoint always refused held items regardless of
the librarian's AllowItemsOnHoldCheckoutSCO configuration.

With this patch the promotion is gated on AllowItemsOnHoldCheckoutSCO:

* 0 - Promote all four hold confirmations to blockers (previous
      behaviour for pending holds)
* 1 - Promote only waiting/transit/processing; silently allow
      checkout of items with a pending hold
* 2 - Promote none; silently allow checkout of items with any hold

Remaining hold confirmations are stripped from the response so the
caller does not have to resolve a confirmation token for a policy the
admin has already granted.

Test plan:
1. prove t/db_dependent/api/v1/checkouts.t
2. Enable OpacTrustedCheckout. POST an item with a pending hold for
   another patron to /api/v1/public/patrons/X/checkouts:
   - AllowItemsOnHoldCheckoutSCO=0: 403 Checkout not authorized
   - AllowItemsOnHoldCheckoutSCO=1: 201 Created
3. Place a waiting hold for another patron on an item. Repeat:
   - AllowItemsOnHoldCheckoutSCO=1: 403
   - AllowItemsOnHoldCheckoutSCO=2: 201

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 11:04:20 -06:00
Martin Renvoize cd3b0770c5
Bug 23909: Extend SIP to distinguish pending vs waiting holds
This patch extends the SIP checkout handler to honour the new
three-valued AllowItemsOnHoldCheckoutSIP preference:

* 0 - Don't allow checkout of any held item
* 1 - Allow checkout when the hold is still pending (not attached)
* 2 - Also allow checkout when the hold is waiting, in transit or
      being processed for another patron

Previously the preference was a simple YesNo toggle that, when
enabled, allowed the checkout regardless of whether the hold was
pending or already attached to an item on the hold shelf. Libraries
could not block the more disruptive case (checking out a waiting
hold destined for another patron) without also blocking pending
holds.

The existing post-confirmation filter is reworked into a single
branch per confirmation type that consults the preference value.

Test plan:
1. prove t/db_dependent/SIP/Transaction.t
2. With AllowItemsOnHoldCheckoutSIP=0, place a pending hold for
   patron A on an item, attempt SIP checkout to patron B: refused.
3. Repeat with the hold marked waiting: refused.
4. Set AllowItemsOnHoldCheckoutSIP=1, pending hold: allowed;
   waiting hold: refused.
5. Set AllowItemsOnHoldCheckoutSIP=2, waiting hold: allowed.

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 11:04:19 -06:00
Martin Renvoize b336cf88d5
Bug 23909: Block waiting holds at SCO checkout
AllowItemsOnHoldCheckoutSCO was previously passed through to
CanBookBeIssued as the ignore_reserves flag, which skipped the entire
holds branch in C4::Circulation and silently allowed checkout of
items already waiting on the hold shelf (reserves.found = 'W') or in
transit/processing for another patron's hold.

With the pref now a 3-value Choice:
  0 = don't allow checkout of any held items
  1 = allow checkout of items with a pending hold only
  2 = allow checkout of items with any hold state

sco-main.pl now always calls CanBookBeIssued with ignore_reserves=0
and filters the needsconfirmation keys according to the pref value,
mirroring the pattern SIP already uses. RESERVE_WAITING, TRANSFERRED
and PROCESSING are added to the error-matching list and to the SCO
template so patrons see a specific "on the hold shelf" / "in transit"
/ "being processed" message instead of falling through to the generic
"please see a member of the library staff" line.

Test plan:
- Enable WebBasedSelfCheck; log in to /cgi-bin/koha/sco/sco-main.pl.
- Create an item with a pending hold for another patron
  (reserves.found IS NULL).
- With AllowItemsOnHoldCheckoutSCO = 0, scan the barcode: checkout is
  refused with "This item is on hold for another patron".
- Switch to 1 ("Allow pending holds only"): checkout succeeds.
- Set the hold to waiting (reserves.found = 'W') and try again with
  the pref still at 1: checkout is refused with "This item is waiting
  on the hold shelf for another patron".
- Switch to 2 ("Allow pending and waiting holds"): checkout succeeds.
- Repeat with found = 'T' and 'P' at pref = 1 -> refused with the
  appropriate transit/processing message; at pref = 2 -> allowed.

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 11:04:19 -06:00
Martin Renvoize 83155b8ffd
Bug 23909: Add syspref values and atomicupdate
AllowItemsOnHoldCheckoutSCO and AllowItemsOnHoldCheckoutSIP become
Choice (0|1|2) so libraries can distinguish pending from waiting holds:

  0 = Don't allow (unchanged)
  1 = Allow pending holds only (new semantics; previously "Allow")
  2 = Allow pending and waiting holds (preserves old permissive behaviour)

A new AllowHoldCheckoutOverride YesNo preference (default 1) follows
the existing Allow*Override family and lets libraries block the
"check out anyway" override in the staff interface when an item is on
hold for another patron.

Note: installations that previously had either Allow*CheckoutSCO/SIP
set to 1 will migrate to "Allow pending only". Libraries that relied
on the previous behaviour (silently allowing checkout of items already
waiting on the hold shelf) need to manually switch to 2.

Test plan:
- Apply the patch and restart Koha.
- Run the web installer / updatedatabase.pl.
- Confirm no errors and the log mentions the three sysprefs.
- Run it a second time; confirm the "already migrated" / "already
  exists" skip messages appear.
- In Administration > System preferences, search for
  AllowItemsOnHoldCheckoutSCO and AllowItemsOnHoldCheckoutSIP and
  confirm the dropdown now has three options.
- Confirm AllowHoldCheckoutOverride appears in the same section with
  the Allow/Don't allow choices and defaults to Allow.

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 11:04:11 -06:00
Lucas Gass dc866af68b
Bug 26355: (RM follow-up) Fix script attribute order
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:08 -06:00
Lucas Gass dc2c4014d0
Bug 26355: (RM follow-up) Fix atomic update
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:07 -06:00
Lucas Gass 7c7258b9da
Bug 26355: (RM follow-up) force DBIC
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:07 -06:00
Lucas Gass 3e7626d4e0
Bug 26355: (RM follow-up) Adjust number of tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:06 -06:00
Lucas Gass 3fa81b71b4
Bug 26355: DBRev 25.12.00.056
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:06 -06:00
Martin Renvoize 9487953932
Bug 26355: (QA follow-up) Strip self_renewal_available in EmailPatronRegistrations tests
to_api now returns the derived self_renewal_available field, so
reusing a to_api'd patron as the POST body for /api/v1/patrons fails
with 500 (the value has no matching DB column). Adjacent subtests
already delete this read-only field before POSTing; do the same in
the EmailPatronRegistrations subtest.

Test plan:
1. prove t/db_dependent/api/v1/patrons.t — all tests pass.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:05 -06:00
Martin Renvoize e625b68bc1
Bug 26355: (QA follow-up) Bump test plan for new subtest
The "identify_updated_extended_attributes" subtest was added without
bumping the top-level plan, so prove reported a "Bad plan" failure
even though every subtest passed.

Test plan:
1. prove t/db_dependent/Koha/Patron.t — all tests pass, no plan
   mismatch.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:05 -06:00
Martin Renvoize 0cdf8a74c8
Bug 26355: (QA follow-up) Add CSP nonce to inline module script
The forbidden_patterns QA check requires <script> elements to have
either a "src" or "nonce" attribute. The inline module script that
hydrates the Vue island in opac-user.tt was missing a nonce.

Test plan:
1. Run the QA tool against opac-user.tt; forbidden_patterns should
   no longer report the inline <script> on line 1024.
2. Load the OPAC user summary page and confirm the Vue island still
   hydrates (no CSP violation in the browser console).

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:04 -06:00
Matt Blenkinsop bce9aad974
Bug 26355: (follow-up) Fix handling of extended attributes
Extended attributes weren't being identified as changes and so need to be checked to see if any of them have changed

Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:04 -06:00
Andrew Fuerste Henry da92eaa4d3
Bug 26355: (QA follow-up) perl tidy to address qa tool errors
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:03 -06:00
Matt Blenkinsop 029a4f71ec
Bug 26355: (follow-up) Allow the 'Clear' button to remove empty messages
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:03 -06:00
Matt Blenkinsop cb9e70f8c2
Bug 26355: (follow-up) Allow the setting of multiple information messages
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:02 -06:00
Matt Blenkinsop a76eb18bed
Bug 26355: Add unit tests
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:02 -06:00
Matt Blenkinsop d04923b3b9
Bug 26355: Add cypress tests
Adds categories to the db insertion mechanics and allows values to be passed to the patron insertion method

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:01 -06:00
Matt Blenkinsop e26310e14b
Bug 26355: Update the OPAC templates to support the Vue island
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:01 -06:00
Matt Blenkinsop 01f5214f0f
Bug 26355: Add the class methods and endpoint to handle renewal
This is part of a sponsored piece of development from one of our customers. There was a specification of requirements but I was conscious of the ideas already discussed on this bug and wanted to try and develop a solution that would balance both sets of requirements. The concept works as follows:
- Self-renewal can be enabled and controlled at a category level
    - The window within which it is available is customisable (both pre and post-expiry)
        - Defaults to the NotifyBorrowerDeparture syspref
    - The amount in fines that block self-renewal is customisable
        - Defaults to the category level charges and then the noissescharge preference
    - The message to display if renewal fails is customisable
- Libraries can also add information to display to the patron at the start of the process.
- The self-renewal process will also respect the OPACPatronDetails and AutoApprovePatronProfileSettings sysprefs. If OPACPatronDetails is enabled, the renewal will redirect the patron to the OPAC details form and ask them to confirm their details are still correct. Any changes will be logged as patron modifications and approved in line with the auto approval syspref
- Renewal happens regardless of whether OPACPatronDetails is enabled, only the details changes are logged as modification requests
- Notifications are sent to the patron in line with their messaging preferences

Test plan:
1. Apply all patches and reset_all
2. In the intranet, navigate to patron categories and edit the ‘Patron’ category
3. Scroll to the bottom, there should be a section called ‘Account expiry and self-renewal’
4. Set ‘Allow self-renewal’ to Yes
5. Set Self-renewal availability period to be 10 days
6. Set Self-renewal availability post-expiry’ to also be 10 days and save
7. In system preferences, set the OPACPatronDetails preference to ‘Don’t allow’
8. Choose a patron that has the ‘Patron’ type category
9. Edit that patron so that you can log into the OPAC and set their expiry date to be yesterday’s date
10. Log into the OPAC as that patron (it may be easiest to do this in incognito as we will be swapping between the intranet and OPAC throughout the test plan and it will remove the need to keep logging out and in)
11. You should see a message that says “You are eligible for self-renewal. Please click here to renew your account.”
12. Click that link - you will be presented with a modal that says “Are you sure you want to renew your account?”
13. Click “Close” - we don’t want to complete renewal yet as there is more functionality available to test
14. Navigate to the patron category again, set ‘Self-renewal availability post-expiry’ to be 0
15. Refresh the OPAC, the self-renewal link should not be there as we are now outside the patron self-renewal window
16. Undo that change in the patron category, the link should reappear when refreshing the OPAC
17. Now set the patron’s expiry date to be tomorrow
18. In the category, set ‘Self-renewal availability period’ to be blank
19. Refresh the OPAC, it should still show the link as it is defaulting to NotifyBorrowerDeparture
20. Set NotifyBorrowerDeparture to 0
21. Refresh the OPAC, the link should vanish
22. In the category, restore ‘Self-renewal availability period’ to 10 days
23. Refresh the OPAC, the link should reappear
24. In the intranet, set the patron to be debarred using a manual restriction
25. In the OPAC refresh the page - self-renewal should no longer be available
26. Remove the restriction - the renewal link will be visible again
27. Set a fine on the patron record of 6 USD
28. Refresh the OPAC, the self-renewal link will be gone because we are over the global ‘noissuescharge’ preference value of 5
29. In the category, set ‘Checkout charge limit’ to 7
30. Refresh the OPAC, the link will be visible because we are now under the category charge
31. Add an additional fine of 2 to the patron account
32. Refresh the OPAC, the self-renewal link is gone
33. In the category, set ‘Self-renewal charge limit’ to be 10
34. Refresh the OPAC, the link will be visible again
35. In the category, set ‘Self-renewal failure message’ to be whatever you want
36. In the OPAC, refresh the page and then click into the self-renewal process
37. This time, click “No” - you should see the failure message you have just set
38. Click “Close” and refresh the page to reset this message
39. In the category, set a message in the “Self-renewal information message”
40. In the OPAC, refresh the page and then click the renewal link again
41. You should be met with the modal, this time displaying the information message we just set up in the patron attributes
42. Click “Yes” - you should see the “Are you sure you want to renew your account?” message again
43. This time when prompted with the “Are you sure” message, click “Yes”
44. The page should refresh and display a confirmation with the new expiry date.
45. In the intranet, view the patron’s record - the date should have been updated
46. In the Modification log tab, there should be a log entry for “Membership renewed”
47. Change the patron’s expiry date again, this time to be yesterday’s date
48. In the OPAC, click on “Personal detail”, the new expiry date should show there
49. Now set the OPACPatronDetails syspref to be “Allow”
50. Click on “Summary” again, the self-renewal link should be there again
51. Click into the self-renewal process and click “Yes” on your verification step
52. This time you should be met with a message that says “Confirm your account details”
53. Click “Continue” - you will be redirected to the OPAC details form
54. There should be a message at the top that says “Please verify your details to proceed with your self-renewal.”
55. Update a field somewhere on the patron form
56. Scroll to the bottom - the button should say “Submit renewal request”
57. Click this button
58. You will be shown the renewal confirmation message
59. In the intranet, on the homepage you should now see a modification request
60. Check the request, it should match the fields you changed - don’t approve or deny for now
61. Set ‘AutoApprovePatronProfileSettings’ in sysprefs to “Enable”
62. Reset your patron’s expiry date to today’s date
63. In the OPAC, click into Personal details and then back into Summary again (we need to do this to remove the success parameter from the URL)
64. The renewal link will be visible again - go through the process again
65. On the form, you should see an alert that you have already sent a modification request
66. This time, change a different field to the previous attempt
67. Submit the form
68. In the intranet there should be no modification this time and the change should be visible in the patron record as it has been automatically approved and handled as per the syspref
69. prove t/db_dependent/Koha/Patron.t
70. prove t/db_dependent/api/v1/patrons_self_renewal.t
71. yarn cypress run --spec t/cypress/integration/Islands/SelfRenewal.ts
72. Sign off!

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:00 -06:00
Matt Blenkinsop 133946e50c
Bug 26355: Add a Vue island for the self-renewal modal
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:00 -06:00
Matt Blenkinsop 4979f0aead
Bug 26355: Add the new category fields to the UI
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:29:59 -06:00
Matt Blenkinsop 6ef6788406
Bug 26355: Update the API specs
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:29:59 -06:00
Matt Blenkinsop a9fda16f38
Bug 26355: DBIC file
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:29:58 -06:00
Matt Blenkinsop dfcb16a9ce
Bug 26355: Add new columns to the patron categories table
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:29:52 -06:00
Lucas Gass f0436bd140
Bug 41882: (follow-up) Fix failing xt/tt_kohaTable_tidy.t test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-30 14:06:22 -06:00
Lucas Gass 482c323144
Bug 41823: (follow-up) Remove redundant table_settings variable
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-30 14:06:22 -06:00
Lucas Gass 847fba0505
Bug 39516: (follow-up) Move table_settings variable
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-30 14:06:21 -06:00
Lucas Gass 3d02462f73
Bug 39516: DBIC
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-30 14:06:06 -06:00
Owen Leonard 00886b1f75
Bug 42104: The term ID should be capitalized
This patch corrects several instances in the templates where "ID" is
incorrectly capitalized, "id" or "Id."

To test, an inspection of the patch/diff should be enough to confirm
that the changes are correct.

Signed-off-by: Andrew Auld <andrew.auld@openfifth.co.uk>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:30 -06:00
Lucas Gass ad1d973380
Bug 34353: DBRev 25.12.00.055
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:29 -06:00
Martin Renvoize 7c25f2d4f1
Bug 34353: (QA follow-up) Fix QA script failures
- Replace IFNULL with COALESCE in the atomicupdate to satisfy the
  forbidden_patterns check (IFNULL is non-standard SQL).
- Run misc/devel/tidy.pl over the modified catalogue_detail.inc to
  satisfy the tidiness check.

Test plan:
1. Run the QA script against the patch series and confirm both
   forbidden_patterns and tidiness checks pass.
2. Re-run the parent commit's test plan and confirm spine-label column
   visibility behaves identically.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:29 -06:00
Martin Renvoize 1de09a6294
Bug 34353: (QA follow-up) Atomicupdate cleanup
- Set the executable bit on the atomicupdate so it passes the QA
  file_permissions check.
- Drop the unused 'say_info' import; only 'say_warning' and 'say_success'
  are now needed.
- Capture the row count from the DELETE so we report 'say_warning' on a
  re-run (when the syspref is already gone) instead of falsely claiming
  to have deleted it again.
- Add an inline comment explaining the conservative
  '(is_hidden OR VALUES(is_hidden))' conflict-resolution rule used when a
  table-settings row already exists alongside the old syspref value.

Test plan:
1. Verify the atomicupdate file has the executable bit set.
2. On a database where the syspref is still present, run the
   atomicupdate. Confirm output reads
   "Deleted 'SpineLabelShowPrintOnBibDetails' syspref".
3. Run the atomicupdate a second time. Confirm output now reads
   "'SpineLabelShowPrintOnBibDetails' syspref already removed".
4. Confirm the columns_settings rows are unchanged on re-run.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:28 -06:00
Martin Renvoize 8f6daa1b38
Bug 34353: (QA follow-up) Migrate spinelabel for both holdings tables
The catalogue_detail.inc include is shared by both the holdings_table
and otherholdings_table tabs, so the column visibility migration must
seed both. Without this, sites that previously had
'SpineLabelShowPrintOnBibDetails' set to "Don't show" would still see
the spine-label column appear in the other-holdings tab.

Also mark 'spinelabel' as is_hidden by default in admin/columns_settings.yml
for both tables, so fresh installs (where the atomicupdate doesn't run)
match the previous syspref default of 0 (Don't show).

Test plan:
1. Reset the database, do not apply the parent patch yet.
2. With the syspref still present, set it to "Don't show" and save.
3. Apply the parent patch and this follow-up, then update the database.
4. Navigate to a record with items in both 'Holdings' and 'Other holdings'
   tabs.
5. Verify the 'Spine label' column is hidden in BOTH tabs.
6. Reset the database again. Set the syspref to "Show", save, then apply
   patches and update the database.
7. Verify the 'Spine label' column is visible in BOTH tabs.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:28 -06:00
Olivia Reynolds 994feda588
Bug 34353: Remove 'SpineLabelShowPrintOnBibDetails' syspref
With the ability to customise which columns are hidden by default as
part of "Table settings", this syspref is redundant. As part of the
atomicupdate, we incorporate the previous syspref value into
columns_settings.

As there are six possible states the migration could start from (the
syspref can be 0 or 1, and the table setting can be 0, 1, or NULL) and
two final states it must be idempotent from, the test plan is
unfortunately quite cumbersome.

Test plan:
1.  Reset the database, to clear the table settings.
2.  Apply patch and update the database.
3.  Navigate to Administration > System preferences > Cataloging.
4.  Verify that "SpineLabelShowPrintOnBibDetails" does not appear.
5.  Navigate to a catalogue detail page.
6.  Verify that the "Spine label" column is hidden.
7.  Update the database again.
8.  Navigate to a catalogue detail page.
9.  Verify that the "Spine label" column is hidden.
10. Revert the patch.

11. Reset the database, to clear the table settings.
12. Navigate to Administration > System preferences > Cataloging.
13. Set "SpineLabelShowPrintOnBibDetails" to "Show" and save.
14. Apply patch and update the database.
15. Navigate to a catalogue detail page.
16. Verify that the "Spine label" column is visible.
17. Update the database again.
18. Navigate to a catalogue detail page.
19. Verify that the "Spine label" column is visible.
20. Revert the patch.

21. Reset the database, to clear the table settings.
22. Navigate to Administration > Table settings.
23. Under Catalog > holdings_table, check "Is hidden by default" for
    "spinelabel" and save.
24. Apply patch and update the database.
25. Navigate to a catalogue detail page.
26. Verify that the "Spine label" column is hidden.
27. Revert the patch.

28. Reset the database, to clear the table settings.
29. Navigate to Administration > System preferences > Cataloging.
30. Set "SpineLabelShowPrintOnBibDetails" to "Show" and save.
31. Navigate to Administration > Table settings.
32. Under Catalog > holdings_table, check "Is hidden by default" for
    "spinelabel" and save.
33. Apply patch and update the database.
34. Navigate to a catalogue detail page.
35. Verify that the "Spine label" column is hidden.
36. Revert the patch.

37. Reset the database, to clear the table settings.
38. Navigate to Administration > Table settings.
39. Under Catalog > holdings_table, uncheck "Is hidden by default" for
    "spinelabel" and save.
40. Apply patch and update the database.
41. Navigate to a catalogue detail page.
42. Verify that the "Spine label" column is hidden.
43. Revert the patch.

44. Reset the database, to clear the table settings.
45. Navigate to Administration > System preferences > Cataloging.
46. Set "SpineLabelShowPrintOnBibDetails" to "Show" and save.
47. Navigate to Administration > Table settings.
48. Under Catalog > holdings_table, uncheck "Is hidden by default" for
    "spinelabel" and save.
49. Apply patch and update the database.
50. Navigate to a catalogue detail page.
51. Verify that the "Spine label" column is visible.

Thanks-to: Katrin Fischer
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:27 -06:00
Lucas Gass 1fe357b289
Bug 42169: (follow-up) When changing to a new category set messaging prefs dirty
Signed-off-by: John Vinke <jvinke@austinseminary.edu>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:27 -06:00
Lucas Gass 0809d09222
Bug 42169: Unify patron category change popups
To test:
1. APPLY PATCH, restart_all
2. Go to  Administration > Patron categories
3. Edit or create some categories with different Enrollment periods and messaaging preferences
4. Find or create some patrons in different categories than the ones setup in step 3.
5. Edit the patron and change the category to one setup in step 3.
6. Notice a popup asking about both patron expiratoin date and messaging preferences, both should be checked by default.
7. Confirm and check that both the patron expiration date and messaging preferences updated to the category defaults.
8. Try again, checking only one of the 2 checkboxes. Make sure things updated correctly. Try this with both checkboxes.

Signed-off-by: John Vinke <jvinke@austinseminary.edu>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:26 -06:00
David Nind 1dd005c04d
Bug 42474: Patron categories form label - fix spelling for "Upperage limit"
Fix the spelling for a patron categories form label. "Upperage limit"
should be "Upper age limit" (there should be a space between upper and
age). Also fixes the table row label when attempting to delete a
patron category.

Test plan:
1. Go to Administration > Patrons and circulation > Patron categories.
2. Add a new patron category (or edit an existing category).
3. Notice that the label "Upperage limit" has no space between
   upper and age.
4. Attempt to delete a patron category, for example, Staff.
5. Note the itable row label is "Upperage limit".
6. Apply the patch.
7. Reload the pages for steps 2 and 4.
8. Note that the labels are now splet correctly as "Upper age limit".

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Gretchen Maxeiner <maxeinergl@gcc.edu>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:26 -06:00
David Nind dc40379b7d
Bug 42434: Fix capitalization for notice and slip configuration pages
Bug 35267 (Clarify CSS options for notices) added several new sections
to notice and slip configuration pages. However, the headings and
some sentences use capital case instead of sentence case.

This updates the text for the headings and sentences to use sentence
case. It also adds full stops to some alert sentences for
consistency.

Test plan:
1. Go to Tools > Patrons > Notices and slips.
2. Edit a notice or slip.
3. Note that several headings are capitalized, instead of using
   sentence case.
4. Expand each heading, and notice that some text doesn't use
   sentence case.
5. Apply the patch.
6. Refresh the notice or slip page.
7. Note that headings and text now use sentence case (and sentences
   in alerts now have a full stop).

Examples - headings in capital case:
- Global HTML Notice Styles
  . All Notice CSS
  . Email Notice CSS
  . Print Notice CSS
  . Print Slip CSS
...and further down the page under "Default language: English"
- Local HTML Notice Styles

Examples - text in expanded sections in capital case:
- CSS to be applied to email notices in addition to that already
  in "All Notice CSS"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:25 -06:00
David Nind 1357768b00
Bug 42140: Add a space between patron name and relationship
There is no space between the guarantor name and relationship on the
patron's details page in the staff interface, for example:
Henry Acevedo(father).

Test plan:
1. Go to Patrons.
2. Search for Lisa Charles (borrower number = 37).
3. Select Edit.
4. In the patron guarantor section, click on "Add guarantor":
   - Search for and select Henry as the guarantor
   - For relationship, select an option
5. Click Save.
6. Go to the details section.
7. Note that under the Guarantor heading there is no space between the
   guarantor's surname and the relationship,
   for example: Henry Acevedo(father)
8. Apply the patch.
9. Refresh the page.
10. Note that there is now a space between the surname and relationship.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:25 -06:00
Lucas Gass 845b933001
Bug 39516: DBRev 25.12.00.054
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:24 -06:00
Martin Renvoize 03397272c9
Bug 39516: (follow-up) Fix column drift when columns are hidden
The records-table row callback populated cells with positional
`$("td:eq(N)", nRow)` selectors. When a user hid a column (e.g. the
new "Score breakdown" column) via admin/columns_settings.yml, the
subsequent cells' positional indices shifted, causing the score
breakdown values to render into the Diff column.

Tag each rendered cell with `data-colname` via `createdCell` and
replace every `td:eq(N)` selector with a `td[data-colname='NAME']`
selector. Name-based selectors are unaffected when a column is
hidden: the selector simply matches zero elements and the append
is a no-op, while the remaining columns continue to receive the
correct content.

This aligns with the `bKohaColumnsUseNames` convention already
used by datatables.js (`_dt_visibility`, `_dt_force_visibility`,
the colvis button).

Test plan:
1. Stage a MARC file whose records produce matches (populating
   composite_scores).
2. Confirm Match details, Score breakdown and Diff cells render
   correctly with the default column layout.
3. Go to Administration > Table settings > tools >
   manage-marc-import > records-table and hide the "Score
   breakdown" column. Reload the staged batch view.
4. Verify the Score breakdown column is gone, the Diff column
   still shows "View" links, and the Record column still shows
   View/Edit buttons.
5. Repeat for other toggleable columns (Match details, Diff,
   Record) and confirm no drift.

Sponsored-by: Main Library Alliance <https://www.mainlib.org/>
Signed-off-by: Jeanne Mauriello <jeanne.mauriello@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:24 -06:00
Martin Renvoize 1d8a60083c
Bug 39516: (follow-up) Add missing POD for private subroutines
Adds minimal POD stubs for all private (underscore-prefixed) subroutines
in C4/Matcher.pm and C4/ImportBatch.pm to satisfy the QA script's
pod_coverage check.

Sponsored-by: Main Library Alliance <https://www.mainlib.org/>
Signed-off-by: Jeanne Mauriello <jeanne.mauriello@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:23 -06:00
Martin Renvoize adc1651a52
Bug 39516: Display composite match scores in staged batch view
Adds a new "Score breakdown" column to the staged MARC batch view that
shows the per-matchpoint score contributions for each candidate match,
e.g. "title:50, author:50" or "isbn:100", rather than a single opaque
total.

The column is hidden by default and can be toggled via the standard
column configuration tool (Administration > Table settings > Tools >
manage-marc-import). The existing "Match details" column continues to
show the numeric total score unchanged.

Falls back to displaying the raw aggregate score for any pre-existing
import_record_matches rows that have no composite_scores data.

To test:
1. Ensure you have a bibliographic matching rule with at least two
   matchpoints, e.g.:
     - Match point: search index "title",  score 50, tag 245$a
     - Match point: search index "author", score 50, tag 100$a
     - Match point: search index "isbn",   score 100, tag 020$a
   Set the threshold to 100.
2. Prepare two MARC files:
   a. A record that matches an existing catalogue entry via title + author
      (but not ISBN).
   b. A record that matches solely via ISBN.
3. Stage each file via Tools > Stage MARC records for import, applying
   the matching rule above.
4. Open the staged batch view for each batch.
5. Confirm the "Match details" column still shows the total numeric score
   as before, e.g. "(score=100)".
6. Use the column visibility toggle (or Administration > Table settings >
   Tools > manage-marc-import) to show the "Score breakdown" column.
7. Verify the breakdown column shows:
   a. File (a): "title:50, author:50"
   b. File (b): "isbn:100"
8. Confirm the "Score breakdown" column is hidden by default and the
   column toggle persists across page reloads.
9. Verify that pre-existing staged batches (run before this patch) still
   display gracefully — the breakdown column falls back to the numeric
   score.

Sponsored-by: Main Library Alliance <https://www.mainlib.org/>
Signed-off-by: Jeanne Mauriello <jeanne.mauriello@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:23 -06:00
Martin Renvoize 062e48ed8f
Bug 39516: Record per-matchpoint score breakdown when staging MARC records
Extends C4::Matcher::get_matches() to track each matchpoint's individual
score contribution alongside the aggregate total. A new `composite_scores`
hashref (keyed by search_index) is included in every result entry.

Updates C4::ImportBatch::SetImportRecordMatches() to JSON-encode and
persist the composite scores in the new column, and
GetImportRecordMatches() to decode and return them.

Sponsored-by: Main Library Alliance <https://www.mainlib.org/>
Signed-off-by: Jeanne Mauriello <jeanne.mauriello@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:22 -06:00
Martin Renvoize 382b06dd28
Bug 39516: Add composite_scores column to import_record_matches
Adds a new nullable longtext column `composite_scores` to the
`import_record_matches` table to store a JSON object mapping each
matchpoint search_index to the score it contributed to the total.

This allows the UI to display a breakdown of match scores (e.g.
"title:50, author:50") rather than just the aggregate total.

Sponsored-by: Main Library Alliance <https://www.mainlib.org/>
Signed-off-by: Jeanne Mauriello <jeanne.mauriello@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:22 -06:00
Lewis Clay d34e09d2f6
Bug 42131: Terminology: Return in action logs should be Check-in
The problem that arises here is that return meaning
'return to previous page' as a verb and 'Return' as a substantive
require different translation, at least in German.

Updated the display text 'Return' to 'Check-in' in:
- action-logs.inc: The action log display for the RETURN case

This resolves problems in the translation

Test plan:
1. Navigate to a page displaying Action logs
2. Look for entries with the RETURN action
3. Confirm the display text now shows 'Check-in' instead of 'Return'

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:21 -06:00
Andrew Fuerste Henry 7e34351ede
Bug 41882: (QA follow-up): Correct table settings values
The prior patch incorrectly linked to 'circ' and 'holds' in the table settings, causing the Configure to take one to the wrong part of the table settings page and saved table settings to not be enforced.

To test:
1: Apply all patches, restart_all
2: Attempt a batch modification of two or more holds such that at least one modification will succeed and at least one will fail
3: On the results page, confirm the Configure button on both the "Updated holds" and "Failed holds" tables correctly lead to the modified_holds table settings
4: Adjust settings for the modified_holds table
5: Confirm your changes are reflected in the results page for subsequent batch hold modifications

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:21 -06:00
Lucas Gass cc3b7cebf5
Bug 41882: Enforce pickup location rules
To test:
1- Set ReservesControlBranch to 'item's home library'
2- Set Main library's 'Holds and bookings policies by item type' so that PASS items can only be picked up at Main
3- Place a hold on a bib whose only item is a PASS belonging to Main
4- Use the Batch hold modification tool to identify the hold you just placed
5- Update the pickup location to North. Note that the update is successful, and there's no indication that the pickup location is now a problem.
6- Check in Main's PASS, and note that the hold doesn't trigger to fill
7- APPLY PATCH, restart_all
8- Try again, this time the hold should fail to update at all.
9- You should see a new table with the 'Failed hold' in it, it should also include a 'Result' column which explains why the hold failed (New pickup location is invalid).
10- Try modifying a hold to an invalid pickup location, but also attempt to modify something else on the hold at the same time, like expiration date.
11- The hold should not modify anything. If the pickup location is invalid all other modifications should NOT happen on that hold.
12 - Play with the Table settings for the holds_modified tables, ensuring you can hide/show all the columns.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:20 -06:00
David Cook 63f8c65b36
Bug 42463: Use text instead of HTML for confirm message
This change uses the text instad of the HTML for the delete SMS
provider confirm message.

Test plan:
0. Apply the patch
1. Go to Administration, click System preferences, search for SMSSendDriver
2. Set SMSSendDriver to "Email"
3. Go to administration
4. Click on "SMS cellular providers"
5. Click "New SMS provider"
6. For "Name" and "Domain" write: This & That
7. Click Submit
8. Click "Delete" for the new provider
9. Note that the message says "Are you sure you want to delete This & That?"
10. Click "OK"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:20 -06:00