From a31a6bb3523d8b67332978bfae8d1a07cca26edc Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 25 Oct 2022 14:36:45 -0300 Subject: [PATCH] Revert "Bug 23012: get_lostreturn_policy returns a scalar" This reverts commit c2fee12cd0f652b16929eb503793e3594e778a23. Signed-off-by: Tomas Cohen Arazi --- Koha/Item.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index aa621396e0..25b4e54dc3 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1159,13 +1159,15 @@ sub _set_found_trigger { return $self unless $lost_age_in_days < $no_refund_after_days; } - my $lostreturn_policy = Koha::CirculationRules->get_lostreturn_policy( - { item => $self, + my $lost_proc_return_policy = Koha::CirculationRules->get_lostreturn_policy( + { + item => $self, return_branch => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, } - ); + ); + my $lostreturn_policy = $lost_proc_return_policy->{lostreturn}; if ( $lostreturn_policy ) { @@ -1323,7 +1325,9 @@ sub _set_found_trigger { } } - if ( $lostreturn_policy ) { + my $processingreturn_policy = $lost_proc_return_policy->{lostreturn}; + + if ( $processingreturn_policy ) { # refund processing charge made for lost book my $processing_charge = Koha::Account::Lines->search( @@ -1351,7 +1355,7 @@ sub _set_found_trigger { # Use cases if ( $processing_charge->amount > $processing_charge->amountoutstanding && - $lostreturn_policy ne "refund_unpaid" + $processingreturn_policy ne "refund_unpaid" ) { # some amount has been cancelled. collect the offsets that are not writeoffs # this works because the only way to subtract from this kind of a debt is -- 2.39.5