From fec34d7a3d6d7a19897f8dba184cd94fe2033e67 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 14 Aug 2020 10:48:00 +0200 Subject: [PATCH] Bug 18501: set the is_refunded flag as internal var After discussion with Martin we decided that it could be the correct way Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 5 ++--- Koha/Item.pm | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2971360787..8cf115e4ee 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2041,14 +2041,13 @@ sub AddReturn { my $item_was_lost = $item->itemlost; my $leave_item_lost = C4::Context->preference("BlockReturnOfLostItems") ? 1 : 0; - ModDateLastSeen( $item->itemnumber, $leave_item_lost ); # will unset itemlost if needed + my $updated_item = 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; + $messages->{'LostItemFeeRefunded'} = $updated_item->{_refunded}; } } diff --git a/Koha/Item.pm b/Koha/Item.pm index 9b9203d86f..a2976d2ce8 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -870,6 +870,7 @@ sub _set_found_trigger { ); $credit->apply( { debits => [$accountline] } ); + $self->{_refunded} = 1; } # Update the account status -- 2.20.1