From 6f1e5eabdcfc8d002bf8ded3612fb0aebb23af6f 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 +++++++++++++++++++++++++-------------- Koha/RefundLostItemFeeRules.pm | 3 +++ 2 files changed, 28 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; } diff --git a/Koha/RefundLostItemFeeRules.pm b/Koha/RefundLostItemFeeRules.pm index 2332630..7363467 100644 --- a/Koha/RefundLostItemFeeRules.pm +++ b/Koha/RefundLostItemFeeRules.pm @@ -63,6 +63,8 @@ sub should_refund { my $self = shift; my $params = shift; + use Carp; + carp "PARAMS: " . Data::Dumper::Dumper( $params ); return $self->_effective_branch_rule( $self->_choose_branch( $params ) ); } @@ -106,6 +108,7 @@ sub _choose_branch { my $self = shift; my $param = shift; + warn "PARAM: " . Data::Dumper::Dumper( $param ); my $behaviour = Koha::Config::SysPrefs ->find( 'RefundLostOnReturnControl' ) -- 2.1.4