Commit Graph

58899 Commits

Author SHA1 Message Date
Jonathan Druart e09bf7deed
Bug 41065: (bug 38714 follow-up) Show batch patron modification results
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 73dac4c5cc)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:39 +01:00
Jonathan Druart ea84926d84
Bug 41065: (bug 26553 follow-up) Remove JS error when submitting the form
Uncaught TypeError: patron_table.$ is not a function

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ea123185b9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:38 +01:00
Jonathan Druart e1aa995904
Bug 40743: Fix description of inactive budget
Without this patch it's always "{budget_description} (Inactive)"

Signed-off-by: Aleisha Amohia <aleisha@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e057c02ca3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:38 +01:00
Laura_Escamilla ef71229f97
Bug 40743: Make active funds visible again
To test:

1. Create a basket and add an item to the order. Close the basket.
2. Receive shipment. Create an invoice.
3. Go to the invoice and then go to the receipt page.
4. Receive the item you had added to your basket. Under Fund you will only see “Keep current (your budget name)”. Active budgets are not visible.
5. Click on “Show inactive” — both inactive and active budgets become visible.
6. Apply the patch. Restart all.
7. Repeat step 3 and 4. Notice now that the active budgets are visible under your Fund dropdown. On this step you can create an inactive budget / fund if you don’t have one set already. Next click on “Show inactive” and notice that the active fund is active, and the inactive fund has a budget_description of inactive.
8. Test to make sure budgets stick.
9. Sign off and have a wonderful day!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleisha@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1d2fc5133d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:37 +01:00
Nick Clemens 75af2efd77
Bug 41071: Fix missing space in cash register classes
It seems we dropped a space somewhere so the class for default registers had become:
   "{Branchcode}default" instead of "{Branchcode} default"
This broke the JS for selecting

To test:
1 - Enable UseCashRegisters system preference
2 - Create three registers for three different branches
3 - Make each register the default
4 - Click on username in top right
5 - Select 'Set library and cash register'
6 - Choose on of the three branches
7 - Note the dropdown does not populate with the default
8 - Note no registers can be selected
9 - Apply patch
10 - Reload the page
11 - Change libraries and verify all works as expected

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 301ec5dae2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:37 +01:00
Nick Clemens 0ca35af93a
Bug 41074: Don't reverse previous_patrons arrary
This patch alters the code to append instead of prepend, removing the need to reverse the list

To test:
1 - Write a report to get some patron
SELECT cardnumber,surname FROM borrowers WHERE cardnumber <>'' ORDER BY rand() LIMit 6
2 - Enabled 'showLastPatron' and set count to 3
    http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=showLastPatron
3 - Copy the barcodes in order from the report and search for them in patron search, you'll want two tabs so you can keep report open
4 - Notice at 4th patron that list order has changed
5 - When 5th patron is loaded, the 4th is removed from the list
6 - Apply patch
7 - Clear the list
8 - Repeat the test plan, but note that list order does not change
9 - Confirm the patrons are removed from the list in expected order when adding new
10 - Change the count to 1 and search for several patrons, ensuring the last patron link is always correct

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f689133aaf)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:36 +01:00
Pedro Amorim c49069606b
Bug 41057: Return 404 if creating backend is not an OPAC backend
Test plan, ktd:
1) Enable ILLModule
2) Install an additional backend plugin e.g. 'RapidILL':
  https://github.com/openfifth/koha-ill-rapidill/releases/tag/v2.2.5
3) Restart plack if you have to:
$ koha-plack --restart kohadev
4) Edit the ILLOpacbackends system preference to just 'Standard'.
5) Now, attempt to create a request with the installed backend directly:
  <opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=RapidILL
6) Notice the form is shown. It shouldn't be, as the only OPAC back is Standard.
7) Apply patch. Repeat. You get a 404.

Signed-off-by: Nial Halford-Busby <n.halford-busby@lboro.ac.uk>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 2d063d00d5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:36 +01:00
Jonathan Druart f31a643ff0
Bug 41042: default_save_state is enabled by default
If 'default_save_state' is not in the yaml file then the feature is
enabled by default.

