@@ -, +, @@ --- C4/Accounts.pm | 21 +++++++++++++++++++++ C4/Overdues.pm | 19 ------------------- C4/SIP/ILS/Transaction/Renew.pm | 2 +- 3 files changed, 22 insertions(+), 20 deletions(-) --- a/C4/Accounts.pm +++ a/C4/Accounts.pm @@ -49,6 +49,7 @@ BEGIN { &makepartialpayment &recordpayment_selectaccts &WriteOffFee + &GetTotalFines ); } @@ -824,6 +825,26 @@ sub WriteOffFee { } +=head2 GetTotalFines + + my $total_fines_owed = GetTotalFines( $borrowernumber ); + + Returns the total amount owed by the given borrower. + +=cut + +sub GetTotalFines { + my ( $borrowernumber ) = @_; + my $dbh = C4::Context->dbh(); + my $query = "SELECT SUM( amountoutstanding ) AS total FROM accountlines WHERE borrowernumber = ?"; + my $sth = $dbh->prepare( $query ); + $sth->execute( $borrowernumber ); + my $row = $sth->fetchrow_hashref(); + my $total = $row->{'total'}; + $total = $total || 0; + return $total; +} + END { } # module clean-up code here (global destructor) 1; --- a/C4/Overdues.pm +++ a/C4/Overdues.pm @@ -668,25 +668,6 @@ sub GetFine { return 0; } -=head2 GetTotalFines - - my $total_fines_owed = GetTotalFines( $borrowernumber ); - - Returns the total amount owed by the given borrower. - -=cut - -sub GetTotalFines { - my ( $borrowernumber ) = @_; - my $dbh = C4::Context->dbh(); - my $query = "SELECT SUM( amountoutstanding ) AS total FROM accountlines WHERE borrowernumber = ?"; - my $sth = $dbh->prepare( $query ); - $sth->execute( $borrowernumber ); - my $row = $sth->fetchrow_hashref(); - my $total = $row->{'total'}; - $total = $total || 0; - return $total; -} =head2 NumberNotifyId --- a/C4/SIP/ILS/Transaction/Renew.pm +++ a/C4/SIP/ILS/Transaction/Renew.pm @@ -46,7 +46,7 @@ sub do_renew_for { } - unless ( C4::Overdues::GetTotalFines($borrower->{borrowernumber}) < C4::Context->preference('OPACFineNoRenewals') ) { + unless ( C4::Accounts::GetTotalFines($borrower->{borrowernumber}) < C4::Context->preference('OPACFineNoRenewals') ) { $renewokay = 0; $renewerror = 'too_many_fines' } --