diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 80cead8a96..ab8438ae67 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2329,6 +2329,10 @@ sub AddReturn { my $patron = $issue->patron; $patron_unblessed = $patron->unblessed; } + + # 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, @@ -2344,6 +2348,7 @@ sub AddReturn { } } } + } # check if we have a transfer for this document my $transfer = $item->get_transfer; diff --git a/Koha/Item.pm b/Koha/Item.pm index 07fc6ad5c8..0de5531f1e 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1666,10 +1666,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 } } ); }