From c86d7fe231a9abc40d8a7e8b5c0e0b612e1937b7 Mon Sep 17 00:00:00 2001
From: Julian Maurice <julian.maurice@biblibre.com>
Date: Tue, 19 Apr 2016 12:15:46 +0200
Subject: [PATCH] Bug 15565: Set 'found' parameter correctly when
 ReservesNeedReturns is off
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Danielle Elder <danielle@bywatersolution.com>

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
---
 reserve/placerequest.pl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl
index 6b9b984..91c9ff4 100755
--- a/reserve/placerequest.pl
+++ b/reserve/placerequest.pl
@@ -72,13 +72,13 @@ foreach my $bibnum (@biblionumbers) {
 
 my @found;
 
-foreach my $checkitem (@checkitems) {
-    # if we have an item selectionned, and the pickup branch is the same as the holdingbranch
-    # of the document, we force the value $rank and $found .
-    $rank[0] = '0' unless C4::Context->preference('ReservesNeedReturns');
-    my $item = GetItem($checkitem);
-    if ( $item->{'holdingbranch'} eq $branch ){
-        push @found, 'W' unless C4::Context->preference('ReservesNeedReturns');
+unless (C4::Context->preference('ReservesNeedReturns')) {
+    foreach my $checkitem (@checkitems) {
+        # if we have an item selectionned, and the pickup branch is the same as
+        # the holdingbranch of the document, we force the value $rank and $found
+        $rank[0] = 0;
+        my $item = GetItem($checkitem);
+        push @found, $item->{holdingbranch} eq $branch ? 'W' : undef;
     }
 }
 
-- 
2.1.4