Commit Graph

58926 Commits

Author SHA1 Message Date
Jonathan Druart 34e976764d
Bug 30633: Add default_sort_order to table settings
So we can pick a column from the table settings
http://localhost:8081/cgi-bin/koha/admin/columns_settings.pl#biblio-detail%7Choldingst

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 0c7e673b84)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-25 17:36:04 +01:00
Jonathan Druart 226ad52f98
Bug 30633: Hide columns when needed
We can use the force_visibility flag to hide column when they are empty
or should not be displayed because of syspref.

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 99f7388cb9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-25 17:36:03 +01:00
Jonathan Druart 9a592eada1
Bug 30633: Prepare the ground
Make the OPAC holdings table ready to use visibility based on
column's names.

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 a6a6693adf)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-25 17:36:03 +01:00
Martin Renvoize 15adc62abb
Bug 39336: Public Biblio endpoint should honour OpacSuppression syspref
This patch makes the Public Biblio endpoint respect the OpacSuppression
system preference and the biblio.opac_suppressed field introduced in
Bug 38330.

When OpacSuppression is enabled and a biblio has opac_suppressed set to 1,
the endpoint now returns a 404 (Not Found) response instead of exposing
the bibliographic record.

Test plan:
1. Apply patch
2. Run: prove t/db_dependent/api/v1/biblios.t
3. Verify all tests pass, including the new OpacSuppression subtest
4. Test manually:
   - Enable OpacSuppression syspref
   - Set a biblio's opac_suppressed field to 1
   - Access /api/v1/public/biblios/{biblio_id}
   - Confirm it returns 404
   - Set opac_suppressed to 0
   - Confirm it returns 200 with the record
   - Disable OpacSuppression syspref
   - Confirm record is visible regardless of opac_suppressed value

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 05aa74e921)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-25 17:36:02 +01:00
Paul Derscheid f49ca990f8
Bug 40983: DBRev 25.05.05.002
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-25 17:36:02 +01:00
Marcel de Rooy bac6038711
Bug 40983: (QA follow-up) Add a (final) upgrade warn
Just a last wake up call.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5bad556207)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-25 17:36:02 +01:00
Martin Renvoize fed0a03011
Bug 40983: Complete deprecation of old after_biblio_action hook signature
This patch completes the deprecation cycle started in bug 36343 by
removing the backward compatibility code and deprecation warnings for
the old after_biblio_action hook signature.

Changes made:
1. Removed the duplicate biblio and biblio_id parameters from
   _after_biblio_action_hooks in C4::Biblio that were marked for
   deprecation in 24.11.00
2. Updated the test plugin to use only the new payload-based signature,
   ensuring all parameters are accessed via $params->{payload}

The after_biblio_action hook now consistently uses the modern signature
with a payload parameter, matching the pattern used by other plugin hooks
like before_biblio_action, after_item_action, and after_hold_action.

Test plan:
1. Run: prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t
2. Run: prove t/db_dependent/Koha/Plugins/
3. Run: prove t/db_dependent/Biblio.t
4. All tests should pass

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1571fd489c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-25 17:36:01 +01:00
Martin Renvoize d4d9a849b5
Bug 40625: Fix duplicate cashup records via POST/REDIRECT/GET pattern
The cashup functionality on both /pos/register.pl and /pos/registers.pl
pages was using GET requests via anchor tags, which could cause
duplicate cashup records when users refreshed the page after performing
a cashup.

This patch implements proper POST/REDIRECT/GET pattern with CSRF
protection:

1. Convert anchor tag buttons to proper HTML forms with submit buttons
2. Add CSRF token protection to all cashup operations
3. Change operation from 'cashup' to 'cud-cashup' for CSRF compliance
4. Implement redirects after successful cashup operations to prevent
   resubmission
5. Update JavaScript to populate form fields instead of href attributes

This ensures cashup operations follow HTTP semantics properly (POST for
state changes) and prevents duplicate submissions while maintaining the
existing user experience.

