From c916d0001bd03a764ec0b1926a2ca4327e356ea0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 5 Jan 2018 11:42:03 -0300 Subject: [PATCH] Bug 19899: Restore Item floats feature - do not crash Error is "The method noreturn is not covered by tests!" caused by commit 6eade474ed3a84a5ba372a26ac27bf9fb4bd2299 Bug 18276: Remove GetBiblioFromItemNumber - Easy ones When the "Return policy" (var returnbranch) is set to "Item floats" (value noreturn) the library must be the current library (from userenv). This behaviour is used in C4::Circulation::AddReturn On bug 18276 I assumed that the value was either holdingbranch or homebranch, and forgot it could be "noreturn" Test plan: Set Return policy to Item floats Check an item in => without this patch it explodes => With this patch applied it will check the item in Signed-off-by: Mohd Hafiz Yusoff Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- circ/returns.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circ/returns.pl b/circ/returns.pl index 0924da5d2f..677c91e2c5 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -276,7 +276,7 @@ if ($barcode) { # make sure return branch respects home branch circulation rules, default to homebranch my $hbr = GetBranchItemRule($item->homebranch, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch"; - $returnbranch = $item->$hbr; + $returnbranch = $hbr ne 'noreturn' ? $item->$hbr : $userenv_branch; # can be noreturn, homebranch or holdingbranch my $materials = $item->materials; my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials }); -- 2.39.5