Commit Graph

59530 Commits

Author SHA1 Message Date
Jonathan Druart 5c3ee79814
Bug 32176: Remove duplicated code to select patron from autocomplete
On bug 31782 we centralized the code to autocomplete when searching for patron
There were several occurrences in the code where some code were
duplicated (when selecting patrons and allowing to remove them from a
list).

This patch centralizes this code by adding another parameter to
patron_autocomplete: on-select-add-to

Test plan:
When duplicating an order, searching for orders, editing a course (and
adding instructors) and adding patrons to a patron list, you should now
see the correct patron details displayed: with preferred name, without
"null" in case of missing surname, correct spacing, etc. Like (almost)
everywhere else in Koha.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:25 -06:00
Lucas Gass b9d4100259
Bug 40958: (follow-up) Fix QA complaint about forbidden pattern
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:24 -06:00
Jonathan Druart 95834aca2f
Bug 40958: Remove remaining occurrence in course_reserves/course.tt
From bug 40699

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:24 -06:00
Jonathan Druart 8f3267fa65
Bug 40958: Move patron_to_html to a standalone JS file
It will be easier to reuse patron_to_html

Test plan:
Search for patron and confirm that that patron are formatted correctly.
Global patron search and a couple of other places should be enough.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:23 -06:00
Jonathan Druart f45a925fea
Bug 41003: Add Cypress tests to cover patron formatting
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:23 -06:00
Jonathan Druart 225579da2b
Bug 40699: Correctly format patron everywhere in course reserves
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:22 -06:00
Andrew Fuerste Henry c3a633e0fe
Bug 40699: Use patron-title for course reserve instructor
To test:
1 - have or make a course reserves course with an instructor
2 - give your instructor a preferred name, confirm the course shows their firstname instead
3 - apply patch, reload page
4 - confirm course now shows their preferred_name instead
5 - edit the patron to remove the preferred name, confirm course shows first name again

Signed-off-by: noah <noah@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:22 -06:00
Marcel de Rooy 40d1cdeeb1
Bug 40559: Fix noisy warning in MARCdetail
Rebased for 25.06.
Resolves:
    Use of uninitialized value in string eq at /usr/share/koha/catalogue/MARCdetail.pl line 203.

Test plan:
Make sure that there is a combination of framework/field/subfield having
an entry in marc_subfield_structure where kohafield is NULL.
To force this for default fw on 020$q:
    update marc_subfield_structure
    set kohafield=NULL
    where tagfield='020' and tagsubfield='q' and frameworkcode='';
Pick a biblio in this framework having that field/subfield. Or create
a 020 with $q filled. Hit catalogue/MARCdetail now.
Without this patch, it triggers the warn. With this patch, it does not.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:21 -06:00
Lucas Gass 07d2ec942a
Bug 40292: DBRev 25.06.00.029
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:21 -06:00
Jonathan Druart 647b28e536
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>
2025-10-31 15:26:20 -06:00
Paul Derscheid de5e76bac2
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>
2025-10-31 15:26:20 -06:00
Jonathan Druart a0cc8aa9d7
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>
2025-10-31 15:26:19 -06:00
Jonathan Druart 9e0a70fced
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>
2025-10-31 15:26:18 -06:00
Lucas Gass c6484a3f83
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>
2025-10-31 15:26:18 -06:00
Paul Derscheid b9d392dd61
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>
2025-10-31 15:26:17 -06:00
Paul Derscheid 33f39f55af
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>
2025-10-31 15:26:17 -06:00
Martin Renvoize ec66781149
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>
2025-10-31 15:26:16 -06:00
Matt Blenkinsop 0921411e66
Bug 41063: Allow setting of a group for additional fields
Adds support for the extendedAttributesFieldGroup configuration option
in base-resource.js composable. This allows developers to specify which
form section/group additional fields should appear in, providing better
control over form organization and UX.

Without this, additional fields always appeared in the default group,
making it difficult to logically organize complex forms with multiple
field groupings.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:16 -06:00
Matt Blenkinsop ae424e7d43
Bug 41063: Fix additional fields in Vue
Additional fields added through Vue.js resource forms were not being
saved to the database. This was caused by using ref() instead of
reactive() for the current_additional_fields_values object. Since
ref() only provides shallow reactivity for objects, changes to nested
properties were not being tracked properly.

This switches to reactive() which provides deep reactivity tracking,
ensuring that all changes to additional field values are properly
captured and submitted when the form is saved.

