Commit Graph

60557 Commits

Author SHA1 Message Date
Michael Hafen 4414a91678
Bug 37966: When Renewing a book on hold, don't require the due date
When renewing a book on hold with the RenewalOnHoldOverride sys pref set
to "Allow", if the due date is not specified then it becomes "now".  By
checking the input is set rather than just defined the due date is set as
expected based on circulation rules.
Also change the description of the RenewalOnHoldOverride sys pref as the
due date would no longer be required to be entered with this change.

Test plan:
1. make sure RenewalOnHoldOverride is set to 'Allow'
2. check out a book, then place a title-level hold on it
3. renew the book, see the hold override dialog
4. leave the due date empty and hit the override button
5. observe the new due date is "now"
6. apply patch and restart plack
7. renew the book again, overriding the hold, and see the expected due date
   as per circulation rules.

Signed-off-by: Marion Durand <marion.durand@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c84de245e3)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:22 +01:00
Jacob O'Mara 79e9c95312
DBRev 25.11.04.010
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:22 +01:00
Lucas Gass 1149805fa5
Bug 37671: (follow-up) Add INSERT IGNORE to db_rev
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ce92e707e1)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Andrew Fuerste Henry 649170bf46
Bug 37671: (QA follow-up) Add exec flag to atomicupdate
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4586a37b7a)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Andrew Fuerste Henry 06c5be37f1
Bug 37671: (QA follow-up) Tidy printreceipt.pl
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3598cea2ba)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Martin Renvoize 3ceca329d4
Bug 37671: (follow-up) Use PAYOUT notice for payout receipts on patron account page
This patch adds support for printing PAYOUT receipts from the patron
account page (members/boraccount.pl) using the new PAYOUT notice template.

Previously, PAYOUT debits used the generic invoice print template. Now
they use the same dedicated PAYOUT receipt template that is used in the
POS register, providing consistent receipt formatting across both
interfaces.

Test plan:
1. Create a charge on a patron account (e.g., Lost item)
2. Pay the charge
3. Refund the payment with a cash payout
4. On the patron account page, click "Print" for the PAYOUT transaction
5. Verify the receipt uses the PAYOUT notice template showing:
   - Transaction details (ID, operator, payout type)
   - Refund details showing what was refunded
   - Total payout amount
6. Verify it matches the format used in the POS register

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>
(cherry picked from commit 528f81b7fd)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Martin Renvoize 55a28aeb5f
Bug 37671: Fix POS receipt printing for refunds
The receipt printing logic was failing because it always expected a credit
but the "Print receipt" button was passing the payout debit line ID.

This fix:
- Updates pos/printreceipt.pl to use previously added PAYOUT template based
  on account line type
- Uses RECEIPT template for credits, PAYOUT template for PAYOUT debits
- Throws proper error for unsupported transaction types

Test plan:
1. Make a purchase through Point of Sale
2. Go to transaction history for the register used
3. Issue a refund for the purchase
4. Click "Print receipt" button for the refund
5. Verify receipt prints correctly with payout details

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
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>
(cherry picked from commit e92dfc5ab0)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Martin Renvoize c17bda6e93
Bug 37671: Add new 'PAYOUT' notice template
When a refund is processed through Point of Sale, the system creates:
1. A credit account line (the refund)
2. A debit account line (the payout)

The receipt printing logic currently only accounts for RECEIPTs against
credits.

This patch adds a new 'PAYOUT' template for dealing with the negative
debits that make up a payout so we can construct a proper receipt for
this action.

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>
(cherry picked from commit 02fb697d21)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Jacob O'Mara b89f646461
DBRev 25.11.04.009
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Kyle M Hall 971d1db193
Bug 42447: Add unit tests
PA amended: Removed bug number from subtest

Signed-off-by: Charlie Arthur <carthur@slolibrary.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f0a4659e3c)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Kyle M Hall 5cce1eba34
Bug 42447: SIP template fields in the database are too small
The SIP fields in the database are too small for the templates of some configurations, and are truncated during upgrade resulting in invalid templates. It's likely we need more than 255 characters for some templates. We should convert all sip template fields to TEXT fields.

Test Plan:
1) For each template field on a sip account attempt to save a template like:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXY
2) Note error preventing you from doing so
3) Apply this patch
4) Run updatedatabase.pl
5) Repeat step 1
6) Note you can now do so without error!

