@@ -, +, @@ data 0 - Edit and save existing default rule in DB (sample data does not include suspension_chargeperiod) 1 - Set some rules for "Default checkout, hold and return policy" for "Standard rule" and some specific libraries 2 - cp installer/data/mysql/db_revs/220600024.pl installer/data/mysql/atomicupdate/ 3 - SELECT * FROM circulation rules, note the number of rules that exist 4 - updatedatabase 5 - Check the DB again, you should now have rules as described in the bug i.e. You will have 5 new rules per 'Default checkout, hold and return policy' 6 - apply 1st patch on bug 7 - rm installer/data/mysql/atomicupdate/220600024.pl (so we don't add again) 8 - updatedatabase 9 - Check DB, the extra rules have been deleted --- installer/data/mysql/db_revs/220600024.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/installer/data/mysql/db_revs/220600024.pl +++ a/installer/data/mysql/db_revs/220600024.pl @@ -9,7 +9,7 @@ return { my %default_rule_values = ( issuelength => 0, hardduedate => '', - unseenrenewalsallowed => '', + unseen_renewals_allowed => '', rentaldiscount => 0, decreaseloanholds => '', ); @@ -17,7 +17,15 @@ return { $dbh->do(q{ INSERT IGNORE INTO circulation_rules (branchcode, categorycode, itemtype, rule_name, rule_value) SELECT branchcode, categorycode, itemtype, ?, ? FROM circulation_rules cr - WHERE NOT EXISTS ( + WHERE EXISTS ( + SELECT * FROM circulation_rules cr2 + WHERE + cr2.rule_name="suspension_chargeperiod" + AND ( (cr2.branchcode=cr.branchcode) OR ( ISNULL(cr2.branchcode) AND ISNULL(cr.branchcode) ) ) + AND ( (cr2.categorycode=cr.categorycode) OR ( ISNULL(cr2.categorycode) AND ISNULL(cr.categorycode) ) ) + AND ( (cr2.itemtype=cr.itemtype) OR ( ISNULL(cr2.itemtype) AND ISNULL(cr.itemtype) ) ) + ) + AND NOT EXISTS ( SELECT * FROM circulation_rules cr2 WHERE cr2.rule_name=? --