fix the previous patch to add a syspref that permit to choose the renewal period...
[koha.git] / C4 / Circulation.pm
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.
     }