From 51d40eef106d3e75f5893c30d0daeaccc7ea076d 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 --- circ/returns.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circ/returns.pl b/circ/returns.pl index 0924da5..677c91e 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.1.4