From c2fee12cd0f652b16929eb503793e3594e778a23 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 24 Oct 2022 18:36:46 -0300 Subject: [PATCH] Bug 23012: get_lostreturn_policy returns a scalar On commit 4d994773f83468b561896939f16131d0332d9cfc Koha::Item->_set_found_trigger gets the call to get_lostreturn_policy() changed so it expects a hashref instead of the scalar it returns. This patch adjusts it back. To test: 1. Run: $ kshell k$ prove t/db_dependent/Koha/Item.t => FAIL: Tests fail! 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests pass! Signed-off-by: Tomas Cohen Arazi --- Koha/Item.pm | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 25b4e54dc3..aa621396e0 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1159,15 +1159,13 @@ sub _set_found_trigger { return $self unless $lost_age_in_days < $no_refund_after_days; } - my $lost_proc_return_policy = Koha::CirculationRules->get_lostreturn_policy( - { - item => $self, + my $lostreturn_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 ) { @@ -1325,9 +1323,7 @@ sub _set_found_trigger { } } - my $processingreturn_policy = $lost_proc_return_policy->{lostreturn}; - - if ( $processingreturn_policy ) { + if ( $lostreturn_policy ) { # refund processing charge made for lost book my $processing_charge = Koha::Account::Lines->search( @@ -1355,7 +1351,7 @@ sub _set_found_trigger { # Use cases if ( $processing_charge->amount > $processing_charge->amountoutstanding && - $processingreturn_policy ne "refund_unpaid" + $lostreturn_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