From: Tomas Cohen Arazi Date: Thu, 29 Nov 2018 15:10:21 +0000 (-0300) Subject: Bug 21909: Make Koha::Account::outstanding_* preserve context X-Git-Tag: v19.05.00~1541 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=d3ff671f215398ad51a6ce550c33c0c6ca3aa30a;hp=85c474e59761e2bb27d9921180752249b5edca9e;p=srvgit Bug 21909: Make Koha::Account::outstanding_* preserve context This patch modifies the methods so they preserve the caller's context (list and scalar). To test: - Apply the first patch - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: outstanding_credits and outstanding_debits tests fail - Apply this patch - Run: k$ prove t/db_dependent/Koha/Account.t => SUCCESS: We are so happy now :-D - Sign off :-D Signed-off-by: Martin Renvoize Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens --- diff --git a/Koha/Account.pm b/Koha/Account.pm index 4b68f2aaa9..304d0e2743 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -428,14 +428,12 @@ my $lines = Koha::Account->new({ patron_id => $patron_id })->outstanding_debits; sub outstanding_debits { my ($self) = @_; - my $lines = $self->lines->search( + return $self->lines->search( { amount => { '>' => 0 }, amountoutstanding => { '>' => 0 } } ); - - return $lines; } =head3 outstanding_credits @@ -447,14 +445,12 @@ my $lines = Koha::Account->new({ patron_id => $patron_id })->outstanding_credits sub outstanding_credits { my ($self) = @_; - my $lines = $self->lines->search( + return $self->lines->search( { amount => { '<' => 0 }, amountoutstanding => { '<' => 0 } } ); - - return $lines; } =head3 non_issues_charges