Commit Graph

61215 Commits

Author SHA1 Message Date
Martin Renvoize 49651ddaf0
Bug 35267: Apply preferences to preview and mailing
This patch applies the new style preferences to the preview display and
email sending code.

Sponsored-by: Open Fifth <https://openfifth.co.uk>
Signed-off-by: Marion Durand <marion.durand@biblibre.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:06 -06:00
Martin Renvoize 74d008d01e
Bug 35267: Expose style preferences in template editor
Sponsored-by: Open Fifth <https://openfifth.co.uk>
Signed-off-by: Marion Durand <marion.durand@biblibre.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:05 -06:00
Martin Renvoize 59709ecc19
Bug 35267: Add preferences to UI
Sponsored-by: Open Fifth <https://openfifth.co.uk>
Signed-off-by: Marion Durand <marion.durand@biblibre.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:05 -06:00
Martin Renvoize c1314fd57b
Bug 35267: Add and Update Notice CSS system preferences
This patch clarifies the system level notice css preferences.

We rename NoticeCSS to EmailNoticeStylesheet
We rename SlipCSS to PrintSlipStylesheet
We add AllNoticeStylesheet
We add AllNoticeCSS to contain inline CSS for all html notices
We add EmailNoticeCSS to contain inline CSS for Email notices
We add PrintNoticeCSS to contain inline CSS for Print notices
We add PrintSlipCSS to contain inline CSS for Print slips

Sponsored-by: Open Fifth <https://openfifth.co.uk>
Signed-off-by: Marion Durand <marion.durand@biblibre.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:04 -06:00
Martin Renvoize f20428ab1f
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>
2026-04-17 09:18:04 -06:00
David Cook 70ff8dd1b4
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>
2026-04-17 09:18:03 -06:00
Emily Lamancusa 29caec496b
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>
2026-04-17 09:18:03 -06:00
Nick Clemens 18ffe25210
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>
2026-04-17 09:18:02 -06:00
Owen Leonard 22fa60828f
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>
2026-04-17 09:18:02 -06:00
Jonathan Druart cb04b4c691
Bug 42288: Tidy all script tags - reserve (auto tidy)
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:01 -06:00
Jonathan Druart 0d48e33728
Bug 42288: Tidy all script tags - reserve
In order to tidy all the script tags of the .tt files we isolate the
interpolation of Template::Toolkit variables in a separate script tag.

This patch focuses on the reserve/hold module.

The changes are trivial but make sure there is no JS errors/warnings in
the console when placing a hold on an item. Also the table settings need
to be taken into account.

Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:01 -06:00
Jonathan Druart c5a34818de
Bug 41653: Move addPrefs and addPermissions under the Koha namespace
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:00 -06:00
Jonathan Druart 49271d8d19
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>
2026-04-17 09:18:00 -06:00
Martin Renvoize 1c89551270
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>
2026-04-17 09:17:59 -06:00
Jonathan Druart 98ac202ddc
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>
2026-04-17 09:17:59 -06:00
Jonathan Druart 5cef972961
Bug 42394: Add regression test for userenv mutation during enqueue
Verifies that BackgroundJob->enqueue() does not mutate the
C4::Context userenv hashref as a side-effect.

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>
2026-04-17 09:17:58 -06:00
Jonathan Druart 5288847641
Bug 38136: Clear localization cache before testing itemtype localization
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:17:58 -06:00
Lucas Gass 6e2554c35f
Bug 38136: (follow-up) Add property to Localization call in t/db_dependent/api/v1/items.t
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:17:51 -06:00
Pedro Amorim 5040517ce1
Bug 41955: Show hold group id in OPAC holds history
Test plan:
1) Enable DisplayAddHoldGroups and OPACHoldsHistory sys prefs
2) Go to 'koha' user and click 'Search to hold':
<staff_url>/cgi-bin/koha/members/moremember.pl?borrowernumber=51
3) Search for 'test' and click the top 'Select all' link
4) Click the downward arrow in the 'Place hold' button and pick 'Place hold for Henry'
5) Set a pickup location for each hold and tick the 'Treat as hold group' checkbox
6) Click 'Place holds'.
7) Check-out an eligible barcode e.g.: 39999000005578 to Henry
8) Login on the OPAC as 'koha' user and visit holds history:
<opac_url>/cgi-bin/koha/opac-holdshistory.pl
9) Confirm that a new 'Hold group ID' column exists.
10) Disable DisplayAddHoldsGroups sys prefs. Confirm table looks as expected without the column.

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:13 -06:00
Pedro Amorim c084a3141a
Bug 41954: Display historic group hold ID in patron holds history table
Test plan:
1) Enable DisplayAddHoldGroups sys prefs
2) Go to 'Henry' and click 'Search to hold':
<staff_url>/cgi-bin/koha/members/moremember.pl?borrowernumber=19
3) Search for 'test' and click the top 'Select all' link
4) Click the downward arrow in the 'Place hold' button and pick 'Place hold for Henry'
5) Set a pickup location for each hold and tick the 'Treat as hold group' checkbox
6) Click 'Place holds'.
7) Check-out an eligible barcode e.g.: 39999000005578 to Henry
8) Visit Henry's holds history:
<staff_url>/cgi-bin/koha/members/holdshistory.pl?borrowernumber=19
9) Confirm that a new 'Hold group ID' column exists.
10) Disable DisplayAddHoldsGroups sys prefs. Confirm table looks as expected without the column.