Signed-off-by: Charlie Arthur <carthur@slolibrary.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7693360a0f)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Jacob O'Mara d265afefb5
DBRev 25.11.04.008
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Martin Renvoize 95cddee07b
Bug 40633: Open fixed-length field helpers from the advanced editor
The advanced cataloging editor lets users hand-edit MARC records as
text but offers no equivalent of the basic editor's value_builder
popups for the fixed-length fields (Leader, 006, 007 and 008).
Catalogers have to type those byte strings by hand, which is error
prone.

This patch wires the 'open_helper_plugin' shortcut (added in the
preceding atomic update) to a new handler in the advanced editor
which:

 - inspects the line under the cursor;
 - if it is a Leader, 006, 007 or 008 control field, opens the
   corresponding marc21_*.pl plugin from cataloguing/value_builder/
   in a popup window, pre-populated with the current value;
 - splices the plugin's returned value back into the CodeMirror buffer
   when the popup closes.

The plugin templates are reused unchanged: a hidden
<input id="adv_editor_fixedfield_buffer"> on the editor page satisfies
the existing report() callback contract, and the editor polls
window.closed to detect submission. The 008 plugin is given the
current Leader value via &leader= so its material-type byte map
matches the record being edited.

The shortcut description is added to keyboard_shortcuts.inc so it
appears with a meaningful label in the in-editor "show shortcuts"
popover and in Administration > Keyboard shortcuts.

Test plan:
1. Apply this patch on top of the preceding atomic update.
2. Visit Administration > Keyboard shortcuts and confirm
   'open_helper_plugin' is listed with description "Open fixed-length
   field helper (Leader, 006, 007, 008)" and that the key combination
   can be edited.
3. Open the advanced cataloging editor on any record:
   a. Place the cursor on the 000 (Leader) line and press Shift-Ctrl-H.
      The marc21_leader popup should open with the current Leader
      value. Make a change, click OK, and confirm the Leader line
      updates in the editor and is marked modified in the gutter.
   b. Repeat for 006, 007 and 008. For 008, change the Leader's
      material-type byte first and confirm the 008 popup form adapts.
   c. Place the cursor on a 245 (or any non-fixed-length field) line
      and press Shift-Ctrl-H. Nothing should happen.
   d. Open a popup, then close it without saving. The editor line
      should remain unchanged.
4. Save the record and confirm the new fixed-field values round-trip
   correctly when the record is reloaded.
5. Confirm the basic editor's value_builder popups still work
   unchanged on Leader / 006 / 007 / 008.

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>
(cherry picked from commit 995bfe2083)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Martin Renvoize a12b71e93c
Bug 40633: Add new keyboard shortcut for the fixed-length field helper
This adds a new 'open_helper_plugin' keyboard shortcut to the
keyboard_shortcuts table, used by the advanced cataloging editor to
open the value_builder popup for the Leader, 006, 007 and 008 fixed
length fields. The default key combination is Shift-Ctrl-H ("Helper")
and is rebindable from Administration > Keyboard shortcuts. The
behaviour bound to this shortcut is added in a follow-up patch.

Test plan:
1. Apply this patch and run installer/data/mysql/updatedatabase.pl in
   KTD.
2. Run:
     SELECT * FROM keyboard_shortcuts
      WHERE shortcut_name = 'open_helper_plugin';
   Confirm a row exists with shortcut_keys = 'Shift-Ctrl-H'.
3. Re-run updatedatabase.pl and confirm the atomic update is idempotent
   (no error, no duplicate row).
4. On a fresh install (or by re-loading mandatory/keyboard_shortcuts.sql
   on an empty table) confirm the same row is created.

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>
(cherry picked from commit 37ad6039c6)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Kabooshki a71b1e1043
Bug 42106: Spelling: Failed to load plugin url: {0}
This patch fixes the url casing on both translation messages from "url"
to "URL" for better grammatical accuracy of the acronym.

Error not mentioned in original Bug Message hence replication is
undefined.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f019e490f9)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Tom Yates 94d0f168ba
Bug 41516: Terminology: Change cardnumber to card number for system preference descriptions
Following the terminology guidelines, the descriptions for AutoSwitchPatron,
CardnumberLog and SelfCheckoutByLogin have been updated to use 'card number'
with a space.