Test plan:
1) Go to Administration > Additional fields and add an additional field
   for erm_agreements
2) Enable ERM and navigate to ERM > Agreements
3) Click to add a new agreement and then fill out the form, making sure
   to add something into your new additional field
4) Hit save and navigate to the agreement you have just added
5) There will be no additional field added
6) Apply patch and yarn js:build
7) Repeat steps 3 - 5
8) The additional field should be added and displayed correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:15 -06:00
Lucas Gass c8a522ae47
Bug 35830: DBRev 25.06.00.028
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:15 -06:00
Brendan Lawlor 5ce9d5af4e
Bug 35830: Add merge_borrowers subpermission
Merging patrons only required edit_borrowers permission
but would result in a patron deletion.

This patch requires a new merge_borrowers subpermission

To test:
1. Give a patron the following permissions
    catalogue, edit_borrowers, list_borrowers
2. Log into the staff interface as the patron
3. Do a patron search and select 2 patrons
4. Click merge patron - success - a patron got deleted
5. Apply patch, updatedatabase and restart_all
6. Repeat steps 3 and 4 - you can't
7. Add the new permission for merge_borrowers
8. Repeat steps 3 and 4 - now you can
9. prove t/Koha/Auth/Patrons.t

Sponsored-by: CLAMS
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:14 -06:00
Jonathan Druart 9f42c5fe28
Bug 38080: Fix order of columns in opac's holdings tables
The order of the columns in the yaml file must match the order of the
columns in the template file.

Test plan:
Confirm that, with bug 30633 applied, you can pick "shelving location"
as the default sort order and that the items are correctly sorted by
shelving location.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:14 -06:00
Matt Blenkinsop cc01178c90
Bug 41103: Remove incorrect use of table settings
The table settings for titles have been set by default even though the data type for this table is dynamic

Test plan:
1) Create a provider and harvest some platform data
2) Click into the provider and select the Platform tab
3) The page will crash and the console will show an error
4) Apply patch and yarn js:build
5) Hard refresh the page and click on Platforms again
6) The table should load successfully

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:13 -06:00
Owen Leonard 0ecc83606a
Bug 41067: (follow-up) Change hint to include 'Editable' requirement
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:13 -06:00
Jonathan Druart d4a17b1b56
Bug 41067: Disable OPAC mandatory when not editable
If a patron attribute is not editable at the OPAC it should not be
possible to make it mandatory.

Test plan:
Create a new patron attribute and confirm that checkboxes behaviour is
consistent.

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>
2025-10-31 15:26:12 -06:00
Slava Shishkin a8dd0bc13f
Bug 40720: Misleading title attribute "Remove all items" in Select2 fields
This patch updates our Select2 initialization script to update the
strings used as title attributes on the "X" control which appears in a
Select2 dropdown when you've made a selection.

The updated text reads "Clear selections" in order to eliminate the
ambiguity of the word "items."

To test, apply the patch and clear your browser cache.

- Go to Catalog -> Item search.
- Make one or more selections in any of the Select2 dropdowns (e.g. Home
  library, current library, item type, etc.).
- An "X" should appear at the end of the field after you've made one or
  more selections.
- Hover your mouse over the "X." The title which appears should read
  "Clear selections."

Sponsored-by: Athens County Public Libraries

Signed-off-by: Slava Shishkin <slavashishkin@gmail.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:12 -06:00
Jonathan Druart 7dac6055b2
Bug 40988: Remove pagination for funds on acqui home
As well as the fund list view (admin/aqbudgets.pl)

Signed-off-by: Sarah Berry <sberry@pascolibraries.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:11 -06:00
Caroline Cyr La Rose 4d1a556c15
Bug 41092: Some system preferences have target='blank' instead of target='_blank'
This patch changes target='blank' to target='_blank' in system
preferences.

To test:
1. Apply the patch
2. Check the following system preferences, click on the links,
   make sure every click opens in a new tab
   - UniqueItemFields
   - PatronSelfModificationMandatoryField
   - PatronSelfRegistrationBorrowerMandatoryField
   - PatronSelfRegistrationBorrowerUnwantedField
   - PatronSelfModificationBorrowerUnwantedField
   - EmailFieldPrecedence
   - BorrowerMandatoryField
   - BorrowerUnwantedField
   - PatronQuickAddFields
   - PatronDuplicateMatchingAddFields

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:11 -06:00
Fridolin Somers d14619158e
Bug 40903: Fix OPAC advanced search applies a limit of the logged-in library by default
This is caused by Bug 36742. It exists in main but starts in 24.11.

