From f285e2d88376381173f750da06fa77e0056821b6 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 21 Jun 2021 17:08:33 +0100 Subject: [PATCH] Bug 22435: (QA follow-up) Fix returned offsets in moredetail This patch updates the offsets query for lost item returns displayed in the catalogue/moredetail controller. Test plan 1/ Check item detail display for a lost item at various stages of lost and charged for (Lost, Writeoff, Forgiven, Paid, Found) 2/ Compare before the patchset and after - There should be no difference --- catalogue/moredetail.pl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 94a7eab12f..a6d9463c74 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -209,14 +209,13 @@ foreach my $item (@items){ ); if ( my $accountline = $accountlines->next ) { - my $payment_offsets = Koha::Account::Offsets->search( + my $payment_offsets = $accountline->debit_offsets( { - debit_id => $accountline->id, credit_id => { '!=' => undef }, # it is not the debit itself - type => { '!=' => [ 'Writeoff', 'Forgiven' ] }, - amount => { '<' => 0 } # credits are negative on the DB + 'credit.credit_type_code' => + { '!=' => [ 'Writeoff', 'Forgiven' ] }, }, - { order_by => { '-desc' => 'created_on' } } + { join => 'credit', order_by => { '-desc' => 'created_on' } } ); if ($payment_offsets->count) { -- 2.20.1