From 241abf5545248493a48f2c2e55cf11afd417bbdc Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Sun, 2 Aug 2026 19:40:46 +0000 Subject: [PATCH] Bug 43072: (Bug 41267 follow-up) Add default rules when not set Bug 41267 defined the new rule, but didn't set the default. For consistencies sake we should create these in the DB To test: 1 - Create 'Default holds and bookings policies by item type' for two itemtypes Set 'Fill other record level holds on record at checkout' to yes for one and no for the other 2 - Apply this patch 3 - updatedatabase 4 - Verify the rules are not altered 5 - Chekc the DB: SELECT * FROM circulation_rules WHERE branchcode IS NULL and categorycode IS NULL; 6 - Note the number of rules/ids 7 - Run the DB update and confirm nothing changes 8 - DELETE from circulation_rules WHERE rule_name='fill_other_biblio_holds_policy'; 9 - Run the DB update 10 - Confirm rules are replaced, both as yes 11 - Delete a single one of the rules now: DELETE from circulation_rules WHERE rule_name='fill_other_biblio_holds_policy' AND id=#; 12 - Run the DB update 13 - Confirm only that rule is replaced 14 - DELETE from circulation_rules WHERE branchcode IS NULL and categorycode IS NULL; 15 - Run the DB update 16 - No new rules are created follo# Koha/.Patrons.pm.swp Signed-off-by: Lawrence O'Regan-Lloyd Signed-off-by: Emily Lamancusa Signed-off-by: Pedro Amorim --- .../data/mysql/atomicupdate/bug_43072.pl | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_43072.pl diff --git a/installer/data/mysql/atomicupdate/bug_43072.pl b/installer/data/mysql/atomicupdate/bug_43072.pl new file mode 100755 index 0000000000..0a2bf906b5 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_43072.pl @@ -0,0 +1,26 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "BUG_NUMBER", + description => "A single line description", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Do you stuffs here + $dbh->do( + q{ + INSERT INTO circulation_rules (itemtype,rule_name,rule_value) + SELECT itemtype,'fill_other_biblio_holds_policy',1 FROM circulation_rules + WHERE branchcode IS NULL AND categorycode IS NULL and rule_name='holdallowed' AND + itemtype NOT IN ( + SELECT itemtype FROM circulation_rules + WHERE branchcode IS NULL AND categorycode IS NULL and rule_name='fill_other_biblio_holds_policy' + ) + } + ); + + say $out "Set default fill_other_biblio_holds_policy rule for itemtypes with other policies set"; + }, +};