Caught by the following failure:
t/db_dependent/selenium/patrons_search.t ..
        #   Failed test 'Search works when category of patrons is limited to a library we are not signed in at'
        #   at t/db_dependent/selenium/patrons_search.t line 471.
        #          got: 'Showing 1 to 5 of 26 entries (filtered from 82 total entries)'
        #     expected: 'Showing 1 to 15 of 26 entries (filtered from 82 total entries)'
        # Looks like you failed 1 test of 1.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit eba0060286)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:36 +01:00
Lucas Gass fb29ac4205
Bug 40969: Mock the RenewalPeriodBase preference correctly
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 412879a418)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:35 +01:00
Jonathan Druart 82a10f632d
Bug 40470: Fix filtering by REPORT_GROUP when auth val is numeric
When the authorised value of a REPORT_GROUP is numeric the filtering
does not work.

Test plan:
Create a new REPORT_GROUP av "123" (the description can be alphanumeric)
Create a new report and assign it to this new group
Confirm that with this patch the filtering works when the "123" tab is
selected

Signed-off-by: George <george@nekls.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit bed343d5ed)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:35 +01:00
Jonathan Druart c338abe8c3
Bug 40907: Prevent DT crash when searching with regex metachars
We should remove the regex metacharacters from the string or JS code
will raise an error and the query won't be generated, leading to the DT
neverending loading problem.

Test plan:
Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=4
In the global "Search" of the items table, search using a regex
metacharacters in order to form a broken regex (eg. '[')
=> Without this patch there is a JS error in the console "Uncaught
SyntaxError: unterminated character class" and you get the "Processing"
that never ends
=> With this patch applied the search succeeds.

Signed-off-by: Mathieu <mathsabypro@gmail.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0f6f5ab252)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:34 +01:00
Jonathan Druart 000ba6efdd
Bug 40907: Add a Cypress test
Signed-off-by: Mathieu <mathsabypro@gmail.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7c4c013645)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:34 +01:00
Jonathan Druart 1d24623414
Bug 40931: (bug 39533 follow-up) More specific max-width CSS rule to prevent side-effects
The changes made on bug 39533 for the export page have affected other
instance of select2.
eg. on the "place holds" view the select2 elements are too narrow.

This patch suggests to reduce the elements on which the CSS rule
'max-width: 60%' is applied.

Test plan:
Confirm that this patch does not affect the display of the select2
elements on the export and item edition pages.

Confirm that the pickup locations are wider (and their values are
displayed) when placing multi holds

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 353508cf0b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:33 +01:00
Jonathan Druart 37ca2fb91c
Bug 40939: Fix batch actions from report results
Batch patron operations are broken when using cardnumbers

From
  commit d659526b5a
  Bug 38664: Tidy the whole codebase