Run all hold groups tests:
prove t/db_dependent/Koha/Patron.t
prove t/db_dependent/api/v1/patrons_hold_groups.t
prove t/db_dependent/Koha/Hold.t
prove t/db_dependent/Reserves/HoldGroup.t

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:12 -06:00
Pedro Amorim 7d574453ee
Bug 41954: Preparation: No longer delete 'empty' hold groups
Hold groups are now only deleted if no holds or old_holds are attached at the moment of cleanup

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:12 -06:00
Pedro Amorim fd4fa7c2d1
Bug 41954: Update existing tests
The logical behavior is different. Hold groups are now meant to be kept for historical reasons

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:11 -06:00
Pedro Amorim b0bb216310
Bug 41247: (QA follow-up): Improve uninstalling plugin
Ensure uninstalling works for the correct plugin if multiple plugins are installed

cypress run --spec t/cypress/integration/ILL/Batches_spec.ts

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:11 -06:00
Pedro Amorim 3c3ff65ab5
Bug 41247: (QA follow-up): Update cypress test
This cleans up the now removed XML changes and improves the clean-up process to only delete the illbatches created during testing as well as uninstalling the plugin through the UI instead of all plugins through a database query

The original XML based implementation is no longer relevant as plugins_restricted is now default 0 in ktd.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:10 -06:00
Pedro Amorim f1059643ab
Bug 41247: Add cypress tests
Apply just the 2 cypress tests patches, run:
cypress run --spec t/cypress/integration/ILL/Batches_spec.ts

Notice it fails.
Apply the fix patch. Repeat the command above. Tests must pass.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:10 -06:00
Pedro Amorim e94cede03f
Bug 41247: Improve ILL batches modal resetability
Test plan, preparation:
A) Enable ILLModule
B) Install a metadata enrichment plugin, e.g:
https://github.com/openfifth/koha-plugin-api-pubmed/releases/tag/1.1.1
C) Restart plack to pick up the newly installed plugin if needed.
D) Create a new batch, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?

Issue #1:
1.1) Click 'New ILL requests batch'
1.2) Enter a name, '42' on the cardnumber and any library. Click 'Continue'.
1.3) Click the 'Close' button (or click anywhere outside the modal) to close the modal.
1.4) Repeat 1.1). Notice the 'Continue' button is no longer there.

