From 9aa5eb713d77b8363eb214e59fbc2c7d6b42ee6e 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 Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart --- 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 fcd0cee3f9..db01b57cc2 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2014,14 +2014,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 5e03e51515..74f09aba63 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -871,6 +871,7 @@ sub _set_found_trigger { ); $credit->apply( { debits => [$accountline] } ); + $self->{_refunded} = 1; } # Update the account status -- 2.39.5