From 1971babc6cf1e5b61145905ab392b9f53bcdecd7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 14 Aug 2020 09:56:41 +0200 Subject: [PATCH] Bug 18501: wip - need to know it has been refunded Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart --- C4/Circulation.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index dfdbb1a5fa..fcd0cee3f9 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2012,8 +2012,18 @@ sub AddReturn { $item->holdingbranch($branch)->store; } + my $item_was_lost = $item->itemlost; my $leave_item_lost = C4::Context->preference("BlockReturnOfLostItems") ? 1 : 0; - ModDateLastSeen( $item->itemnumber, $leave_item_lost ); + ModDateLastSeen( $item->itemnumber, $leave_item_lost ); # will unset itemlost if needed + + # fix up the accounts..... + if ( $item_was_lost ) { + $messages->{'WasLost'} = 1; + unless ( C4::Context->preference("BlockReturnOfLostItems") ) { + #my $refunded = Koha::Account::Lines->search{(itemnumber => $item->itemnumber, type => 'LOST_FOUND', # FIXME which other parameters to know it has been refunded? + $messages->{'LostItemFeeRefunded'} = 1; + } + } # check if we have a transfer for this document my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->itemnumber ); @@ -2035,14 +2045,6 @@ sub AddReturn { } } - # fix up the accounts..... - if ( $item->itemlost ) { - $messages->{'WasLost'} = 1; - unless ( C4::Context->preference("BlockReturnOfLostItems") ) { - $messages->{'LostItemFeeRefunded'} = $refunded; - } - } - # fix up the overdues in accounts... if ($borrowernumber) { my $fix = _FixOverduesOnReturn( $borrowernumber, $item->itemnumber, $exemptfine, 'RETURNED' ); -- 2.39.5