From 90f9a3c6aca2b767e11eed7114589b8144184bfb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 6 Dec 2016 09:22:11 +0100 Subject: [PATCH] Bug 17588: get_account_lines->get_balance has been replace with account->balance On previous bugs Signed-off-by: Josef Moravec Signed-off-by: Julian Maurice Signed-off-by: Kyle M Hall --- C4/Utils/DataTables/Members.pm | 2 +- circ/circulation.pl | 2 +- circ/returns.pl | 3 +-- members/moremember.pl | 2 +- t/db_dependent/Reserves.t | 8 ++++---- tools/cleanborrowers.pl | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index e4f12ccdeb..64f75a3be4 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -171,7 +171,7 @@ sub search { my $patron_object = Koha::Patrons->find( $patron->{borrowernumber} ); $patron->{overdues} = $patron_object->get_overdues->count; $patron->{issues} = $patron_object->get_issues->count; - my $balance = $patron_object->get_account_lines->get_balance; + my $balance = $patron_object->account->balance; # FIXME Should be formatted from the template $patron->{fines} = sprintf("%.2f", $balance); diff --git a/circ/circulation.pl b/circ/circulation.pl index 82cc89ed8c..10e695ea11 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -268,7 +268,7 @@ if ($borrowernumber) { $borrower = GetMember( borrowernumber => $borrowernumber ); my $overdues = $patron->get_overdues; my $issues = $patron->get_issues; - my $balance = $patron->get_account_lines->get_balance; + my $balance = $patron->account->balance; # if the expiry date is before today ie they have expired diff --git a/circ/returns.pl b/circ/returns.pl index d0a0027ca3..6b39d594b3 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -325,8 +325,7 @@ if ($barcode) { if ( C4::Context->preference("FineNotifyAtCheckin") ) { my $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); - my $account_lines = $patron->get_account_lines; - my $balance = $patron->get_account_lines->get_balance; + my $balance = $patron->account->balance; if ($balance > 0) { $template->param( fines => sprintf("%.2f", $balance) ); diff --git a/members/moremember.pl b/members/moremember.pl index c6ce1cdeb6..17c5436765 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -121,7 +121,7 @@ $template->param( error => $error ) if ( $error ); my $patron = Koha::Patrons->find($borrowernumber); my $issues = $patron->get_issues; -my $balance = $patron->get_account_lines->get_balance; +my $balance = $patron->account->balance; $template->param( issuecount => $issues->count, fines => $balance, diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index 8a63bde547..a70a28a270 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -572,7 +572,7 @@ ok( !C4::Reserves::OnShelfHoldsAllowed($item, $borrower), "OnShelfHoldsAllowed() $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); my $patron = Koha::Patrons->find( $borrowernumber ); -my $bz14464_fines = $patron->get_account_lines->get_balance; +my $bz14464_fines = $patron->account->balance; is( !$bz14464_fines || $bz14464_fines==0, 1, 'Bug 14464 - No fines at beginning' ); # First, test cancelling a reserve when there's no charge configured. @@ -599,7 +599,7 @@ CancelReserve({ reserve_id => $bz14464_reserve, charge_cancel_fee => 1 }); my $old_reserve = Koha::Database->new()->schema()->resultset('OldReserve')->find( $bz14464_reserve ); is($old_reserve->get_column('found'), 'W', 'Bug 14968 - Keep found column from reserve'); -$bz14464_fines = $patron->get_account_lines->get_balance; +$bz14464_fines = $patron->account->balance; is( !$bz14464_fines || $bz14464_fines==0, 1, 'Bug 14464 - No fines after cancelling reserve with no charge configured' ); # Then, test cancelling a reserve when there's no charge desired. @@ -623,7 +623,7 @@ ok( $bz14464_reserve, 'Bug 14464 - 2nd reserve correctly created' ); CancelReserve({ reserve_id => $bz14464_reserve }); -$bz14464_fines = $patron->get_account_lines->get_balance; +$bz14464_fines = $patron->account->balance; is( !$bz14464_fines || $bz14464_fines==0, 1, 'Bug 14464 - No fines after cancelling reserve with no charge desired' ); # Finally, test cancelling a reserve when there's a charge desired and configured. @@ -645,7 +645,7 @@ ok( $bz14464_reserve, 'Bug 14464 - 1st reserve correctly created' ); CancelReserve({ reserve_id => $bz14464_reserve, charge_cancel_fee => 1 }); -$bz14464_fines = $patron->get_account_lines->get_balance; +$bz14464_fines = $patron->account->balance; is( int( $bz14464_fines ), 42, 'Bug 14464 - Fine applied after cancelling reserve with charge desired and configured' ); # tests for MoveReserve in relation to ConfirmFutureHolds (BZ 14526) diff --git a/tools/cleanborrowers.pl b/tools/cleanborrowers.pl index 767e8d6b18..dfc47ffbe7 100755 --- a/tools/cleanborrowers.pl +++ b/tools/cleanborrowers.pl @@ -200,7 +200,7 @@ sub _skip_borrowers_with_nonzero_balance { my $balance; @$borrowers = map { my $patron = Koha::Patrons->find( $_->{borrowernumber} ); - my $balance = $patron->get_account_lines->get_balance; + my $balance = $patron->account->balance; (defined $balance && $balance != 0) ? (): ($_); } @$borrowers; } -- 2.39.5