-                                                [%- IF header_row.$place.cell == batch_type || header_types.item(header_row.$place.cell) == batch_type %]
-[%# We must not add whitespace to the cardnumbers %][% cells.cell | html %]
+                                            [%- IF header_row.$place.cell == batch_type || header_types.item(header_row.$place.cell) == batch_type %]
+                                                [%# We must not add whitespace to the cardnumbers %][% cells.cell | html %]

The auto tidy added the whitespaces back

This patch suggests to use TT to add the new lines.

+                                                [%- cells.cell | html -%][% "\n" | $raw %][%# We want 1 item per line, without whitespace %]

Test plan:
- save and run "SELECT cardnumber FROM borrowers"
- use the Batch Operations button to send all visible cardnumbers to batch patron modification
- see that all of your cardnumbers have been found

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d79cf5665d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:33 +01:00
Jonathan Druart 17fb36122c
Bug 40982: Add Cypress tests
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a9ffa8b64a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:33 +01:00
Jonathan Druart b564610152
Bug 40982: Enable bKohaColumnsUseNames for libraries
We want to add Cypress test for the force_visibility flag.
We do not test the basket table: the acq module will be rewritten

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c7a7fdde08)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:32 +01:00
Jonathan Druart fcd3747a37
Bug 40982: Do not raise Error when bKohaColumnsUseNames is not set
Return early if there is no visibility to force

Signed-off-by: Slava Shishkin <slavashishkin@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ad906a523a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:32 +01:00
Jonathan Druart 355fe514b5
Bug 40982: Remove cannot_be_toggled for modify and cancel
It's already set in the global config.

However it does make sense to have it for supplier_report: you don't
want to show it in the dropdown if the pref is off

Signed-off-by: Slava Shishkin <slavashishkin@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1ffa8aa6dd)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:31 +01:00
Jonathan Druart 7e95ca32da
Bug 40982: Allow to force visibility when needed
The _dt_visibility function is only called when the state is
initialized. Here we want to force the visibility of some columns even
if the state exists already.

The idea of this patch is to add a new 'force_visibility' flag to the
column when the visibility needs to be respected regardless what is in
the state. That should only be used when column cannot be toggled.

Signed-off-by: Slava Shishkin <slavashishkin@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 41b531b315)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:31 +01:00
Jonathan Druart 4cb9637be2
Bug 40982: (bug 40753 follow-up) Adjust conditions
The IF/ELSE block contents have been reversed in the JS code.

Signed-off-by: Slava Shishkin <slavashishkin@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3429bbfa12)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:31 +01:00
Jonathan Druart 61edabe2cb
Bug 41042: Make 'default sort order' available to new installations
If a row exists in DB for a given table, default_sort_order will be NULL
in DB which will replace the flag from the YAML file: the feature won't
be available.

Test plan:
0. checkout main (we don't want bug 30633)
1. Go to http://localhost:8081/cgi-bin/koha/admin/columns_settings.pl#biblio-detail%7Choldingst
=> Notice that "Default sort order" is not available for 'holdingst'
(it's added by bug 30633)
2. Save
3. Verify what you have in DB:
select * from tables_settings where module="opac" and tablename="holdingst";
4. Apply 30633, restart_all
5. Go to http://localhost:8081/cgi-bin/koha/admin/columns_settings.pl#biblio-detail%7Choldingst
=> Notice that "Default sort order" is not available for 'holdingst' (not ok)
6. Save
7. Verify what you have in DB:
select * from tables_settings where module="opac" and tablename="holdingst";
8. Apply this patch set
9. Go to http://localhost:8081/cgi-bin/koha/admin/columns_settings.pl#biblio-detail%7Choldingst
=> Notice that "Default sort order" is available for 'holdingst'!
10. Save, verify what you have in DB.

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit de27044ba2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:30 +01:00
Jonathan Druart 2dd504715a
Bug 41042: Simplify tests
No change here.

Test plan:
Apply only this patch and confirm that the tests are still passing.
The previous code was dynamic but complicated to adjust. The next patch
needs more complex and specific comparisons.

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 71553c5803)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:30 +01:00
Andrew Fuerste Henry 8c8128a7ba
Bug 40937: Include show data menu button for batch_borrowernumbers
To test:
1 - save and run a report of "SELECT borrowernumber FROM borrowers"
2 - observe your results page does not include the Show Data Menu button
3 - save and run a report of "SELECT cardnumber FROM borrowers"
4 - observe your results page does include the button
5 - save and run a report of "SELECT borrowernumber, cardnumber FROM borrowers"
6 - observe you are once again buttonless on the results page
7 - apply patch
8 - run your report from step 1, observe you now have the button
9 - run your report from step 3, observe you still have the button
10 - run your report from step 5, observe you now have the button
11 - confirm that the batch actions dropdown only includes the patron actions once

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5e5ffeea82)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:29 +01:00
Jonathan Druart 25f9243304
Bug 41010: Adjust show_priority condition in opac-detail
We had
[% IF item_level_holds > 0 || show_priority %]
[% ELSIF show_priority %]

We never reach ELSIF.