Test plan:
1. Review the descriptions for the system preferences and note that 'cardnumber'
   is used, instead of 'card number' for:
   - AutoSwitchPatron
   - CardnumberLog
   - SelfCheckoutByLogin
2. Apply the patch.
3. Repeat step 1, and note that the system preferences now use 'card number'.

Signed-off-by: Tom Yates <tom@hire-tom.co.uk>
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>
(cherry picked from commit dc644f0095)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Jacob O'Mara f8ce8ea57c
DBRev 25.11.04.007
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Martin Renvoize c5d5bba636
Bug 42156: (QA follow-up) Expand unit tests for recovery and skip paths
The original test only verified that a warning was emitted when a corrupt
authority record was encountered; it did not assert that get_matches
returned the recovered record, that an unrecoverable record was dropped,
or that a stale index pointing at a deleted authid was handled.

This patch turns the 'get_matches bad record test' subtest into a full
exercise of the three code paths introduced on this bug:

 1 - Recoverable: a record with stray non-XML characters is repaired by
     record_strip_nonxml and returned in the match list with the expected
     authid.
 2 - Unrecoverable: record_strip_nonxml is mocked to return undef; the
     parse warning still fires but the record is silently dropped from
     the result set (no die).
 3 - Stale search index: search_auth_compat returns an authid that does
     not exist in auth_header; get_matches no longer dies and returns an
     empty result.

The MarcMatcher fixture is given an explicit threshold of 1 so the 1000
score on the authority matchpoint always passes and matches are returned.

Test plan:
 1 - prove t/db_dependent/Matcher.t
 2 - All subtests pass including the expanded 'get_matches bad record test'.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 77237445b1)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Martin Renvoize 9ebd378149
Bug 42156: (QA follow-up) Register the new 'authid' search field on upgrade
Adding an entry to admin/searchengine/elasticsearch/mappings.yaml is only
picked up by fresh installs or when an administrator explicitly resets the
search mappings (rebuild_elasticsearch.pl -r). Existing installations would
otherwise never see the new 'authid' index in the admin UI nor have it
available as a matching index until they ran the reset.

This atomicupdate inserts:
 - a search_field row for 'authid' (type 'stdno', staff_client + opac on)
 - search_marc_map rows for authorities/marc21/001 and authorities/unimarc/001
   (INSERT IGNORE - the rows are shared with 'local-number' and usually
   already exist)
 - search_marc_to_field rows linking those MARC maps to the new field with
   sort on, matching mappings.yaml

It is a no-op if 'authid' is already present.

Administrators still need to rebuild the Elasticsearch index for the new
field to become queryable - this is noted with say_info at the end.

Test plan:
 1 - On an existing instance without the patch: note there is no 'authid'
     field under Administration > Search engine configuration (Elasticsearch)
     for authorities.
 2 - Apply the whole patchset.
 3 - perl installer/data/mysql/updatedatabase.pl
 4 - Re-check the search engine configuration: 'authid' appears for the
     authorities index, mapped to 001 for both MARC flavours.
 5 - Run the update again - confirm the "already exists, skipping" warning.
 6 - misc/search_tools/rebuild_elasticsearch.pl -r -v -a
 7 - Confirm a matching rule using index 'authid' now works.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3a3797f3f5)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Martin Renvoize 85d822f758
Bug 42156: (QA follow-up) Correct POD typos and demote private helpers
The previous POD follow-up added headings for the private helper subs but
introduced several typos and used =head2, which puts them at the same level
as the public API in the generated docs. This patch:

 - Fixes typos: matchpint, pionts, march matcher, mathcpoints, etc.
 - Clarifies a couple of descriptions.
 - Demotes each private helper from =head2 to =head3 so they render as
   implementation notes rather than peers of the public methods, matching
   the pattern used in Koha::Authority's "Internal methods" block.

Helper subs remain interleaved with the public API in source order to keep
the diff minimal; a wholesale move into a dedicated "Internal functions"
section would be a larger refactor outside the scope of this bug.

Test plan:
 1 - perldoc C4/Matcher.pm
 2 - Confirm no typos are rendered and the private helpers appear one level
     deeper than the public methods.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9f1ae44cc7)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Martin Renvoize 15878ddc15