Test plan:
1. Apply patch and restart services
2. Go to Point of Sale > Cash registers
3. Click "Record cashup" on any register - should open modal
4. Click "Confirm" - should perform cashup and reload page
5. Refresh the page - should NOT create duplicate cashup record
6. Go to Point of Sale > Register for individual register
7. Click "Record cashup" - should open modal
8. Click "Confirm" - should perform cashup and reload page
9. Refresh the page - should NOT create duplicate cashup record
10. On registers page, try "Cashup all" button - should work correctly
11. Verify all existing functionality (modals, summaries) still works
12. Check browser developer tools - all requests should be POST for
    cashup operations

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 26f1f91a13)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-25 17:36:01 +01:00
Paul Derscheid eb62356d68
Bug 40292: (RMaint follow-up) Backport adaptation to satisfy xt/find-license-problems.t
Should be reverted as soon as Bug 40163 is backported.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:30 +01:00
Paul Derscheid a79dd18ef1
Bug 40292: DBRev 25.05.05.001
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:29 +01:00
Jonathan Druart 6437209c5d
Bug 40292: Use Koha::Devel::Files to list dbrevs
For reusability and to limit files to the git index

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 647b28e536)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:29 +01:00
Paul Derscheid 9c4960df96
Bug 40292: (QA follow-up) Tidy db_revs/241200018.pl, atomicupdate/bug_40292.pl
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit de5e76bac2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:29 +01:00
Jonathan Druart 2eb0befc36
Bug 40292: Rename new_record_id if exists
If some installs didn't notice the column was missing (not renamed) we
can still do it now.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a0cc8aa9d7)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:28 +01:00
Jonathan Druart 9cdf2afc61
Bug 40292: Add a specific error if a previous upgrade failed
We can reach an inconsistent state if the upgrade DB failed and
new_record_id has been created but renamed.

I don't think we should try to recover from this state, but have a
specific error message in this case. We will guide people asking for
help.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9e0a70fced)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:28 +01:00
Lucas Gass d45be6eca8
Bug 40292: Use Test::NoWarnings
Amended-by: Jonathan Druart
Added + 1 to the plan

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c6484a3f83)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:27 +01:00
Paul Derscheid 01e49d3f1f
Bug 40292: Specify full datatypes and comment as required for CHANGE COLUMN
To test:
1. Follow the original test plan and compare the resulting tables to:
MariaDB [koha_kohadev]> desc additional_field_values;
+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| id        | int(11)      | NO   | PRI | NULL    | auto_increment |
| field_id  | int(11)      | NO   | MUL | NULL    |                |
| record_id | int(11)      | NO   |     | NULL    |                |
| value     | varchar(255) | NO   |     |         |                |
+-----------+--------------+------+-----+---------+----------------+
4 rows in set (0.003 sec)

MariaDB [koha_kohadev]> desc aqbookseller_aliases;
+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| alias_id  | int(11)      | NO   | PRI | NULL    | auto_increment |
| vendor_id | int(11)      | NO   | MUL | NULL    |                |
| alias     | varchar(255) | NO   |     | NULL    |                |
+-----------+--------------+------+-----+---------+----------------+
3 rows in set (0.004 sec)

MariaDB [koha_kohadev]> desc aqbookseller_interfaces;
+---------------+--------------+------+-----+---------+----------------+
| Field         | Type         | Null | Key | Default | Extra          |
+---------------+--------------+------+-----+---------+----------------+
| interface_id  | int(11)      | NO   | PRI | NULL    | auto_increment |
| vendor_id     | int(11)      | NO   | MUL | NULL    |                |
| type          | varchar(80)  | YES  |     | NULL    |                |
| name          | varchar(255) | NO   |     | NULL    |                |
| uri           | mediumtext   | YES  |     | NULL    |                |
| login         | varchar(255) | YES  |     | NULL    |                |
| password      | mediumtext   | YES  |     | NULL    |                |
| account_email | mediumtext   | YES  |     | NULL    |                |
| notes         | longtext     | YES  |     | NULL    |                |
+---------------+--------------+------+-----+---------+----------------+
9 rows in set (0.003 sec)

The Type field should be the only deviation from the previous version,
Null and Extra should be identical.
2. Run perl ../misc4dev/run_tests.pl --run-db-compare-only --compare-with v24.05.00
3. Sign off

