bug 2770: add RenewalPeriodBase syspref for 3.2 (DB rev 032)
authorGalen Charlton <galen.charlton@liblime.com>
Mon, 11 May 2009 20:25:14 +0000 (15:25 -0500)
committerGalen Charlton <galen.charlton@liblime.com>
Mon, 11 May 2009 20:36:37 +0000 (15:36 -0500)
Reconciliation patch to add the RenewalPeriodBase system
preference, which per code by Nahuel Angelinetti changes
the process of calculating the due date after a renewal:

If RenewalPeriodBase is set to 'now', the due date is
set to the current date + the loan period.  This is the
current behavior.

If RenewalPeriodBase is set to 'date_due', the due date
is set to the due date before the renewal + the loan period.

Unless like the corresonding database update in the 3.0.x branch
(3.00.01.007), the default value of RenewalPeriodBase is set to
'now' so as not to unexpectedly change the calculation.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
admin/systempreferences.pl
installer/data/mysql/updatedatabase.pl

index c24a17f..ca8503e 100755 (executable)
@@ -160,6 +160,7 @@ $tabsysprefs{UseBranchTransferLimits}        = "Circulation";
 $tabsysprefs{AllowHoldPolicyOverride}        = "Circulation";
 $tabsysprefs{BranchTransferLimitsType}       = "Circulation";
 $tabsysprefs{AllowNotForLoanOverride}        = "Circulation";
+$tabsysprefs{RenewalPeriodBase}              = "Circulation";
 
 # Staff Client
 $tabsysprefs{TemplateEncoding}        = "StaffClient";
index 15e1c08..6d78921 100755 (executable)
@@ -2406,6 +2406,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.01.00.032";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do(<<ENDOFRENEWAL);
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RenewalPeriodBase', 'now', 'Set whether the renewal date should be counted from the date_due or from the moment the Patron asks for renewal ','date_due|now','Choice');
+ENDOFRENEWAL
+    print "Upgrade to $DBversion done (Change the field)\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table