From 660732429669434618f55c7467da56bff0da2475 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Sat, 16 Jun 2018 09:44:19 -0300 Subject: [PATCH] Bug 20946: Remove credits from the 'Pay fines' tab in pay.pl This patch changes the query for outstanding account lines so it doesn't pick credits, which don't belong to the 'Pay fines' tab, and actually break form validation for payments. To test: - Add a $5 credit to a patron - Add a $1 fine - Go to the 'Pay fines' tab => FAIL: Credit is displayed - Try to pay all fines => FAIL: You are told to enter a value less than or equal to -4.00 (Observe you cannot do that) - Apply this patch - Reload => SUCCESS: Credit is not displayed => SUCCESS: You are able to pay all fines - Sign off :-D --- members/pay.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/members/pay.pl b/members/pay.pl index 53a8f37794..451cc05e68 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -140,7 +140,10 @@ sub add_accounts_to_template { my $patron = Koha::Patrons->find( $borrowernumber ); my $total = $patron->account->balance; - my $account_lines = Koha::Account::Lines->search({ borrowernumber => $borrowernumber, amountoutstanding => { '!=' => 0 } }, { order_by => ['accounttype'] }); + my $account_lines + = Koha::Account::Lines->search( + { borrowernumber => $borrowernumber, amountoutstanding => { '>' => 0 } }, + { order_by => ['accounttype'] } ); my @accounts; while ( my $account_line = $account_lines->next ) { $account_line = $account_line->unblessed; -- 2.17.1