I am not sure what's the correct fix here. People involved on bug 39276
should help.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5d770843f3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:29 +01:00
Nick Clemens 251f394413
Bug 40997: Remove uneccessary whitespace
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 605cc89893)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:28 +01:00
Nick Clemens e579b8a15a
Bug 40997: Don't check elements that have been removed
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a7be3a3f8b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:28 +01:00
Jonathan Druart 9c0d13b39b
Bug 40041: Remove duplicated or unecessary entries
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 01c2e93a5d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:28 +01:00
Tomás Cohen Arazi 57f02a13b2
Bug 40041: Reorganize and fix .mailmap file
- Group same-person entries together for better maintainability
- Normalize excessive whitespace padding that breaks terminal tools like tig
- Add column alignment with second column at position 65 for readability
- Move all sponsor entries to bottom of file
- Add missing canonical name mappings for unmapped emails:
  * Matt Blenkinsop, Andrew Auld, Colin Campbell variations
  * Mathieu Saby email/username mappings
- Remove malformed entry (Alex Arnaud = <=>)
- Fix Colin Campbell canonical mapping to OpenFifth email

This improves .mailmap functionality in both newer git versions
and older versions like those in KTD (git 2.39.5).

To test:
1. Run:
   $ ktd --shell
  k$ for i in colin.campbell@openfifth.co.uk chloe.zermatten@openfifth.co.uk martin.renvoize@openfifth.co.uk aude.charillon@openfifth.co.uk andrew.isherwood@ptfs-europe.com matt.blenkinsop@openfifth.co.uk matt.blenkinsip@ptfs-europe.com matt.blenkinsop@ptfs-europe.com andrew.auld@ptfs-europe.com pedro.amorim@ptfs-europe.com msaby mathsabypro@gmail.com marjorie.barry-vila@collecto.ca andrew.auld@openfifth.co.uk catrina@bywatersolutions.com felicie.thiery@biblibre.com janne.seppanen@lahti.fi jesse@bywatersolutions.com kelly@bywatersolutions.com laurence.rault@biblibre.com samalau@gmail.com ; do git check-mailmap -- "<$i>" ; done
=> FAIL: Don't look like canonical email entries
2. Apply this patches
3. Repeat 1
=> SUCCESS: They look great!
4. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 357558d954)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:27 +01:00
Tomás Cohen Arazi 52b59aa736
Bug 40041: Fix structurally incorrect .mailmap entries
This patch fixes malformed entries in .mailmap that were causing
display issues and incorrect author mapping.

Issues fixed:
- Marjorie Barry-Vila: Missing closing '>' in email address
- Mathieu Saby: Incorrect alias format instead of proper mailmap format
  (was using excessive padding with alias, now uses proper
   'Name <email> OldName <email>' format)

These structural issues were breaking terminal display in tools like
tig and preventing proper author consolidation.

Test plan:
1. Apply patch
2. Run: git log --oneline | head -20
=> SUCCESS: Authors display correctly
3. Check in tig or other git tools
=> SUCCESS: No excessive column width issues
4. Verify mailmap functionality:
   git shortlog -sn | grep -E 'Mathieu|Marjorie'
=> SUCCESS: Authors properly consolidated
5. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6c3153a481)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:27 +01:00
Tomás Cohen Arazi 1ad044b981
Bug 40959: Fix LOC classification display (staff interface)
This patch fixes the display logic for the LOC classification field
(050).

The current issue is that the inner components (each subfield) gets
separated with the pipe symbol (|) instead of grouping the components
together and using the separator for the outer 050 occurences.

To test:
1. Open a record to edit it
2. Add 050 like this:

```
050  4 $aE337.5 $b.O54 2025
050  4 $aE415.7 $b.A44 2025
```

3. Save
=> FAIL On the staff interface it displays:

```
LOC classification: E337.5 | .O54 2025 E415.7 | .A44 2025
```

4. Apply this patch
5. Run:
   $ ktd --shell
  k$ restart_all
