From 514b234d60f637d428288ba30112b41dbb2f87b0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 23 May 2019 11:27:23 -0400 Subject: [PATCH] Bug 22982: Paying lost fee does not always remove lost item from checkouts Depending on how a lost fee is paid, it may or may not be removed from the patrons current checkouts. The current expected behavior is for the lost item to be removed from the patrons checkouts when the lost fee is paid in full. This is due to the subroutine for handling of lost fees being included in the 'pay specific lines' code but not in the 'pay by amount' code. Test Plan: 1) Apply this patch 2) prove t/db_dependent/Koha/Account.t Signed-off-by: Liz Rea Signed-off-by: Nadine Pierre --- Koha/Account.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 9d66e70f7c..5c8bcf30a7 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -108,7 +108,7 @@ sub pay { $fine->amountoutstanding($new_amountoutstanding)->store(); $balance_remaining = $balance_remaining - $amount_to_pay; - if ( $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'L' ) ) + if ( $new_amountoutstanding == 0 && $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'L' ) ) { C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); } @@ -164,6 +164,11 @@ sub pay { $fine->amountoutstanding( $old_amountoutstanding - $amount_to_pay ); $fine->store(); + if ( $fine->amountoutstanding == 0 && $fine->itemnumber && $fine->accounttype && ( $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