Bug 42156: (QA follow-up) Guard against missing or unparseable authority records
The previous defensive block still dereferenced $target_auth unconditionally
when attempting to recover via record_strip_nonxml. If Koha::Authorities->find
returned undef (stale search index pointing at a deleted authid) the eval
around ->record would catch the first failure, but the recovery call on the
next line would die uncaught.

This patch:
 - Skips silently when the authid returned by the search engine no longer
   exists in the database, so get_matches cannot die on a stale index.
 - Wraps record_strip_nonxml in eval so an exception there is also handled
   and the record is simply skipped - matching the stated intent of the
   "skip when not possible" path.

Test plan:
 1 - Run t/db_dependent/Matcher.t - still passes.
 2 - Simulate a stale index: mock search_auth_compat to return an authid
     that is not present in auth_header. Confirm get_matches no longer dies
     and returns without error.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9d2b2c2493)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Nick Clemens 75884ec99a
Bug 42156: (QA follow-up) Missing POD
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>
(cherry picked from commit 94a9712745)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Nick Clemens abef7dc7bd
Bug 42156: Unit tests
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>
(cherry picked from commit f141799531)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:21 +01:00
Nick Clemens a2584a71f4
Bug 42156: Attempt to repair corrupted records and skip when not possible
When matching authorities we can die on a bad record, we should add protection against this
on top of bug 41843

To test:
 1 - Apply index patch and rebuild elastic
    perl misc/search_tools/rebuild_elasticsearch.pl -r -v
 2 - Make a new record matching rule
    threshold: 1000
    type: authority
    index: authid
    score: 1000
    tag: 001
 3 - Choose an authority record and corrupt it:
    sudo koha-mysql kohadev
    UPDATE auth_header SET marcxml = UpdateXML(marcxml, '//datafield[@tag="040"]/subfield[@code="c"]',CONCAT('<subfield code',CHAR(27),'="c">OSt</subfield>')) WHERE auth_header.authid=92;
 4 - View and save the record as marcxml
    http://localhost:8081/cgi-bin/koha/authorities/detail.pl?authid=92
 5 - Cataloging - stage marc records - authority/marcxml/no matching
 6 - Confirm it stages
 7 - Attempt to match using your new rule
 8 - Get an error parsing the marc
 9 - Apply patch, restart all
10 - Relaod the staged batch
11 - Attempt matching agaion
12 - Success!

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>
(cherry picked from commit c5adbe0818)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Nick Clemens 190d132268
Bug 42156: Add a stdno index for authid
In order to allow matching on authid we need a search index with a ci_raw
field

local-number is indexed as a number, and needed that way for sorting. This adds
a stdno version of 001 as authid

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>
(cherry picked from commit 88cfb35e5e)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
David Nind 38ab9ccf7a
Bug 39748: (follow-up) Update number of tests
Tests were failing as the number of tests was incorrect
as bug 42085 added additional tests.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ec88f94c42)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
David Cook f398bd43f3
Bug 39748: Fix Koha::Patron->is_expired to calculate using floating timezone
This patch updates Koha::Patron->is_expired so that it uses the floating
timezone for its datemath calculation.

Test plan:
0. Apply only the first patch including the unit test
1. prove -v t/db_dependent/Koha/ILL/Request.t \
        t/db_dependent/Koha/Patron/Restriction.t \
        t/db_dependent/Koha/Patrons.t \
        t/db_dependent/Koha/AdditionalContents.t \
        t/db_dependent/ILSDI_Services.t
2. Note that the unit tests fail
3. Apply the patch including the fix
4. prove -v t/db_dependent/Koha/ILL/Request.t \
        t/db_dependent/Koha/Patron/Restriction.t \
        t/db_dependent/Koha/Patrons.t \
        t/db_dependent/Koha/AdditionalContents.t \
        t/db_dependent/ILSDI_Services.t
5. Note that all unit tests pass now

6. Bonus points:
- Add the following to the top of /etc/koha/sites/kohadev/plack.psgi
before Modern::Perl:
use Test::MockTime;
BEGIN {
    Test::MockTime::set_absolute_time('1745580600');
}

