@@ -, +, @@ from checkouts --- Koha/Account.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/Koha/Account.pm +++ a/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, --