fix the previous patch to add a syspref that permit to choose the renewal period...
authorNahuel Angelinetti <nahuel.angelinetti@biblibre.com>
Wed, 12 Nov 2008 09:16:22 +0000 (10:16 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Fri, 6 Mar 2009 10:09:26 +0000 (11:09 +0100)
This patch just check the syspref and use it as base date of renew.

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
C4/Circulation.pm
installer/data/mysql/en/mandatory/sysprefs.sql
installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
installer/data/mysql/updatedatabase30.pl
kohaversion.pl

index ff3af6a..2d852bd 100644 (file)
@@ -1987,8 +1987,11 @@ sub AddRenewal {
                        $item->{homebranch}                     # item's homebranch determines loanlength OR do we want the branch specified by the AddRenewal argument?
         );
 
+        $datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
+                                        C4::Dates->new($issuedata->{date_due}, 'iso') :
+                                        C4::Dates->new();
         #FIXME -- use circControl?
-        $datedue =  CalcDateDue(C4::Dates->new($issuedata->{date_due}, 'iso'),$loanlength,$branch);    # this branch is the transactional branch.
+        $datedue =  CalcDateDue($datedue,$loanlength,$branch); # this branch is the transactional branch.
         # The question of whether to use item's homebranch calendar is open.
     }
 
index 51e192b..5f58765 100644 (file)
@@ -213,3 +213,4 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', 'if ON, allows renewal limits to be overridden on the circulation screen',NULL,'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MergeAuthoritiesOnUpdate', '1', 'if ON, Updating authorities will automatically updates biblios',NULL,'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowNotForLoanOverride', '0', 'if ON, enables the librarian to choose when they want to check out a notForLoan regular item',NULL,'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RenewalPeriodBase', 'date_due', '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');
index 4107a3c..17cb8b8 100644 (file)
@@ -213,3 +213,4 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '1', 'Si Activé, permet que les périodes de renouvellement puisse être positionnée manuellement durant la circulation',NULL,'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MergeAuthoritiesOnUpdate', '0', 'Si Activé, met à jour toutes les notices bibliographiques afférentes dès la modification d''une autorité',NULL,'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowNotForLoanOverride', '0', 'Si activé, permet au bibliothécaire de choisir de prêter tout de même un exemplaire normalement exclu du prêt',NULL,'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RenewalPeriodBase', 'date_due', 'Permet de déterminer si la période de renouvellement doit être calculée sur la date de retour ou sur le jour du renouvellement','date_due|now','Choice');
index e6fda8b..e44d53d 100644 (file)
@@ -162,6 +162,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.00.01.007";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do(<<ENDOFRENEWAL);
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RenewalPeriodBase', 'date_due', '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
index 761c687..38cd212 100644 (file)
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.00.01.006';
+    our $VERSION = '3.00.01.007';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install