- koha-plack --restart kohadev
- Look at the About page and do some circulation
- Without the patches, you'll get an internal server error
- With the patches, it'll just work

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 076c5bce8d)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
David Cook 4a804af13c
Bug 39748: Add unit test
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e0859f245f)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Lucas Gass f37e638178
Bug 27826: (RM follow-up) Attempt to fix failing test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4f58ed8953)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Jonathan Druart 2ea04c6a80
Bug 27826: Fix OPAC/SCO_spec.ts
1. The DELETE in afterEach was not needed
2. The test was failing randomly on the UPDATE of the beforeEach
  `Duplicate entry '+42+' for key 'itembarcodeidx'`
I don't explain it, but this patch should fix the failure.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 084c07a0fe)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Jonathan Druart 1d3d23d09c
Bug 27826: Add a Cypress test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0fb44d7ab5)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Tadeusz „tadzik” Sośnierz 35b20bfc1b
Bug 27826: Escape regexes when checking for new items in sco-main.tt
Test plan:

1. In KTD, go to cgi-bin/koha/catalogue/detail.pl?biblionumber=11
2. Edit the item, set its biblionumber to "+12345"
3. Go to self-checkout at /cgi-bin/koha/sco/sco-main.pl, log in (42:koha)
4. Enter "+12345" into the "Scan a new item" input field, submit
5. Observe a crash
6. Apply patch
7. Refresh the page, observe no patch
8. Renew item, refresh a few times, to observe the "NEW" badge working as expected

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ec938d2a1d)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Casey Conlin 64a36ad2fe
Bug 42359: Fix Guided.t update_sql test input
The test was feeding update_sql object field names instead of the parameter names it actually expects.
This let savedsql get cleared during the update.
The test was updated to pass the expected inputs so it still checks cache_expiry without creating the warning in the delete log path.

Test plan:
1. Confirm the issue by enabling the ReportsLog preference in Koha UI andin ktd shell running prove t/db_dependent/Reports/Guided.t
2. Apply the patch.
3. Run the tests again with prove t/db_dependent/Reports/Guided.t
4. The tests should pass.
5. Disable the preference and run again.
6. Tests should pass.
7. Sign off if steps above check out.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d09c65d047)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Andreas Roussos e172de3d7a
Bug 21453: Copy data to the correct subfields when linking authorities with authorities
When using the authority finder plugin from within Koha's
Authorities module, you can pick an entry from the 'Special
relationship:' dropdown menu in order to set the relationship
between authorities.

The problem is that in UNIMARC setups, when you click on
'Choose' to select an authority, it does not populate
subfields $3 (Authority Record Number) and $5 (Tracing
Control), which are required for authority linking and
authority hierarchies to work properly.

In MARC21, all authority data is correctly copied over.

This is due to hardcoded subfield values which are
MARC21-specific in blinddetail-biblio-search{.pl,.tt}.

This patch fixes that by checking the value of the
'marcflavour' syspref, and then setting the correct
subfields to copy the authority data to.

Test plan (involves testing in both a MARC21 and a UNIMARC instance):

0) [PREREQUISITES in order for the authority finder plugin to come up
    when testing in a UNIMARC instance]
   a) You must have at least one authority type besides the 'Default'.
   b) View the MARC structure of the 'Default' auth type, then click
      on 'Actions->Subfields' for tag 500; click on 'Edit subfields'.
      Select the subfield 'a' tab, then pick an auth type from the
      'Thesaurus:' dropdown menu; click 'Save changes' at the top.

1) In the Staff client, go to Authorities, then click 'New Authority'
   and pick the 'Default' authority type.

2) When the authority editor comes up, go to tag 500 and expand it.

3) Click on the Tag editor icon next to subfield $a.

4) When the authority finder comes up, search for an authority, pick
   a relator code from the 'Special relationship:' dropdown, and then
   click on the 'Choose' button for one of the authorities you found.

5) In MARC21: all subfields are populated correctly.
   In UNIMARC: notice how subfields $3 and $5 are *not* populated.

6) Apply the patch.

7) Repeat steps 3) and 4) above.
   In MARC21: all subfields are populated correctly, as before.
   In UNIMARC: both the relator code and the authority id are copied
               over along with any other subfields that may exist.

8) To ensure that authority linking in the Cataloging module works
   as before, launch the bibliographic record editor, find a MARC
   tag that allows you to search for an authority, and link it.
   In MARC21: all authority data is copied over (authid in $9).
   In UNIMARC: all authority data is copied over (authid in $9).

   NOTE: after linking, you may have to expand the MARC tag you
         chose so that subfield $9 becomes visible.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d88274881e)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Saiful Amin d0f0ec542f
