diff --git a/C4/Circulation.pm b/C4/Circulation.pm index afcec2d895..9cf19fe20b 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2400,19 +2400,24 @@ sub AddReturn { my $patron = $issue->patron; $patron_unblessed = $patron->unblessed; } - _CalculateAndUpdateFine( - { - issue => $issue, - item => $item->unblessed, - borrower => $patron_unblessed, - return_date => $return_date - } - ); - _FixOverduesOnReturn( - $patron_unblessed->{borrowernumber}, - $item->itemnumber, undef, 'RETURNED' - ); - $messages->{'LostItemFeeCharged'} = 1; + + # Confirm the lost charge came from the most recent patron to return the item + # and only charge the fine if so + if ( $message->payload->{patron_id} == $patron_unblessed->{borrowernumber} ) { + _CalculateAndUpdateFine( + { + issue => $issue, + item => $item->unblessed, + borrower => $patron_unblessed, + return_date => $return_date + } + ); + _FixOverduesOnReturn( + $patron_unblessed->{borrowernumber}, + $item->itemnumber, undef, 'RETURNED' + ); + $messages->{'LostItemFeeCharged'} = 1; + } } } } diff --git a/Koha/Item.pm b/Koha/Item.pm index 0631e73459..87e6dd8c31 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1755,10 +1755,12 @@ sub _set_found_trigger { } } elsif ( $lostreturn_policy eq 'charge' && ( $lost_overdue || $lost_charge ) ) { + my $patron_id = $lost_overdue ? $lost_overdue->borrowernumber : $lost_charge->borrowernumber; $self->add_message( { type => 'info', message => 'lost_charge', + payload => { patron_id => $patron_id } } ); }