Co-authored-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b9d392dd61)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:27 +01:00
Paul Derscheid 6538206331
Bug 40292: Prevent SQL syntax error when upgrading to 25.05 on MariaDB 10.3
- Change `RENAME COLUMN <OLD> TO <NEW>` to `CHANGE COLUMN <OLD> <NEW>
  <DATATYPE (required for this syntax)>`.

To test (assuming ktd):
1. Checkout upstream/24.11.x
2. Start ktd with `KOHA_IMAGE=24.11-bullseye(-arm64) DB_IMAGE=mariadb:10.3 ktd up
   -d`
3. Checkout upstream/main
4. Run updatedatabase in the Koha container
5. Observe the error regarding the unsupported syntax.
6. Tear everything down again: ktd down
7. Repeat 1-2.
8. Once started up, checkout upstream/main
9. Apply the patch on top of it
10. Run updatedatabase in the Koha container
11. Observe a successful upgrade
12. Sign off

Side Note: I tested this against upstream/25.05.x, but this patch is
based on main.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 33f39f55af)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:27 +01:00
Martin Renvoize 8cbdc7815e
Bug 40292: (follow-up) Add xt test to prevent future occurences
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ec66781149)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-11-04 00:04:23 +01:00
Paul Derscheid 3e05f735ae
Update release notes for 25.05.05 release
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 17:55:57 +01:00
Paul Derscheid daac6c216d
Increment version for 25.05.05 release
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 17:55:57 +01:00
David Cook 78911999e2
Bug 40818: Add missing html filter on html_helpers.inc
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 17:55:56 +01:00
Jonathan Druart ee2452903c
Bug 40818: Replace raw with html filter for marc_lib
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 17:55:56 +01:00
Jonathan Druart ea3ccf3171
Bug 40818: Remove HTML from marc_lib
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 17:55:55 +01:00
David Cook 6aaef913ae
Bug 40525: Update spreadsheet format to escape formulas
This change updates the spreadsheet format to escape formulas
using the built-in function if using Buttons 3.2.0+ or using
a workaround if not.

Test plan:
0. Apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=29
2. Click on tab 1
3. For 100$a type in the following and save:
=SUM(1+1)
4. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?findborrower=42
5. Checkout barcode 39999000001310 to the patron
6. Go to http://localhost:8080/cgi-bin/koha/opac-user.pl and login as that patron
7. Download the CSV for the summary table and open in Excel
8. Note that the "Author" is "'=SUM(1+1)" and not "=SUM(1+1)" or "2"

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 17:55:55 +01:00
Jonathan Druart d4fd8fd299
Bug 40978: Remove warnings from Budgets.t
If no shipment_budget is set then undef is set as key of the hashref
which generates a warning:
  Use of uninitialized value $row[0] in hash element at /usr/lib/x86_64-linux-gnu/perl5/5.40/DBI.pm line 2122.

Later we only access the hashref by budget_id, so this change seems
safe.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f073262263)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:40 +01:00
Jonathan Druart fc8b400a4c
Bug 41079: Force visibility for columns depending on sysprefs
If two sysprefs are disabled we must hide the two related columns.
We should also force the visibility of the checkboxes: on the first
screen (op=show/edition) they must be displayed, on the result screen
(op=show_results) the must be hidden.

Test plan:
1. Create a report to see some patrons:
    SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%2'
2. Run report and select 'Batch operations ...'
3. Batch patron modification
=> Notice that the table has the checkboxes in the first column
=> The table is sorted by cardnumber
4. Perform the modification
=> Notice that the result table does not have the checkboxes in the first column
=> The table is still sorted by cardnumber

Additional tests:
1. If the logged in user is superlibrarian then the columns "Password expiration date"
and "Protected" are displayed
2. Play with the table's settings and columns visibility to confirm that
they are working correctly (they were not before this patch set)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 17a07dcc2a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:40 +01:00
Jonathan Druart a09945c29d
Bug 41079: Turn on bKohaColumnsUseNames for the batch patron modification results table
A table cannot use the table settings if columns are displayed depending
on sysprefs.
Additionally DT's saveState does not work correctly if some columns are shown/hidden from one screen to
another.

We must add data-colname and turn bKohaColumnsUseNames on for this
table.

Also note that there were several discrepancies between the table
structure and the number of columns in the yaml file.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 034587d8ec)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:39 +01:00
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