From 39c872a71e8d8448310a3daeb6224d4b21a2d162 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 5 Feb 2020 13:10:49 +0000 Subject: [PATCH] Bug 24474: Filter out LOST_FOUND Signed-off-by: David Nind Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize --- Koha/Account/Line.pm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 8f10ac3ace..155ae4e29b 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -492,14 +492,22 @@ sub apply { } # Same logic exists in Koha::Account::pay - if ( $debit->amountoutstanding == 0 - && $debit->itemnumber + if ( + C4::Context->preference('MarkLostItemsAsReturned') =~ + m|onpayment| && $debit->debit_type_code - && $debit->debit_type_code eq 'LOST' ) + && $debit->debit_type_code eq 'LOST' + && $debit->amountoutstanding == 0 + && $debit->itemnumber + && !( + $self->credit_type_code eq 'LOST_FOUND' + && $self->itemnumber == $debit->itemnumber + ) + ) { - C4::Circulation::ReturnLostItem( $self->borrowernumber, $debit->itemnumber ); + C4::Circulation::ReturnLostItem( $self->borrowernumber, + $debit->itemnumber ); } - } }); -- 2.39.5