This fix the way to call CalcDueDate, the $borrower was missing.
Then, the block to calculate the new duedate was duplicated when the 
renewalperiodbase was applied, this patch delete the "bad" block.
---
 C4/Circulation.pm |   17 +----------------
 1 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index b604406..ebe84f1 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -1958,21 +1958,6 @@ sub AddRenewal {
     my $datedue = shift;
     my $lastreneweddate = shift;
 
-    # If the due date wasn't specified, calculate it by adding the
-    # book's loan length to today's date.
-    unless ($datedue && $datedue->output('iso')) {
-
-        my $borrower = C4::Members::GetMemberDetails( $borrowernumber, 0 ) or 
return undef;
-        my $loanlength = GetLoanLength(
-            $borrower->{'categorycode'},
-             (C4::Context->preference('item-level_itypes')) ? 
$biblio->{'itype'} : $biblio->{'itemtype'} ,
-                       $item->{homebranch}                     # item's 
homebranch determines loanlength OR do we want the branch specified by the 
AddRenewal argument?
-        );
-               #FIXME -- use circControl?
-               $datedue =  
CalcDateDue(C4::Dates->new(),$loanlength,$branch,$borrower);        # this 
branch is the transactional branch.
-                                                               # The question 
of whether to use item's homebranch calendar is open.
-    }
-
     # $lastreneweddate defaults to today.
     unless (defined $lastreneweddate) {
         $lastreneweddate = strftime( "%Y-%m-%d", localtime );
@@ -2004,7 +1989,7 @@ sub AddRenewal {
                                         C4::Dates->new($issuedata->{date_due}, 
'iso') :
                                         C4::Dates->new();
         #FIXME -- use circControl?
-        $datedue =  CalcDateDue($datedue,$loanlength,$branch); # this branch 
is the transactional branch.
+        $datedue =  CalcDateDue($datedue,$loanlength,$branch,$borrower);       
# this branch is the transactional branch.
         # The question of whether to use item's homebranch calendar is open.
     }
 
-- 
1.6.0.4

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to