Bug 24380: (RM follow-up) Fix update statement to prevent regression
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 22 May 2020 13:49:06 +0000 (14:49 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 22 May 2020 13:49:06 +0000 (14:49 +0100)
The update statement did not respect the original value of
CalcalateFinesOnReturn and so would result in an unexpected functional
change during upgrades.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

installer/data/mysql/updatedatabase.pl

index 21572b5..e2cffe9 100755 (executable)
@@ -21631,8 +21631,9 @@ if( CheckVersion( $DBversion ) ) {
 $DBversion = '19.12.00.072';
 if( CheckVersion( $DBversion ) ) {
     $dbh->do(q{
-        INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
-        ('CalculateFinesOnBackdate','1','','Switch to control if overdue fines are calculated on return when backdating','YesNo');
+        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
+            SELECT 'CalculateFinesOnBackdate',value,'','Switch to control if overdue fines are calculated on return when backdating','YesNo'
+            FROM ( SELECT value FROM systempreferences WHERE variable = 'CalculateFinesOnReturn' ) tmp
     });
 
     NewVersion( $DBversion, 24380, "Add syspref CalculateFinesOnBackdate");