From 80bef548750c3ae0ba9dee70f4d5833ef7cdd133 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 20 Aug 2020 13:28:41 +0100 Subject: [PATCH] Bug 18501: (follow-up) Do not rely on userenv->{branchcode} Signed-off-by: Jonathan Druart --- Koha/CirculationRules.pm | 4 ++-- Koha/Item.pm | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm index 9bf1ab860e..87062f541a 100644 --- a/Koha/CirculationRules.pm +++ b/Koha/CirculationRules.pm @@ -439,8 +439,8 @@ sub get_lostreturn_policy { my $behaviour = C4::Context->preference( 'RefundLostOnReturnControl' ) // 'CheckinLibrary'; my $behaviour_mapping = { - CheckinLibrary => $params->{'return_branch'}, - ItemHomeBranch => $item->homebranch, + CheckinLibrary => $params->{'return_branch'} // $item->homebranch, + ItemHomeBranch => $item->homebranch, ItemHoldingBranch => $item->holdingbranch }; diff --git a/Koha/Item.pm b/Koha/Item.pm index 84ba2da33c..8dffac4db5 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -811,8 +811,10 @@ sub _set_found_trigger { return $self unless Koha::CirculationRules->get_lostreturn_policy( { - current_branch => C4::Context->userenv->{branch}, - item => $self, + item => $self, + return_branch => C4::Context->userenv + ? C4::Context->userenv->{'branch'} + : undef, } ); -- 2.39.5