Bug 41353: koha-dump failing on mysqldump PROCESS privileges
Problem:
Starting from MySQL 5.7.31 and MySQL 8.0.20, mysqldump requires the
PROCESS privilege to access tablespace metadata by default. Without
this privilege, backup operations fail with permission errors.

Solution:
Add the --no-tablespaces flag to the dbflag variable. This prevents
mysqldump from attempting to access tablespace metadata, allowing
backups to complete successfully without requiring the PROCESS privilege.

Test Plan:
  1. Set up a MySQL instance (5.7.31+ or 8.0.20+) without PROCESS privilege for the Koha database user
  2. Run the koha-dump script for a Koha instance:
     sudo koha-dump kohadev
  3. Notice the backup fails with a PROCESS privilege error
  4. Apply the patch
  5. Copy debian/scripts/koha-dump to /usr/sbin/koha-dump
  6. Repeat step 2
  7. Notice the backup now completes successfully without permission errors
  8. Test restoring the dump to ensure it's valid:
     zcat /var/spool/koha/kohadev/kohadev-<date>.sql.gz | tail
  9. Sign-off

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1f325d5799)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Caroline Cyr La Rose f957103cea
Bug 42309: JS error when there are no cash registers
This patch corrects a JavaScript error that appears on the cash
registers page when there are no cash registers yet.

To test :
BEFORE applying the patch
0. Make sure there are no cash registers in the database (reset_all if using ktd, or delete them)

1. Enable UseCashRegisters
   1.1. Go to Administration > System preferences
   1.2. Search for UseCashRegisters
   1.3. Set UseCashRegisters to Use
   1.4. Click Save all Accounting preferences

2. Open the browser developer tools (F12) and select the Console tab

3. Go to Administration > Cash registers
   --> Uncaught TypeError: can't access property "DataTable", crtable is undefined

4. Apply the patch

5. Refresh the cash registers page
   --> The error is gone!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b74f544231)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Jonathan Druart 06aad6058c
Bug 42277: Remove JS error when viewing a subscription
If no orders exist yet, there is a JS error in the console:
Uncaught TypeError: can't access property "DataTable", table is
undefined

Test plan:
0. Do no apply this patch
1. Create a new subscription and go to the detail view
2. Open the console and notice the JS error
3. Apply this patch
4. Confirm that the JS error is gone
5. Create an order from this subscription
6. Confirm that the orders table is displayed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit da121583a4)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Jonathan Druart 369acd42e2
Bug 42341: Fix translatability of 'Print label' on staff detail page
To test:
- Activate SpineLabelShowPrintOnBibDetails
- Install any translation. For ktd:
  sudo koha-translate --install de-DE --dev kohadev
- Activate translation with StaffInterfaceLanguages
- Find a bibliographic record with items and callnumbers in staff
- Verify the "Print label" is translated when switching between languages

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit be9efe452d)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
David Cook 75607c3f6b
Bug 42163: (follow-up) fix plugin wrapper menus, plugins-home.tt, and plugins-upload.tt
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 213693ed4f)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Lisette Scheer 16c68c9294
Bug 42163: Allow plugin wrapper to load VueJS
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 63695f05d5)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Raphael Straub f358d85bf1
Bug 41062: Add an option to erm_run_harvester.pl to specify provider IDs
This patch adds a new option to define the providers in cronjob erm_run_harvester.pl
that are used to run the SUSHI harvesting for COUNTER Reports in the ERM module.
Use parameter --provider-id or -p
The parameter provider_id is repeatable.
If the parameter for provider_id is not used all active providers will be harvested (as before).
The script will check if these providers are active (as before).

Script to run on ktd: perl misc/cronjobs/erm_run_harvester.pl --begin-date 2025-09-01 --end-date 2025-09-30

To test:
- Run the script and make sure that all active providers are harvested.
- Apply patch.
- Run the script with only one provider-id.
- Run the script with two provider-ids by using -p 1 -p 2
- Run the script without the parameter.
- Make sure that in all cases only active providers are harvested.
- Sign off :-).

