From 4779cf845077ffd7f564b63b22f72ba99aa812ff Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 21 Dec 2018 19:19:05 +0000 Subject: [PATCH] Bug 22044: Set default and add NoRenewalBeforePrecision preference for new/affected installs I am not sure the correct answer - for upgraded installs the pref was set to date, which changed behaviour For new installs the pref was unset, behaved as if 'exact_time' so we shouldn't change behaviour? If the perceived default is date then the code should be changed, or this shouldn't be a pref at all? To test: 1 - Have a new system missing this pref 2 - Note when searchign the pref in staff client if appears as 'date' 3 - Check the db to confirm value is 'NULL' 4 - Apply patch and run update 5 - Pref is now set to 'exact_time' Signed-off-by: Hayley Mapley Signed-off-by: Nick Clemens --- ...set_default_value_for_NoRenewalBeforePrecision.perl | 10 ++++++++++ installer/data/mysql/sysprefs.sql | 1 + 2 files changed, 11 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_22044_set_default_value_for_NoRenewalBeforePrecision.perl diff --git a/installer/data/mysql/atomicupdate/bug_22044_set_default_value_for_NoRenewalBeforePrecision.perl b/installer/data/mysql/atomicupdate/bug_22044_set_default_value_for_NoRenewalBeforePrecision.perl new file mode 100644 index 0000000000..698afd3f73 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_22044_set_default_value_for_NoRenewalBeforePrecision.perl @@ -0,0 +1,10 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + $dbh->do( q{ + INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) + VALUES ('NoRenewalBeforePrecision', 'exact_time', 'Calculate "No renewal before" based on date or exact time. Only relevant for loans calculated in days, hourly loans are not affected.', 'date|exact_time', 'Choice'); + }); + $dbh->do("UPDATE systempreferences SET value='exact_time' WHERE variable='NoRenewalBeforePrecision' AND value IS NULL;" ); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 22044 - Set a default value for NoRenewalBeforePrecision)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index a490bd6a1e..f9cbb03f2b 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -312,6 +312,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('noissuescharge','5','','Define maximum amount withstanding before check outs are blocked','Integer'), ('NoIssuesChargeGuarantees','','','Define maximum amount withstanding before check outs are blocked','Integer'), ('noItemTypeImages','0',NULL,'If ON, disables item-type images','YesNo'), +('NoRenewalBefore','exact_time','date|exact_time','Calculate NoRenewalBefore based on date only or exact time of due date','Choice'), ('NotesBlacklist','',NULL,'List of notes fields that should not appear in the title notes/description separator of details','free'), ('NotHighlightedWords','and|or|not',NULL,'List of words to NOT highlight when OpacHitHighlight is enabled','free'), ('NoticeBcc','','','Email address to bcc outgoing notices sent by email','free'),