6. Reload the detail page
=> SUCCESS: Things display correctly!
7. Sign off :-D

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d2d85c9f4a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:26 +01:00
Paul Derscheid 3200bc9301
Bug 40936: DBRev 25.05.04.001
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:26 +01:00
Kyle M Hall b8fa49bb73
Bug 40936: Add index for default patron sort order
The default sort order for Koha's patron search includes many columns, some of which are not indexed:

[% CASE 'name-address' %] {
"data":"me.surname:me.preferred_name:me.firstname:me.middle_name:me.othernames:me.street_number:me.address:me.address2:me.city:me.state:me.postal_code:me.country",

Depending on the number of patrons in the database, and the specific configuration of the server, this can end up generating a query that creates a temp table in the hundreds of gigabytes of data or more. Not only does this risk crashing a database server with insufficient disk space, it's also incredibly slow.

We've found a compound index prevents the issue and also makes the search much faster. InndoDB indexes have a fixed maximum length which is too small ( 3072 bytes ) to encompass the full data for all the fields we need to sort by.

The following works well as a comprise to keep the index length within the maximum:
CREATE INDEX idx_borrowers_sort_order ON borrowers (
    surname(100),        -- 400
    preferred_name(80),  -- 320
    firstname(80),       -- 320
    middle_name(50),     -- 200
    othernames(50),      -- 200
    streetnumber(20),    -- 80
    address(100),        -- 400
    address2(75),        -- 300
    city(75),            -- 300
    state(40),           -- 160
    zipcode(20),         -- 80
    country(40)          -- 160
);

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Perform a patron search
4) No change in behvior should be noted!

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 63c44cbd0e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:26 +01:00
Martin Renvoize 754820b8ef
Bug 39408: (QA follow-up) Add unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ef5ba9a42d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:25 +01:00
Nick Clemens 91da4b4b38
Bug 39408: Don't attempt to send a message if one is not generated
The routine to create the message can return nothing if there is no content,
we should handle this case and not attempt to send.

To test:
1 - Test plan from last patch
2 - Apply this patch
3 - POST to patron API again
4 - Success!

Signed-off-by: Claire Hernandez <claire.hernandez@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c1fa513be9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:25 +01:00
Nick Clemens 7036902f57
Bug 39408: Handle BadParameter exception better
Currently we assume BadParameter has been thrown with a parameter that is a valid patron field.
It may only include a message, or it may have come from outside the patron object, we should
handle all cases.

To test:
1 - Wrap "WELCOME" notice content in conditional:
    [% IF borrower.categorycode != 'SELFREG' %]
    ...
    [% END %]
2 - Enable preference AutoEmailNewUser
3 - Attempt to self register a patron via API with body:
    {"surname":"PATRON","firstname":"PROBLEM","library_id":"CPL","category_id":"SELFREG","email":"eample@example.org"}
4 - Response error: "Given  does not exist"
5 - Apply this patch, restart all
6 - Repeat 3
7 - Response error: "Exception 'Koha::Exceptions::BadParameter' thrown 'Parameter message_id cannot be empty if passed.'\n"
8 - It's uglier, but actually helpful

Signed-off-by: Claire Hernandez <claire.hernandez@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ae14a11937)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:24 +01:00
Nick Clemens a6f92e83d0
Bug 34596: Unit tests
Writing these I found that transferbook was generating two queue rebuilds - fixed that

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 168f52f99b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:24 +01:00
Nick Clemens ff97e43d79
Bug 34596: Add rebuild queue where needed for existing calls to AddReturn
Existing calls to AddReturn:

C4/Circulation.pm
 - transferbook - calls ModDateLastSeen, queue is rebuilt
 - AddIssue - rebuild not needed, book is going out again immediately

C4/SIP/ILS/Transaction/Checkin.pm
 - do_checkin - added

Koha/Checkouts.pm
 - automatic_checkin - added

circ/circulation.pl
 - called in stats checkout, not needed

circ/returns.pl
 - added

opac/sci/sci-main.pl
- added

svc/checkin
 - added

svc/recall
 - wasn't actually called, removed the use statement