Sponsored-by: Karlsruhe Institute of Technology (KIT)
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 43d32f77d6)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Owen Leonard 8f2e2d705e
Bug 42356: Silence Sass if-function deprecation warning
Like Bug 41327, deprecation warnings about Bootstrap SCSS should be
silenced with the assumption that a future version of Bootstrap will
correct the problems. In this case the warning is:

Deprecation Warning [if-function]: The Sass if() syntax is deprecated in
favor of the modern CSS syntax.

To test, apply the patch and run 'yarn build.' There should be no
warnings.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 04ca348222)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Martin Renvoize b89d154c85
Bug 37713: (QA follow-up) Add unit tests
Add tests for OpacSuppression handling in OAI-PMH
get_biblio_marcxml(), covering the full preference/flag matrix:
- Preference disabled, flag set: record returned
- Preference enabled, flag unset: record returned
- Preference enabled, flag set: record hidden
- Preference disabled again: record returned

Also cleans up stray 'use DDP' and extracts a
_build_repository() helper to reduce duplication.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f20428ab1f)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
David Cook af946b63d1
Bug 37713: Do not show record metadata if OPAC suppressed
This change checks the 942$n if OpacSuppression is enabled,
and does not return the record metadata if 942$n is true. See BZ 31161.

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. Enable syspref "OAI-PMH"
3. Set syspref "OpacSuppression" to "Hide"
4. Go to http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=oai_dc
5. Note KOHA-OAI-TEST:2 metadata visible
6. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2
7. Set 942$n to "Yes"
8. Go to http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=oai_dc
9. Note KOHA-OAI-TEST:2 metadata no longer visible and instead "Record Status: deleted" shows

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 70ff8dd1b4)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:20 +01:00
Emily Lamancusa 8e4cdaf22b
Bug 41851: (QA follow-up) Log completion before exiting
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 29caec496b)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:19 +01:00
Nick Clemens 2f6b96990e
Bug 41851: Add logging to edi cron job
To test:
1 - Enable cronjob logging:
    http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CronjobLog
2 - Enable EDIFACT
    http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EDIFACT
3 - perl misc/cronjobs/edi_cron.pl
4 - Check action logs for cronjobs:
    http://localhost:8081/cgi-bin/koha/tools/viewlog.pl?src=&user=&modules=CRONJOBS&actions=&object=&info=&interfaces=&from=&to=&output=screen&basename=Export&report_name=&do_it=1
5 - No log
6 - Apply patch
7 - perl misc/cronjobs/edi_cron.pl
8 - Refresh the action logs screen
9 - Success! Start and end logged

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 18ffe25210)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:19 +01:00
Owen Leonard 91a17b82e7
Bug 40727: (alternate) Remove unnecessary .actions CSS
This patch takes an alternate approach of removing some CSS which isn't
strictly necessary. I think there was a time when the Bootstrap buttons
didn't come with their own margins and we needed to add it manually.

This change will slightly affect the margins of any buttons inside a
td.actions, but the default margin looks fine to me. Examples:

- Administration -> Patron categories
- Tools -> Notices and slips

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 22fa60828f)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:19 +01:00
Jonathan Druart 248335a655
Bug 42394: Fallback to {} if no userenv set
It fixes the following warnings:
  Can't use an undefined value as a HASH reference at /kohadevbox/koha/Koha/BackgroundJob.pm line 128

I started to add mock_userenv to all our tests that enqueue but finally
found a test in t/db_dependent/Koha/BackgroundJob.t that expect an
userenv not set
102     is( $job->borrowernumber, undef, 'No userenv, borrowernumber undef' );

So falling back to {} seems safe for now.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 49271d8d19)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:19 +01:00
Martin Renvoize ec6f3fe36e
Bug 42394: (QA follow-up) Clean up test
Remove unused $patron variable and add description string
to is_deeply assertion for TAP output readability.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1c89551270)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:19 +01:00
Jonathan Druart 4c50df1be8
Bug 42394: Shallow-copy userenv in BackgroundJob->enqueue
C4::Context->userenv returns a direct reference to the singleton
userenv hash. enqueue() was mutating this reference — deleting
session_id and adding an interface key — which corrupted the
session state for the remainder of the request.

See bug 40943 comment 32 for a detailed explanation of the issue.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 98ac202ddc)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:19 +01:00