From c7f9e240e6d458fbaba8dd6bb017f3a676b3d469 Mon Sep 17 00:00:00 2001 From: Rafal Kopaczka Date: Fri, 28 Mar 2014 09:37:54 +0100 Subject: [PATCH 2/3] Bug 9481 (follow-up) - change parameter order in routine Only small change in parameters order. Because other routines in C4::Overudes gets first itemnumber then borrowernumber, changed this to stay consistent. --- C4/Overdues.pm | 9 ++++----- circ/circulation.pl | 2 +- members/moremember.pl | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index be0e0aa..a53b3f5 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -661,21 +661,20 @@ sub GetFine { =head2 GetItemCharges - $charges = GetItemCharges( $borrowernumber, $itemnumber ) + $charges = GetItemCharges( $itemnumber , $borrowernumber) Gets fines and issue charge for item from accountlines. Icluding all outstanding amount for specific item, also from previous issue of this item. - + =cut sub GetItemCharges { - my ( $borrowernumber, $itemnumber ) = @_; - + my ( $itemnumber, $borrowernumber ) = @_; my $dbh = C4::Context->dbh(); my $query = "SELECT SUM(amountoutstanding) FROM accountlines WHERE borrowernumber = ? AND itemnumber = ? "; my $sth = $dbh->prepare( $query ); $sth->execute( $borrowernumber, $itemnumber ); - return $sth->fetchrow_arrayref()->[0]; + return $sth->fetchrow_arrayref()->[0] || 0; } =head2 NumberNotifyId diff --git a/circ/circulation.pl b/circ/circulation.pl index 131fe35..18f0a22 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -480,7 +480,7 @@ sub build_issue_data { $it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'}; $it->{'charge'} = GetItemCharges( - $it->{'borrowernumber'}, $it->{'itemnumber'} + $it->{'itemnumber'}, $it->{'borrowernumber'} ); $it->{'charge'} = sprintf("%.2f", $it->{'charge'}); my ($can_renew, $can_renew_error) = CanBookBeRenewed( diff --git a/members/moremember.pl b/members/moremember.pl index e7ac52a..ce84c08 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -504,7 +504,7 @@ sub build_issue_data { } #find all charges for an item - my $charge = GetItemCharges( $borrowernumber, $issue->{itemnumber} ); + my $charge = GetItemCharges( $issue->{itemnumber}, $borrowernumber ); my $getiteminfo = GetBiblioFromItemNumber( $issue->{'itemnumber'} ); my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} ); -- 1.7.10.4