From 49b2a5ac2c62bc75b0474f61b98415bd3ee0dc97 Mon Sep 17 00:00:00 2001
From: Lari Taskula <lari.taskula@jns.fi>
Date: Tue, 7 Feb 2017 17:53:52 +0200
Subject: [PATCH] Bug 7614: Check branch transfer limits in opac-reserve.pl

---
 opac/opac-reserve.pl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
index d42cc15..23c0d5b 100755
--- a/opac/opac-reserve.pl
+++ b/opac/opac-reserve.pl
@@ -264,7 +264,7 @@ if ( $query->param('place_reserve') ) {
       # holdingbranch, force the value $rank and $found.
         my $rank = $biblioData->{rank};
         if ( $itemNum ne '' ) {
-            $canreserve = 1 if CanItemBeReserved( $borrowernumber, $itemNum ) eq 'OK';
+            $canreserve = 1 if CanItemBeReserved( $borrowernumber, $itemNum, $branch ) eq 'OK';
             $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
             my $item = GetItem($itemNum);
             if ( $item->{'holdingbranch'} eq $branch ) {
@@ -273,7 +273,7 @@ if ( $query->param('place_reserve') ) {
             }
         }
         else {
-            $canreserve = 1 if CanBookBeReserved( $borrowernumber, $biblioNum ) eq 'OK';
+            $canreserve = 1 if CanBookBeReserved( $borrowernumber, $biblioNum, $branch ) eq 'OK';
 
             # Inserts a null into the 'itemnumber' field of 'reserves' table.
             $itemNum = undef;
@@ -529,7 +529,7 @@ foreach my $biblioNum (@biblionumbers) {
         my $policy_holdallowed = !$itemLoopIter->{already_reserved};
         $policy_holdallowed &&=
             IsAvailableForItemLevelRequest($itemInfo,$borr) &&
-            CanItemBeReserved($borrowernumber,$itemNum) eq 'OK';
+            CanItemBeReserved($borrowernumber,$itemNum,$branch) eq 'OK';
 
         if ($policy_holdallowed) {
             if ( my $hold_allowed = OPACItemHoldsAllowed( $itemInfo, $borr ) ) {
@@ -588,7 +588,7 @@ foreach my $biblioNum (@biblionumbers) {
         }
     }
 
-    $biblioLoopIter{holdable} &&= CanBookBeReserved($borrowernumber,$biblioNum) eq 'OK';
+    $biblioLoopIter{holdable} &&= CanBookBeReserved($borrowernumber,$biblioNum,$branch) eq 'OK';
 
     # For multiple holds per record, if a patron has previously placed a hold,
     # the patron can only place more holds of the same type. That is, if the
-- 
1.9.1