From 938eb3712dbfbc2faf1fa74abd452a7b00bea865 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 6 Dec 2018 15:59:10 -0300 Subject: [PATCH] Bug 21969: Fix Koha::Account->outstanding_* matching the opposite on pathological cases This patch makes outstanding_* methods be safe regarding pathological account lines that get converted into another type because of the value of amountoutstanding To test: - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: Tests fail because pathological account lines are wrongly picked. - Apply this patch - Run: k$ prove t/db_dependent/Koha/Account.t =>SUCCESS: All green! --- Koha/Account.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Koha/Account.pm b/Koha/Account.pm index 5630f4130e..4b68f2aaa9 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -430,6 +430,7 @@ sub outstanding_debits { my $lines = $self->lines->search( { + amount => { '>' => 0 }, amountoutstanding => { '>' => 0 } } ); @@ -448,6 +449,7 @@ sub outstanding_credits { my $lines = $self->lines->search( { + amount => { '<' => 0 }, amountoutstanding => { '<' => 0 } } ); -- 2.19.2