From 31b321b36b7be0d3b0ebec550840a67293bc5485 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 12 Nov 2007 20:06:00 -0600 Subject: [PATCH] Fixing a bug that was causing a charge to be added twice if renewing in circulation Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Circulation.pm | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 0a03c004dd..45e964df5d 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -855,28 +855,11 @@ if ($borrower and $barcode and $barcodecheck ne '0'){ # check if we just renew the issue. # if ( $actualissue->{borrowernumber} eq $borrower->{'borrowernumber'} ) { - # we renew, do we need to add some charge ? - my ( $charge, $itemtype ) = GetIssuingCharges( - $item->{'itemnumber'}, - $borrower->{'borrowernumber'} - ); - if ( $charge > 0 ) { - AddIssuingCharge( - $item->{'itemnumber'}, - $borrower->{'borrowernumber'}, $charge - ); - $item->{'charge'} = $charge; - } - &UpdateStats( - C4::Context->userenv->{'branch'}, - 'renew', $charge, - '', $item->{'itemnumber'}, - $biblio->{'itemtype'}, $borrower->{'borrowernumber'} - ); AddRenewal( $borrower->{'borrowernumber'}, $item->{'itemnumber'} ); + } else {# it's NOT a renewal if ( $actualissue->{borrowernumber}) { @@ -1659,7 +1642,7 @@ sub AddRenewal { $sth->finish; # Log the renewal - UpdateStats( C4::Context->userenv->{'branchcode'}, 'renew', '', '', $itemnumber ); + # Charge a new rental fee, if applicable? my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); @@ -1678,6 +1661,7 @@ sub AddRenewal { 'Rent', $charge, $itemnumber ); $sth->finish; } + UpdateStats( C4::Context->userenv->{'branchcode'}, 'renew', $charge, '', $itemnumber ); } =head2 GetIssuingCharges -- 2.39.5