Koha/installer/data/mysql
Kyle M Hall 0b1a1261ff Bug 33847: Database update replaces undefined rules with defaults rather than the value that would be used
Bug 29012 introduces a database update that sets the default values for rules that are required but undefined. This functionally changes the results of the circulation rules.

Instead, this update should find value that is being used for that rule combo and use that as the rule value, only using the default in the case that the derived rule doesn't exist or has a null value.

Test Plan:
1) Check out Koha 22.05.05
2) Create a default all/all/all rule, 3 other rules. Ensure they all have Loan period set to 7, with one of the non-default rules having a Loan period of 14.
3) Delete all but one of the non-default rules with the following query:
   Delete from circulation_rules where rule_name  = 'issuelength' and ( rule_value != 14 and not ( branchcode is null and categorycode is null and itemtype is null ) ) limit 2;
4) Check out 254f721320
5) Run updatedatabase.pl and restart
6) Note the rules were recreated with the value 0
7) Repeat steps 1-4
8) Apply this patch
9) If you're using the same database, set the version to 22.0600023 and restart
10) Run updatedatabase.pl
11) Note the rules were recreated, but the value is the derived value from the all/all/all rule!

Signed-off-by: Kevin Carnes <kevin.carnes@ub.lu.se>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Bug 33847: Rewrite to use SQL

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Squashed, and added reference to new bug too
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f6f2d1ae41)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8b04a3f642)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-01-04 20:38:48 +00:00
..
atomicupdate Bug 34328: DBRev 23.05.05.003 2023-11-10 15:24:33 -10:00
db_revs Bug 33847: Database update replaces undefined rules with defaults rather than the value that would be used 2024-01-04 20:38:48 +00:00
en Bug 35187: [23.05] (follow-up) Fix missing line breaks in WELCOME notice 2023-11-11 11:04:06 +01:00
localization Bug 34558: Update custom.sql for it-IT webinstaller 2023-10-09 09:18:24 -10:00
mandatory Bug 34328: (follow-up) Add description to en_GB 2023-11-10 15:23:50 -10:00
backfill_statistics.pl
fix_unclosed_nonaccruing_fines_bug17135.pl
kohastructure.sql Bug 35190: Set default NULL for authorised_value_category in additional_fields table 2023-11-09 20:53:00 -10:00
labels_upgrade.pl
patroncards_upgrade.pl
update22to30.pl
updatedatabase.pl Bug 34685: Make updatedatabase.pl propagate the error 2023-09-08 09:27:46 -10:00