Issue #2:
2.1) Click 'New ILL requests batch'
2.2) Enter a name, '42' on the cardnumber and any library. Click 'Continue'.
2.3) Enter '123' on the textarea, click 'Process identifiers'.
2.4) Notice a 'Add items to batch' buttons appears. Don't click that, as before, close the modal.
2.5) Repeat 2.1) Notice the progress bar shows right off the bat (it shouldn't) with NaN as its value as well as table elements (export button, 'No entries to show' message, etc, with no table.

Apply patch, hard-refresh the browser and repeat Issues 1 and 2. Confirm the patch fixes them.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:09 -06:00
Martin Renvoize fc6e5839d4
Bug 42221: Fix EAN-13 autoBarcode not incrementing
The EAN-13 barcode query used max(abs(barcode)) which allowed non-EAN-13
barcodes (e.g. 14-digit KTD sample barcodes) to dominate the result.
The saved 13-digit EAN-13 barcodes were always smaller, so $nextnum
never advanced and the same barcode was generated on every page load.

Fix by extracting EAN-13 logic into C4::Barcodes::ValueBuilder::EAN13
(consistent with other barcode type packages) and scoping the query to
WHERE length(barcode) = 13 so only valid-length barcodes contribute to
the max. Both barcode.pl and Koha::REST::V1::Biblios now call the shared
function, eliminating the duplicated inline code.

Tests: adds EAN-13 test cases to t/db_dependent/Barcodes_ValueBuilder.t
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:09 -06:00
Martin Renvoize 757526cbde
Bug 42085: Slim down members/member-flags.pl cud-newflags block
Replace the raw-DBI permission write block (~62 lines) with a call to
$patron->set_permissions(\%granted). Logging and the superlibrarian
guard are now handled inside the object method.

The CGI layer now only parses the flag params into a granted hashref
and delegates — keeping the controller thin and the logic testable.

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-16 15:54:08 -06:00
Martin Renvoize d8062a1fe6
Bug 42085: Log patron permissions in MEMBERS/DELETE action log
When BorrowersLog is enabled, Koha::Patron::delete() now captures the
patron's granted permissions before deletion and includes them in the
MEMBERS/DELETE log entry.

Patrons with no granted permissions produce no permissions key in the
log. Patrons with permissions will show them as removed in the diff
viewer, consistent with all other fields in the DELETE diff.

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-16 15:54:08 -06:00
Martin Renvoize e32a108427
Bug 42085: Add Koha::Patron::set_permissions method
This new method moves the permissions write logic out of the CGI
controller and into Koha::Patron, making it testable and reusable.

Behaviour:
- Accepts a hashref of granted permissions only (matches the non-zero
  subset of permissions() return value)
- Computes the borrowers.flags bitmask from the userflags table
- Replaces user_permissions rows atomically inside a txn_do block
- Applies a session-aware superlibrarian guard when
  ProtectSuperlibrarianPrivileges is enabled
- Logs a MEMBERS/MODIFY action when permissions change and BorrowersLog
  is enabled, diffing before/after states

Tests added to t/db_dependent/Koha/Patrons.t.

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-16 15:54:07 -06:00
Ayoub Glizi-Vicioso 0c2ef0e6b4
Bug 41967: Ensure --cards argument accepts an integer in cleanup_database.pl
Test plan (for --cards arguments) :

1. Initial Setup:
    a) Go to Tools > Patron card creator > New > Card batch
    b) Create two different batches (Batch 1 and Batch 2) using the 'Add by borrowernumber(s):' option.
        If using **KTD** you can use the following borrowernumbers for both batches:
            15
            29
            47
        else you will need to create your own patrons and enter their borrowernumber.
    c) In your terminal, set the timestamps manually:
        --OPTION A (KTD users):
            ktd --shell
            koha-mysql kohadev

        --OPTION B:
            Access your database

        Then:
            UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1';
            UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2';

    Note: your batch_id may differ.

2. Before Applying the Patch:
    a) Run the following cleanup script:
        ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose
    b) Error in console output
    c) Nothing is deleted even though one batch was older than 15 days
        SELECT * FROM creator_batches;

3. Apply The Patch

4. After Applying The Patch:
    a) Redo step 1 (Initial Setup).
    b) Run again the following cleanup script:
        ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose
    c) Check that the console output says: "Purging ... more than 15 days ago"
    d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success!
        SELECT * FROM creator_batches;

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:07 -06:00
Ayoub Glizi-Vicioso 9e05ca0e19
Bug 41967: Ensure --labels argument accepts an integer in cleanup_database.pl
Test plan :

