From 905add7131b506080d941ced9c7dded2c54cbf0e Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 9 Jul 2013 11:48:23 +0200 Subject: [PATCH] Bug 2394: Use syspref canreservefromotherbranches in CanItemBeReserved Signed-off-by: Srdjan Signed-off-by: Kyle M Hall Passes koha-qa, works as advertised --- C4/Reserves.pm | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 1f89127..0291def 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -510,11 +510,22 @@ sub CanItemBeReserved{ } # we check if it's ok or not - if( $reservecount < $allowedreserves ){ - return 1; - }else{ + if( $reservecount >= $allowedreserves ){ return 0; } + + # If reservecount is ok, we check item branch if IndependentBranches is ON + # and canreservefromotherbranches is OFF + if ( C4::Context->preference('IndependentBranches') + and !C4::Context->preference('canreservefromotherbranches') ) + { + my $itembranch = $item->{homebranch}; + if ($itembranch ne $borrower->{branchcode}) { + return 0; + } + } + + return 1; } #-------------------------------------------------------------------------------- =head2 GetReserveCount -- 1.7.2.5