Commit Graph

61233 Commits

Author SHA1 Message Date
Owen Leonard 04ca348222
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>
2026-04-17 09:18:15 -06:00
Andrew Fuerste Henry a60b4e8389
Bug 40255: (QA follow-up) Adjust test count
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:15 -06:00
Lucas Gass 5fc7fbbb21
Bug 40255: Allow scrubbed HTML to be used
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:14 -06:00
Lucas Gass 6b93327e6c
Bug 40255: Fixes for translations and updated unit tests
Signed-off-by: Scott Aylett <saylett@spanishfork.gov>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:14 -06:00
Lucas Gass 9a6a5a01f0
Bug 40255: (follow-up) Fix errors in letter.tt
Signed-off-by: Scott Aylett <saylett@spanishfork.gov>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:13 -06:00
Lucas Gass 7820875efe
Bug 40255: Unit test
Signed-off-by: Scott Aylett <saylett@spanishfork.gov>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:12 -06:00
Lucas Gass 1f1e0c677d
Bug 40255: Allow for custom debit descriptions
To test:

1. Apply patch, restart all
2. Go to debit types and click "Show all debit types" and pick a system defined debit type to test with. I worked mainly with ACCOUNT ( Account creation fee ) but we should test with as many debit types as possible
3. Note the account_debit_types.code you are working with
4. Now go to Tools > Notices and Slips and create a new notice
5. Choose the "Debit description (custom)" module as your module.
6. Use the code from step 2 and 3.
7. In the "email" part of the noctice add something like:
    $[% accountline.amount %] (includes $[% accountline.amount * 0.1 %] tax)

8. Now go to  Administration > Patron categories and configure a patron category to have a "Enrollment fee". ( I set mine to 100 )
9. Now create a patron in that category.
10. Once created, visit the accounting tab for that patron.
11. You should see a description like "$100.00 (includes $10.00 tax)"
12. Try with other debit types to ensure this works with all.

Signed-off-by: Scott Aylett <saylett@spanishfork.gov>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:12 -06:00
Lucas Gass aaf2959023
Bug 35267: DBRev 25.12.00.046
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:11 -06:00
Jonathan Druart a241b866ba
Bug 35267: Ignore style tags with TT tags
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:11 -06:00
Martin Renvoize 6f96128f5b
Bug 35267: (follow-up) Add POD coverage for private subroutines
Add POD documentation for private subroutines in C4/Letters.pm and
fix the POD heading for _type in Koha/Notice/Message.pm to satisfy
the pod_coverage QA check.

Also fixes a typo in the existing _add_attachments POD heading
(_add_attachements → _add_attachments).

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:10 -06:00
Thomas Klausner 329b0da16a
Bug 35267: (follow-up) Adapt atomicupdate to new DB schema
and add a missing newline

Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:10 -06:00
Martin Renvoize a1b7017588
Bug 35267: (follow-up) Fix PrintSlipCSS accordion and CSS in HTML output
- Add missing PrintSlipCSS accordion panel to the notice editor
- Pass AllNoticeCSS and PrintNoticeCSS to gather_print_notices.pl HTML output
- Include inline <style> blocks in print-notices.tt template

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:09 -06:00
Martin Renvoize eb357bcffa
Bug 35267: (follow-up) More comprehensive and db agnostic tests
This patch updates our unit tests to be more agnostic to prior database
state during testing by mocking more of the preferences.

We also add more tests to ensure we fully cover the new preferences and
their options.

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:09 -06:00
Martin Renvoize b6506f8e54
Bug 35267: (follow-up) Remove 'apply to all' from format
With the introduction of more granular global preferences for notice CSS
we no longer need the somewhat confusing per notice but apply to all
format checkbox. As suggested by Lucas, this patch removes that option.

This is safe to remove at this stage as the feature in question isn't
really working given the second bug implimenting most of the
functionality to expose it is still in the queue.

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:08 -06:00
Martin Renvoize 308fdcec48
Bug 35267: (follow-up) Add explanatory note to CSS displays
This patch adds a simple explanatory note to each of the Notice CSS
display options in the notices template editor page

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:08 -06:00
Martin Renvoize 732667d5f3
Bug 35267: Update unit tests
This patch simply updates the existing unit tests to rename NoticeCSS to
AllNoticesStylesheet as per the rest of the patchset.

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:07 -06:00
Martin Renvoize 38dcf70e5c
Bug 35267: Migrate accounts_summary to printslip
This patch migrates the 'slip' printing for the ACCOUNTS_SUMMARY slip to
circ/printslip as this is a slip rather than a notice.

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:07 -06:00
Martin Renvoize ca0195e448
Bug 35267: Move JS to bottom in printslip
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 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