1. Initial Setup:
    a) Go to Cataloging > Label creator > New > Label batch
    b) Create two different batches (Batch 1 and Batch 2) using the 'Add by barcodes or itemnumbers' option.
        If using **KTD** you can use those barcodes for the two batches:
            39999000010114
            39999000010138
            39999000010152
        else you will need to create your own records with items and enter their barcodes.
    c) In your terminal (in a ktd --shell), set the timestamps manually:
        --OPTION A (KTD users):
            ktd --shell
            koha-mysql kohadev

        --OPTION B:
            Access your database

        Then:
            UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1';
            UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2';

    Note: your batch_id may differ.

2. Before Applying the Patch:
    a) Run the following cleanup script:
        ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose
    b) Check that the console output says: "Purging ... more than 1 days ago"
    c) Check database and notice that it is now empty, even though one set was less than 15 days old.
        SELECT * FROM creator_batches;

3. Apply The Patch

4. After Applying The Patch:
    a) Redo step 1 (Initial Setup).
    b) Run again the following cleanup script:
        ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose
    c) Check that the console output says: "Purging ... more than 15 days ago"
    d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success!
        SELECT * FROM creator_batches;

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:06 -06:00
Johanna Räisä ae3fd5591f
Bug 42343: Prevent holds JS error when no holds exist
In the holds view, opening a record with no existing holds can leave
holdsQueueTable undefined while follow-up code still calls api() on it.

This triggers a Firefox console error:

  Uncaught (in promise) TypeError: can't access property "api", holdsQueueTable is undefined

Test plan:
1. Navigate to a title that has no existing holds.
2. Confirm no holdsQueueTable undefined error is logged.
3. Navigate to a title that has existing holds.
4. Confirm the holds queue still loads normally.
5. Confirm hold actions that refresh the queue still work as expected.

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:06 -06:00
Lucas Gass d71a40dc9d
Bug 42353: (follow-up) Add .nvmrc to Makefile
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:05 -06:00
Lucas Gass e86c33edd0
Bug 17387: (RM follow-up) Make Permissions.t tests pass
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:53:58 -06:00
Kyle M Hall 14b478bde7
Bug 39164: (QA follow-up) Add setting to koha conf files
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:33 -06:00
Mark Hofstetter 07ee120d50
Bug 39164: Add max_statement_time to SQL report queries
Reports may consume too much resources of the db. To avoid that a new config param
'report_sql_max_statement_time_seconds' was created, which sets the maximum time a report statement may
take to execute in seconds. If it takes longer it will be aborted.

reflowed the code, so that is is executed after is_sql_valid, and put
the code in a subroutine

Test plan:
0. if you run this test in ktd you should check if you are running
   mysql or mariadb, and then be able to switch database
1. create a new report by going to
More > Reports > New SQL Report
(/cgi-bin/koha/reports/guided_reports.pl?op=add_form_sql)

enter the following SQL (which only purpose is to run long)

select ExtractValue(bm1.metadata,'//controlfield[@tag="001"]')
  from biblio_metadata bm1
  join biblio_metadata bm2 on
    ExtractValue(bm1.metadata,'//controlfield[@tag="001"]') =
    ExtractValue(bm2.metadata,'//datafield[@tag="773"]/subfield[@code="w"]')

give the Report a name eg "extract_long"
2. run the report
3. report should be executed and return several 1000 lines on ktd
4. apply patch
5. add a the parameter to koha-conf.xml to the <config> </config> part
<report_sql_max_statement_time_seconds>0.001</report_sql_max_statement_time_seconds>

OR use the following statemtn
sed -i '/<biblioserver>/a <report_sql_max_statement_time_seconds>0.001<\/report_sql_max_statement_time_seconds>' /etc/koha/sites/kohadev/koha-conf.xml
6. restart koha
    koha-plack --restart kohadev
7. go back to the report page and rerun report which now should lead to an error
The following error was encountered:
The database returned the following error:
Query execution was interrupted, maximum statement execution time exceeded
Please check the log for further details.
8. in koha-conf.xml set
<report_sql_max_statement_time_seconds>20</report_sql_max_statement_time_seconds>
9. restart koha
10. rerun query, which now should execute as before
11. stop ktd, and restart with the "other" database

DB_IMAGE=mysql:8.0 ktd up
DB_IMAGE=mariadb:10.5 ktd up

