Commit Graph

6672 Commits

Author SHA1 Message Date
Pedro Amorim 9be3ec6482
Bug 37893: Database
Sponsored-by: ByWater Solutions
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-18 11:20:32 -07:00
sashaanastasi 33f4935bce
Bug 39280: Remove misleading message text for ODUE notice
This patch removes unnecessary and misleading wording from the overdue note as it depends on the library's circulation rules: "If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned."

Test plan:
1. Check the wording of the ODUE notice under Tools > Patrons and circulation > Notices and slips.
2. Note that it includes this wording, which may be unnecessary or misleading depending on the library's settings: "If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned."
3. Apply the patch.
4. Check that the updated ODUE notice has removed the wording by either:
   4.1 Resetting everything: reset_all
   4.2 Viewing the default notice - click "View default" when viewing the email notice
5. Sign off.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-07 10:54:16 -07:00
Lucas Gass dbf341bfcb
Bug 40245: DBRev 25.06.00.034
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-07 10:54:11 -07:00
CJ Lynce 1d6eb51d20
Bug 40245: Add new system preference ShowPatronFirstnameIfDifferentThanPreferredname
Adds a new system preference ShowPatronFirstnameIfDifferentThanPreferredname
	to allow a patron's firstname to be shown in search results when
	different than their preferred name.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
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-11-07 10:54:10 -07:00
Lucas Gass c26e26a697
Bug 35451: DBRev 25.06.00.033
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-07 10:54:07 -07:00
Martin Renvoize ddd8e697b4
Bug 35451: Add record_table to additional_field_values
This patch updates the database to include a record_table field in the
additional_field_values table and adds an index on that field.

This should facilitate more performant joins.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-07 10:53:56 -07:00
Lucas Gass b60b190358
Bug 37711: DBRev 25.06.00.032
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-05 07:12:33 -07:00
Tomas Cohen Arazi 90a0c25bf9
Bug 37711: DB update
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-05 07:12:31 -07:00
Martin Renvoize c879aa8e0a
Bug 20253: (follow-up) Sync db_rev column order
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-05 07:12:23 -07:00
Lucas Gass 60803c8840
Bug 20253: DBRev 25.06.00.031
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-03 14:13:40 -07:00
Martin Renvoize 168a5a9107
Bug 20253: Add po_is_basketname field to vendor_edi_accounts table
This patch adds a new boolean field 'po_is_basketname' to the vendor_edi_accounts
table to allow configuration of how basket names are used in EDIFACT.

Changes:
- Added atomicupdate for existing installations
- Updated kohastructure.sql for new installations

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>
Sponsored-by: OpenFifth <https://openfifth.co.uk/>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-03 14:13:36 -07:00
Lucas Gass 954910e2b3
Bug 40529: DBRev 25.06.00.030
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-03 14:13:26 -07:00
Pedro Amorim 877390de6a
Bug 40529: (QA follow-up): Fix DB changes
Add UNIQUE KEY entries to table definition
The UNIQUE KEY are required as a hold group 'might have' a target hold, not 'has many' target holds.
This update and the other things this patch updates in atomicupdate + kohastructure should  fix the error thrown by command:
perl /kohadevbox/misc4dev/run_tests.pl --instance=kohadev --db-password=password --run-db-compare-only --compare-with=HEAD

This command no longer produces any errors.

Also in this patch:
Renamed table from 'hold_group_target_holds' to 'hold_groups_target_holds' and move it alphabetically to be after 'hold_groups' in kohastructure.sql
This is cleaner, as it matches the 'hold_groups' related table, and allows for alphabetical sorting on kohastructure.sql that makes sense i.e. hold_groups is created first, then hold_group_target_holds is created second with an FK to the former.

All of this passes:
prove ./t/db_dependent/Koha/Hold.t
prove ./t/db_dependent/Reserves/HoldGroup.t
prove ./t/db_dependent/Circulation*
prove ./t/db_dependent/Hold*
prove ./t/db_dependent/Reserves*

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-03 14:13:25 -07:00
Pedro Amorim 8426becada
Bug 40529: (QA follow-up): Remove hold as hold group target when reverted
If a hold that is a hold group target, i.e. it's 'waiting' or 'in transit', is reverted it needs to remove itself as its own hold group target