tools/inventory.pl
 - added

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 18fba45afd)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:24 +01:00
Nick Clemens 0246ec0914
Bug 34596: Do not build holds queue when checkin reserve found but do if hold ignored
This patch does two things:
1:
It prevents rebulding the real time holds queue during a checkin if a reserve was found.
The reserve will either:
a - be set to waiting if at correct location and no confirmation - this is fine because we will rebuild the queue when
    filling the hold
b - trigger a popup whihc will rebuild the queue when confirming the transfer, or be ignored

2:
It adds a form to ignoring a hold so that we can rebuild the holds queue if we decided not to use the current item
to fill the found hold

To test:
0 - Enable RealTimeHoldsQueue
1 - Place several holds for different libraries on a title
2 - Checkout a copy to a patron at current library (ignore current holds)
3 - Clean up DB so we can see outcomes from next steps:
   delete from branchtransfers; delete from background_jobs; update reserves SET found=NULL where found='T';
4 - Check in item, confirm hold
5 - Check background jobs, note two rebuilds of the holds queue
6 - Check item out to previous patron, repeat 3
7 - Check in item, ignore the hold
8 - Check background jobs, note only one rebuild
9 - Apply patch, restart all
10 - Checkout item, repeat 3
11 - Checkin item, confirm hold
12 - Check background jobs, onlt one rebuild of holds queue
13 - Checkout item, repeat 3
14 - Checkin item, ignore hold
15 - Check background jobs, only one rebuild of holds queue

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f9d096df27)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:23 +01:00
Jonathan Druart adbc9548fd
Bug 41012: (bug 40622 follow-up) Clear the MSS cache
For some reasons t/db_dependent/ILSDI_Services.t fails if run after
t/db_dependent/api/v1/biblios.t

When we modify the MARC subfield structure from the tests we must flush
the cache.

Actually I don't understand why the tests are even passing.

I have not tracked down why it only fails when run after t/db_dependent/api/v1/biblios.t

Test plan:
0. Do not apply this patch
1. prove t/db_dependent/api/v1/biblios.t t/db_dependent/ILSDI_Services.t
It fails
    #   Failed test 'Title hidden in output as expected'
    #   at t/db_dependent/ILSDI_Services.t line 874.
    #          got: '1'
    #     expected: '0'
2. Apply this patch, repeat 1.
=> it's green!

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b6aab57065)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:23 +01:00
Martin Renvoize 5bc6fba3c0
Bug 40866: (follow-up) Remove obsolete CanBookBeIssued.t test file
This test file was specifically testing the message_log return value
from CanBookBeIssued, which was removed as part of the bug 40866
patchset. The circulation message functionality has been reimplemented
elsewhere with proper test coverage, making this test file redundant.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 2bd44c51f0)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:22 +01:00
Jonathan Druart c18696a9cb
Bug 40918: Fix invoice adjustement reason selection
From
  commit 46f7158f44
  Bug 38714: acqui/invoice.tt

Debugging stuff left, sorry!

Test plan:
1. Go to Acquisition.
2. Create a vendor.
3. Click "Receive Shipment"
4. Enter an invoice number and save.
5. Go to Administration->Authorized Values->Add A Category
6. Name it ADJ_REASON
7. Put in 2 options
8. Go to invoices in Aqusition
9. Add an adjustment (enter an amount and select a reason, then save)
10. The reason is set to "no reason"
11. Go to reports
12. new sql report
select * from aqinvoice_adjustments
13. Run the report and see your reason is saved.
14. go back to the invoice and click save adjustments
15. Run the report and see your reason is saved.

Signed-off-by: Eric Phetteplace <ephetteplace@cca.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 93d680b645)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:22 +01:00
Fridolin Somers d46e9d25a9
Bug 40785: Cronjob cleanup_database.pl remove args in usage first line
Cronjob cleanup_database.pl usage is wrong :
Usage: $0 [-h|--help] [--confirm] (...) [--bg-days DAYS [--bg-type TYPE] ]
Those args has been renamed jobs-days and jobs-type.
Also some args are missing.

There are too many args, I propose to remove them from there, one need to read the full help.

