From bf793c3fe0e9007e81d0258ac26a70c38aa02978 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 25 Nov 2019 13:18:16 -0500 Subject: [PATCH] Bug 24106: In returns.pl, don't search for item if no barcode is provided When loading returns.pl, code to check rotating collections fires off an search for items by barcode, but doesn't check for a barcode first. This means the code will search for items where barcode is NULL, which is definitely not the intended function. Test Plan: 1) Apply this patch 2) Set up a rotating collection with items 3) Transfer the collection 4) Check in a rotating collection item 5) Note no change in functionality Signed-off-by: Liz Rea Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- circ/returns.pl | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/circ/returns.pl b/circ/returns.pl index 5e7d8e24bc..a9e2bc243c 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -634,19 +634,21 @@ $template->param( AudioAlerts => C4::Context->preference("AudioAlerts"), ); -my $item_from_barcode = Koha::Items->find({barcode => $barcode }); # How many times do we fetch this item?!? -if ( $item_from_barcode ) { - $itemnumber = $item_from_barcode->itemnumber; - my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber ); - if ( $holdingBranch and $collectionBranch ) { - $holdingBranch //= ''; - $collectionBranch //= $returnbranch; - if ( ! ( $holdingBranch eq $collectionBranch ) ) { - $template->param( - collectionItemNeedsTransferred => 1, - collectionBranch => $collectionBranch, - itemnumber => $itemnumber, - ); +if ( $barcode ) { + my $item_from_barcode = Koha::Items->find({barcode => $barcode }); # How many times do we fetch this item?!? + if ( $item_from_barcode ) { + $itemnumber = $item_from_barcode->itemnumber; + my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber ); + if ( $holdingBranch and $collectionBranch ) { + $holdingBranch //= ''; + $collectionBranch //= $returnbranch; + if ( ! ( $holdingBranch eq $collectionBranch ) ) { + $template->param( + collectionItemNeedsTransferred => 1, + collectionBranch => $collectionBranch, + itemnumber => $itemnumber, + ); + } } } } -- 2.39.5