From 3d945c494266aec8fe376cd063309521715a90ed Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 5 Jul 2018 18:05:11 +0000 Subject: [PATCH] Bug 21042: Make 'pay amount' also return lost fines To test: 1 - Checkout an item to a patron, and make it lost ( but not returned) and ensure fine is levied against the account 2 - Add some other fines to their account 3 - Click 'Pay amount' and pay everything they owe 4 - Note the book is not returned 5 - Repeat with 'Pay selected' and note item is returned 6 - Apply patch 7 - Repeat 1-5 and note item is returned in both cases https://bugs.koha-community.org/show_bug.cgi?id=21014 Signed-off-by: marieluce --- Koha/Account.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Koha/Account.pm b/Koha/Account.pm index 4da0c1c5ad..431d088a47 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -164,6 +164,11 @@ sub pay { $fine->amountoutstanding( $old_amountoutstanding - $amount_to_pay ); $fine->store(); + if ( $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'Rep' || $fine->accounttype eq 'L' ) ) + { + C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); + } + my $account_offset = Koha::Account::Offset->new( { debit_id => $fine->id, -- 2.17.1