Test plan:
Run command line `misc/cronjobs/cleanup_database.pl -h`
You see first line:
Usage: misc/cronjobs/cleanup_database.pl

   -h --help          prints this help message, and exits, ignoring all
...

Signed-off-by: Anke Bruns <anke.bruns@gwdg.de>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3aefbaeaf6)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:22 +01:00
Lisette Scheer 00ee0cc163
Bug 35700: Holds reminder cronjob - Fix --triggered switch if the day to send notice hits concurrent holidays
If the holds reminder cronjob would send a reminder on a holiday,when holidays are taken into account, it also will send it on the subsequent holidays and the first open day.
This bugfix adds a check to the cron when --holidays is set to skip sending the notices for that library if today is a holiday.

To Test:
Before applying:
1. Create a hold for a patron (I used patron 23529000035676 and 39999000000252)
2. Ensure your patron has an email address set and the hold reminder email selected.
3. Set the hold to waiting by checking it and confirming the hold.
4. In Tools->Calendar add a holiday to yesterday and a seperate holiday to today.
5. On the command line (the date should be set to 5 days ago for my commands to work and any dates adjusted accordingly)
koha-mysql kohadev
update reserves set waitingdate="2025-09-25"
exit
perl misc/cronjobs/holds/holds_reminder.pl -days 3 -t -v -holidays --date 2025-09-29
6. Observe that 1 notice would have sent to your patron
7. On the command line
perl misc/cronjobs/holds/holds_reminder.pl -days 3 -t -v -holidays
8. Observe that 1 notice would have sent to your patron
9. On the command line
perl misc/cronjobs/holds/holds_reminder.pl -days 3 -t -v -holidays --date 2025-10-01
10. Observe that 1 notice would have sent to your patron

11. Apply patches
12. Repeat the last command from step 5 and step 7
13. Observe that no notice should be sent for your patron
14. Repeat step 7
15. Observe that a notice should be sent for your patron.
16. Run
perl misc/cronjobs/holds/holds_reminder.pl -days 5 -t -v
17. Confirm the notice should be sent for your patron
18. Sign off

Signed-off-by: Katie Bliss <KEBliss@dmpl.org>

Bug 35700: (QA follow-up) fix POD and $today

This patch replaces the inncorrectly removed POD note and replaces $today with the more correct $date_to_run for checking if we should be skipping sending the message on the day.

Amended-by: Jonathan Druart
Squashed and adjusted commit title

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b895eb9b7d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:21 +01:00
Marcel de Rooy ae9b83ae96
Bug 40985: Clarify POD of Holds->filter_by_found
Test plan:
Read POD.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f0991861e2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:21 +01:00
Martin Renvoize 68123ef9fc
Bug 40587: Auto-select EAN from QUOTE message when creating EDIFACT orders
When a basket is generated via an EDI QUOTE message, the QUOTE message
includes a library's EAN code (buyer_ean). This patch makes the 'Create
EDIFACT order' button automatically use the EAN from the original QUOTE
message instead of requiring manual EAN selection.

This patch also fixes a bug in process_quote where all baskets in
multi-message QUOTE transports incorrectly used the first message's
buyer_ean, even when subsequent messages had different EANs.

Changes made:

1. Fixed Koha/EDI.pm process_quote auto-order creation to use the correct
   buyer_ean for each message/basket pair in multi-message transports
2. Enhanced acqui/basket.pl to extract and provide the quote_ean from
   QUOTE messages, handling both single and multi-message scenarios
3. Updated basket.tt template to automatically select the EAN from the
   original QUOTE message when available and matching

Test plan:
1. Create a vendor with EDI account and multiple EANs configured
2. Process a QUOTE message that creates a basket
3. Go to the basket page and click "Create EDIFACT order"
4. Verify it automatically uses the EAN from the QUOTE message
   (shows tooltip "Using EAN from original QUOTE message")
5. Test with multi-message QUOTE files to ensure each basket uses
   the correct EAN from its corresponding message