The OPAC advanced search now automatically applies a limit to the 'Location and availability' section using the patron's logged in library, even if there are multiple libraries in the system.
This feature must be depending on system preference 'SearchMyLibraryFirst'.

1) Set system preference 'SearchMyLibraryFirst' to 'Don't limit'
2) Go to OPAC
3) Authenticate with a user
4) Go to advanced search
5) Check there is no library selected in 'Location and availability'
6) Select a library and submit
7) Clik on 'Return to the last advanced search'
8) Check the library is selected in 'Location and availability'
9) Set system preference 'SearchMyLibraryFirst' to 'Limit'
10) Go to OPAC
11) Authenticate with a user
12) Go to advanced search
13) Check library of patron selected in 'Location and availability'

Signed-off-by: Aleisha Amohia <aleisha@catalyst.net.nz>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:10 -06:00
Marcel de Rooy 4a267d0e9b
Bug 41024: Unify spelling of BorrowersLog, keep plural form
The singular form is wrong and only exists in textual context.
This is a result of git grep | xargs sed.

Test plan:
Read the patch.
git grep BorrowerLog

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Aleisha Amohia <aleisha@catalyst.net.nz>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:10 -06:00
Marcel de Rooy 1a2d1774f0
Bug 41123: Remove useless dbh call in Koha::Patron
Test plan:
Read the patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Aleisha Amohia <aleisha@catalyst.net.nz>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:09 -06:00
Jonathan Druart 8358957f57
Bug 40845: Remove hardcoded Koha version from t/Koha/Manual.t
Test plan:
Update the version in DB:
> update systempreferences set value="25.1100000" where variable="version";
restart_all
prove t/Koha/Manual.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleisha@catalyst.net.nz>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:09 -06:00
Jonathan Druart 26d740f267
Bug 41082: Fix batch tools from reports when itemnumber col has been renamed
Description from comment 0

When creating an SQL report and it contains the column itemnumber, we
activate batch operations above the table. The itemnumber column can be
renamed, using the syntax [[itemnumber|Exemplarnummer]], which gives us
the option to translate the column name into something nicer for
display.

But: if you then send to batch item edit, the items are not
transmitted.

Test plan:

1) Create a report:
   select itemnumber, itemcallnumber from items;

2) Send some items to batch item edit, verify the items are shown above
   the item form

3) Update the report:
   select [[itemnumber|Exemplarnummer]], itemcallnumber from items;

4) Verify the report still shows as before with the batch options
   available and only the column being renamed.

5) Send some items to the batch item edit again

   => verify the items are shown above the item form

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:08 -06:00
Baptiste Wojtkowski a95f5ea73a
Bug 41112: Space is missing in report preview
This patch puts back a missing space between "Delete" and the fa
thrashcan. It is atm the lonely button without this space in the modal

No test plan needed. The change is too trivial.
Just check that lines before in the code have the desired space. The
missing space creates a weird sensation while looking at the window.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 15:26:08 -06:00
Lucas Gass 4339f05423
Revert "Bug 41099: Make `koha-mysql` disable SSL if required"
This reverts commit 36db5b4ad7.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-31 11:26:10 -06:00
Tomás Cohen Arazi 36db5b4ad7
Bug 41099: Make `koha-mysql` disable SSL if required
Now that Debian 13 (and Ubuntu 25.04) set `ssl=on` by default, we should
make the `koha-mysql` helper script disable it by default if not
configured.

This patch does that.

To test:
0. Start a Debian 13 KTD e.g. with:
   $ KOHA_IMAGE=main-trixie ktd up
1. Run:
   $ ktd --shell
  k$ koha-mysql kohadev
=> SUCCESS: You get into the DB shell
2. Apply this patch
3. Run:
  k$ debian/scripts/koha-mysql kohadev
=> SUCCESS: It works as step 1!
4. Make sure you enable SSL in my.cnf:

[client]
ssl = on

5. Repeat 1
=> FAIL: You get an error about SSL in the server being disabled
6. Repeat 4
=> SUCCESS: The patch fixes it!
7. This steps imply we reproduced the issue, and it gets fixed, while
   keeping the current behavior.
8. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 15:28:38 -06:00
Lucas Gass 29b3b18722
Bug 40517: DBIC
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:14 -06:00
Lucas Gass 059ead76da
Bug 40517: DBRev 25.06.00.027
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:13 -06:00
Pedro Amorim dc5cee850d
Bug 40517: (QA follow-up): Fix kohstructure.sql
The order was wrong, PRIMARY KEY must come first.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:13 -06:00
Pedro Amorim 14d1c1338a
Bug 40517: (QA follow-up): Fix xt/api.t
prove -v xt/api.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:12 -06:00
Lucas Gass 7818111a64
Bug 40517: (follow-up) Fix GNU license links
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:12 -06:00
Lucas Gass 3a0c2cc7e5
Bug 40517: (follow-up) Add a new line to EOF
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:11 -06:00
Pedro Amorim 90206ab4da
Bug 40517: (QA follow-up): Fix 'group selected' button active with just 1 hold selected
This fixes the following bug:
1) Select 1 hold, notice the 'group selected' button is still disabled
2) Select a 2nd hold, notice the 'group selected' button becomes enabled
3) Unselect one of the holds, notice the 'group select' is kept enabled (this is wrong, it should become disabled)

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:11 -06:00
Pedro Amorim 0a0ba6fea0
Bug 40517: (QA follow-up): Cleanup obsolete code
The patch 'Move creation of hold group into Patron class' is
moving the creation of the hold group logic to the Patron.pm class file
but it didn't remove all the obsolete code.
This is fixed here.

Signed-off-by: Anneli <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:10 -06:00
Pedro Amorim edd318fa91
Bug 40517: Add unit tests
Run the updated test file:
prove ./t/db_dependent/Koha/Patron.t

Relevant tests worth running to ensure no regressions are added to existing covered functionality:
prove ./t/db_dependent/Circulation*
prove ./t/db_dependent/Hold*
prove ./t/db_dependent/Reserves*

Test plan, k-t-d:
1) Apply patches, enable DisplayAddHoldGroups system preference
2) Do a search for 'test':
<staff_url>/cgi-bin/koha/catalogue/search.pl?q=test
3) Click the 'Select all' link at the top of the search results, click the 'Place hold' button.
4) Enter the 'koha' user
5) Pick a pickup location for each of the holds and click 'Place holds'.
6) Visit the 'koha' patron:
<staff_url>/cgi-bin/koha/members/moremember.pl?borrowernumber=51
7) Click the 'holds' tab. Notice a new 'Group selected' button now exists
8) Pick any number of holds (more than 2) and click the 'Group selected' button. Confirm
9) Notice the hold group shows '1'. If you click on it you're presented the hold group modal.
10) Group multiple holds multiple times.
11) Notice you can't group a hold that has already been found.
12) Notice you can't click the 'Group selected' button unless at least 2 holds are selected.
13) Notice a hold group is deleted if left with 0 or 1 hold e.g. make a group of 2 holds, cancel 1, notice the remaining hold is left without a group.

prove t/db_dependent/api/v1/patrons_hold_groups.t
prove t/db_dependent/Koha/Patron.t

Signed-off-by: Anneli <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:10 -06:00
Pedro Amorim 1ccc10c058
Bug 40517: Patron page holds table buttons rearrangement
This table now has 4 total buttons, 3 of which relate to a selection of
holds. Rearranging the buttons is now necessary to present them nicely.

Signed-off-by: Anneli <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:09 -06:00
Pedro Amorim 9df5ffeffe
Bug 40517: Patron holds table: Add 'group selected holds' functionality
This adds the UI elements required to group selected holds from the
patron pages as well as 2 new concepts:

Visual group ID:
The visual group ID is designed to be easy to understand from a UI/UX
perspective and not show the user an indefinitely incremented value.
When holds are cancelled, filled or moved to a different group, if the
old group is left empty or with a single hold, the hold group is deleted.

Signed-off-by: Anneli <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:09 -06:00
Pedro Amorim 483578c74d
Bug 40517: Add visual_group_id to hold_groups
Signed-off-by: Anneli <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:08 -06:00
Pedro Amorim dada9dad0f
Bug 40517: REST API: Hold groups endpoint
list and add actions:
/patrons/{patron_id}/hold_groups

New test file:
prove t/db_dependent/api/v1/patrons_hold_groups.t

Signed-off-by: Anneli <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:08 -06:00
Pedro Amorim 07275db04f
Bug 40517: Move creation of hold group into Patron class. Add exceptions
Refactor: Update controller logic to make use of patron->create_hold_group

This ensures consistency when creating a new hold group for a patron,
regardless if on the Staff UI or REST API

Signed-off-by: Anneli <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:07 -06:00