12. repeat from step 1 (omit applying the patch)
13. Sign off
14. Thx

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:33 -06:00
Kyle M Hall c6ef3094ca
Bug 41440: Fix bug revealed by unit test
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:32 -06:00
Kyle M Hall 07c37c10c4
Bug 41440: (QA follow-up) Add unit tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:32 -06:00
Nick Clemens 365770c396
Bug 41440: (QA follow-up) Handle undef "script"
This silences warnings about undefinved values in the cache key

This seems to come from some calls in _build_languages_arrayref where we might not
have all variants of a language - the call could be prevented, but I am not sure
what the effects would be, so I simply convert undef (null value) to "undef" (string)
and use that as the cache key

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:31 -06:00
Nick Clemens 694765da2f
Bug 41440: Add caching to language_get_description and get_rfc4646_from_iso639
This should have no visible effect, just internal caching

To test:
1 - Do a search, check the language facets
2 - Apply patch, restart all
3 - Do a search, check the language facets
4 - No change
5 - Sign off

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:31 -06:00
Laura_Escamilla 2e218dcb69
Bug 42165: Add search landmark role to OPAC masthead search form
Test plan:
1. Apply the patch
2. Load the OPAC main page (opac-main.pl)
3. Inspect the search form
   → Confirm role="search" is present
4. Use a screen reader (or browser accessibility tree)
   → Verify a "search" landmark is announced
5. Ensure only one search landmark is present on the page
6. Perform a catalog search
   → Confirm search functionality is unchanged

Signed-off-by: Laura Woodward <lwoodard@artsbma.org>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:30 -06:00
Lucas Gass 4201fdfe2c
Bug 17387: DBRev 25.12.00.045
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:30 -06:00
Nick Clemens 1084dbcf33
Bug 17387: (QA follow-up) Add nonce to remaining script tag
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:29 -06:00
Jacob O'Mara 5868f784c7
Bug 17387: (follow-up) move js to dedicated file as per coding guidelines
Also amend _ to __ for translatable strings

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:29 -06:00
Jacob O'Mara 65fa5cb43e
Bug 17387: (follow-up) make deleted_on column searchable
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:28 -06:00
Jacob O'Mara b6eeffb79f
Bug 17387: (follow-up) fix embed items on get deleted biblio
Add x-koha-embed parameter to GET /deleted/biblios/{biblio_id} and use
$c->objects->to_api() to properly handle embedding items.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:28 -06:00
Martin Renvoize 8681b48fdb
Bug 17387: (follow-up) move records_restore under editcatalogue permission
The restore functionality is a cataloguing operation and should live
under the editcatalogue permission module (bit 9) rather than tools
(bit 13), consistent with where it appears in the UI.

Update all references:
- userpermissions.sql and atomicupdate: module_bit 13 → 9
- Swagger x-koha-authorization: tools → editcatalogue
- CGI flagsrequired: tools → editcatalogue
- Templates: CAN_user_tools_records_restore → CAN_user_editcatalogue_records_restore
- C4::Auth::get_cataloguing_page_permissions: remove from tools
  sub-perms list (editcatalogue '*' already covers it)
- Tests: module_bit 13 → 9

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:27 -06:00
Martin Renvoize 06f4abbf9a
Bug 17387: (follow-up) address review feedback
- Fix permission description to explicitly mention bibliographic records
  and items (not just 'records')
- Fix date filter to use correct DB column per table: deletedbiblio uses
  'timestamp', deleteditems uses 'deleted_on'
- Remove leftover CAN_user_editcatalogue_edit_catalogue condition from
  the Batch editing section in cat-menu.inc; a user with only
  edit_catalogue would see an empty section heading
- Wrap biblio and item restore operations in DB transactions so that a
  failed store cannot leave a record inserted without being removed from
  the deleted table (or vice-versa)
- Catch Koha::Exceptions::Object::DuplicateID in the item restore
  controller and return a human-readable 409 instead of a generic 500
- When 'Restore bibliographic record' is clicked in the deleted-bib
  warning modal, fetch the biblio and open the full restore modal with
  the originally clicked item pre-selected, rather than restoring
  immediately without item selection

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:27 -06:00
Jacob O'Mara 3a83da117e
Bug 17387: (follow-up) restore tests should account for new library groups checks
Signed-off-by: Michaela <michaela.sieber@kit.edu>
Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:26 -06:00