6. Verify fallback behavior when no QUOTE EAN matches available EANs

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 47546f0849)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:20 +01:00
Martin Renvoize 1dd64fc47e
Bug 40587: Add tests for multiple message EAN handling in EDI quotes
This patch adds unit tests to verify that when processing EDI QUOTE transports
containing multiple messages with different buyer EANs, each basket gets the
correct EAN for its corresponding message.

Test plan:
1. Run: prove t/db_dependent/Koha/EDI.t
2. Verify the new 'multiple_message_ean_handling' subtest passes
3. Verify that all existing EDI tests continue to pass

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit bd01562f5c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:20 +01:00
Martin Renvoize 35f3f60cd3
Bug 40866: Remove OVERRIDE state from action-logs.inc
This state is no longer ever set anywhere

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 213de9af0b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:19 +01:00
Martin Renvoize 3127262b91
Bug 40866: Add missing override states to action-logs.inc
This follow-up adds missing override state translations that were
discovered during testing. The patchset logs various override states
but some were not covered in the log viewer display template.

Missing states added:
- USERBLOCKEDNOENDDATE: Patron had an indefinite restriction
- CURRENTISSUE: Item is currently checked out to this patron
- UNSEEN: Unseen renewal
- SEEN: Seen renewal

These states are now properly displayed in the action logs viewer
when reviewing circulation override logging.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4c24c03769)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:19 +01:00
Martin Renvoize 66fc8cef20
Bug 40866: Add unit tests for hold override logging
This patch adds unit tests to verify the hold override logging
functionality implemented in the previous patches. The tests cover the
logging of hold overrides in `C4/Reserves.pm` and the `Koha/REST/V1/Holds.pm`
API endpoint.

To test:
1. Run the following tests and confirm they pass:
   - prove -lrv t/db_dependent/Circulation.t
   - prove -lrv t/db_dependent/Reserves.t
   - prove -lrv t/db_dependent/api/v1/holds.t
2. All tests should pass.

Changes:

t/db_dependent/Circulation.t:
- Added tests for hold override scenarios in circulation.

t/db_dependent/Reserves.t:
- Added tests to verify that hold overrides are correctly logged when
  a hold is placed.

t/db_dependent/api/v1/holds.t:
- Added tests to ensure that the holds API correctly logs overrides
  when a hold is created with the `x-koha-override` header.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 19dc33c649)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:18 +01:00
Martin Renvoize e5bd7c1ad4
Bug 40866: Implement Alternative pattern for holds override logging (Part 4)
This patch implements proper override logging for holds following the
Alternative implementation pattern used for checkouts and renewals.

Instead of just removing the orphaned logging code from the original
Bug 9762 implementation, this patch properly implements override logging
by updating AddReserve to accept and log override information, similar
to how AddIssue handles confirmations and forced overrides.

Changes:

C4/Reserves.pm:
- Added JSON qw(to_json) import
- Updated AddReserve to accept confirmations and forced parameters
- Enhanced the existing logaction call to include override information
  in JSON format when overrides are present
- Log format matches the Alternative implementation pattern:
  * hold ID
  * branchcode
  * biblionumber
  * itemnumber
  * confirmations array
  * forced array

Koha/REST/V1/Holds.pm:
- Added confirmations array building in the add() method
- Pass 'HOLD_POLICY_OVERRIDE' confirmation when override_all is true
- Pass confirmations parameter to AddReserve call

reserve/request.pl:
- Removed orphaned original implementation logging code
- Removed unused variables and imports (message, @message, user, etc.)
- Removed C4::Log import

koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc:
- Added 'HOLD_POLICY_OVERRIDE' case to translate_log_override block
- Displays as "Hold policy override" in log viewer

koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt:
- Added JSON display handling for HOLDS module (similar to CIRCULATION)
- Displays hold ID, biblionumber, and optional itemnumber with links
- Shows forced and confirmation overrides using translate_log_override

This ensures hold overrides are logged consistently with the Alternative
implementation pattern, providing proper audit trails for policy overrides
that are properly displayed in the log viewer.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1884f68c5b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:18 +01:00