From 447992444468b3b4f4075c91128e06c3cb0a17e5 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! Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Nick Clemens (cherry picked from commit dbff938c7ff7eb277c6b94b56b5f03d3348f0017) Signed-off-by: Martin Renvoize --- 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.39.5