From f0dca45e9117be785a2fafcced496b333bb49e7e Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 9 Jun 2016 16:48:07 +0000 Subject: [PATCH] Bug 14048: [QA Followup] --- C4/Circulation.pm | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index a1dc440..2056265 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1437,14 +1437,20 @@ sub AddIssue { } ## If item was lost, it has now been found, reverse any list item charges if necessary. - if ( $item->{'itemlost'} ) { - if ( Koha::RefundLostItemFeeRules->should_refund( - current_branch => C4::Context->userenv->{ branch }, - patron_branch => $borrower->{ branchcode }, - item_home_branch => $item->{ homebranch }, - item_holding_branch => $item->{ holdingbranch } - ) ) { - _FixAccountForLostAndReturned( $item->{'itemnumber'}, undef, $item->{'barcode'} ); + if ( $item->{'itemlost'} && $borrower ) { + if ( + Koha::RefundLostItemFeeRules->should_refund( + { + current_branch => C4::Context->userenv->{branch}, + patron_branch => $borrower->{branchcode}, + item_home_branch => $item->{homebranch}, + item_holding_branch => $item->{holdingbranch} + } + ) + ) + { + _FixAccountForLostAndReturned( $item->{'itemnumber'}, undef, + $item->{'barcode'} ); } } @@ -2117,12 +2123,17 @@ sub AddReturn { $messages->{'WasLost'} = 1; if ( $item->{'itemlost'} ) { - if ( Koha::RefundLostItemFeeRules->should_refund( - current_branch => C4::Context->userenv->{ branch }, - patron_branch => $borrower->{ branchcode }, - item_home_branch => $item->{ homebranch }, - item_holding_branch => $item->{ holdingbranch } - ) ) { + if ( + Koha::RefundLostItemFeeRules->should_refund( + { + current_branch => C4::Context->userenv->{branch}, + patron_branch => $borrower->{branchcode}, + item_home_branch => $item->{homebranch}, + item_holding_branch => $item->{holdingbranch} + } + ) + ) + { _FixAccountForLostAndReturned( $item->{'itemnumber'}, $borrowernumber, $barcode ); $messages->{'LostItemFeeRefunded'} = 1; } -- 2.8.4