From 59b533ff228f1977d66ffb175b44d2a3d3d19c5f 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 --- 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 e4f12cc..64f75a3 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 82cc89e..10e695e 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 25715e4..1354355 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -324,8 +324,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 3955655..ca2dcad 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 327b7e0..41d214d 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -573,7 +573,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. @@ -600,7 +600,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. @@ -624,7 +624,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. @@ -646,7 +646,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 d2713b5..be81573 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.9.3