Tests added here as well:
prove t/db_dependent/Koha/Hold.t

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-03 14:13:24 -07:00
Pedro Amorim bf4e2d01aa
Bug 40529: Add hold group targets logic
Hold group target hold:
The hold that is set as the hold group's target. If a hold group has a
hold target, subsequent check-ins that would 'trap' items to the
remaining holds in the group are instead skipped.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-03 14:13:14 -07: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
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
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
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
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 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 7707050bdb
Bug 40517: atomicupdate
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:50:06 -06:00
Pedro Amorim 6a7a796280
Bug 40517: DB changes
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-29 11:49:59 -06:00
Lucas Gass 4d63b8bb36
Bug 30633: DBRev 25.06.00.026
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-24 07:57:12 -06:00
Jonathan Druart b09ac4bf93
Bug 30633: Remove OPACHoldingsDefaultSortField
It's no longer needed

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>
2025-10-24 07:57:09 -06:00
Lucas Gass bc0b0d2907
Bug 40936: DBRev 25.06.00.025
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-16 15:20:18 -06:00
Kyle M Hall 63c44cbd0e
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>
2025-10-16 15:20:18 -06:00
Lucas Gass c629e76e90
Bug 40070: DRRev 25.06.00.024
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-15 16:12:05 -06:00
Marcel de Rooy 52fc6ac32f
Bug 40070: Add new preference DisplayPublishedDate
Test plan:
Run install or update
Check new preference under Administration

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-15 16:12:04 -06:00
Lucas Gass 8a8a04a60e
Bug 38489: Fix structural diff
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-15 11:04:13 -06:00
Martin Renvoize b9bee6a07c
Bug 38489: (follow-up) Improve idempotency of update
We needed better idempotency around checking for fields before
attempting to use them during migration and then dropping them.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-15 11:04:12 -06:00
Martin Renvoize eb5c38a5ab
Bug 38489: (follow-up) Make old db_rev more idempotent 2
In the unit test system we reset the database version to 21.11 after
having upgraded a long way past that. The 231200022 update appears not
to be fully idempotent, so we fail running through the upgrade.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-15 11:04:12 -06:00
Martin Renvoize bf3b1e07a6
Bug 38489: (follow-up) Make old db_rev more idempotent
In the unit test system we reset the database version to 21.11 after
having upgraded a long way past that. The 221200041 update appears not
to be fully idempotent, so we fail running through the upgrade.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-15 11:04:04 -06:00
Lucas Gass 458b476d79
Bug 40983: DBRev 25.06.00.023
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-14 16:09:48 -06:00
Marcel de Rooy 5bad556207
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>
2025-10-14 14:51:54 -06:00
Lucas Gass 0303e3540d
Bug 38489: DBRev 25.06.00.022
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-14 14:51:52 -06:00
Martin Renvoize 8438782c6d
Bug 38489: (follow-up) Use 'TableExists' in atomicupdate
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-14 14:51:50 -06:00
Martin Renvoize a86cfe61d5
Bug 38489: Add file_transport_id to vendor_edi_accounts and migrate to new transport system
This patch adds database migration to move EDI transport configurations
from vendor_edi_accounts to the new file_transports system introduced
in Bug 39190.

Changes:
- Add file_transport_id column to vendor_edi_accounts with foreign key
- Add 'local' transport type to file_transports enum
- Remove old transport fields from vendor_edi_accounts in kohastructure
- Migration script converts existing EDI configurations to file transports
- Handles FILE -> local transport type conversion

Sponsored-by: ByWater Solutions
Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-14 14:51:46 -06:00
Arthur Suzuki 53f1874892
Bug 29980: Add a cataloguing plugin to check ISBN
Test plan:
- without patch login to Koha
- edit a biblio and put a wrong ISBN in 020a (010a for unimarc).
- leave the input field (looses focus), no warning
- apply patch and do "reset_all" to make a full re-install.
- edit the biblio again and put an invalid ISBN in 020a (010a for unimarc).
- when you leave the input field you should have a warning saying "invalid ISBN".
- the input field should turn yellow
- you can still save the biblio with a wrong isbn, it is just a warning.
- if you apply the patch on an existing install, you must manually link the value builder to your existing frameworks to get it working.

Signed-off-by: Johannes Reuter <reuter@die-bonn.de>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 14:58:40 -06:00
Jonathan Druart a8cdee1ee7
Bug 15516: Fix DB struct diff
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 13:48:31 -06:00
Jonathan Druart d90780504f
Bug 39190: Fix DB struct diff
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 13:48:30 -06:00
Jonathan Druart 2957031428
Bug 40665: Fix DB struct diff
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 13:48:30 -06:00
Jonathan Druart 1a4f7ad3b1
Bug 36033: Fix DB struct diff
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-09 13:48:22 -06:00
Lucas Gass 1cb4b9c4a6
Bug 15516: (follow-up) DBRev nneds to include everything from the kohastructure
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-08 09:53:00 -06:00
Lucas Gass 8831827d03
Bug 37901: (follow-up) Adjust DBRev includes everything from the kohastructure
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-08 09:52:59 -06:00