Bug 5921: Add enumchron to the items detail page
[koha.git] / C4 / Reserves.pm
index 2dd2688..87e2325 100644 (file)
@@ -2,7 +2,7 @@ package C4::Reserves;
 
 # Copyright 2000-2002 Katipo Communications
 #           2006 SAN Ouest Provence
-#           2007 BibLibre Paul POULAIN
+#           2007-2010 BibLibre Paul POULAIN
 #
 # This file is part of Koha.
 #
@@ -804,6 +804,12 @@ sub CheckReserves {
             } else {
                 # See if this item is more important than what we've got so far
                 if ( $res->{'priority'} && $res->{'priority'} < $priority ) {
+                    my $borrowerinfo=C4::Members::GetMemberDetails($res->{'borrowernumber'});
+                    my $iteminfo=C4::Items::GetItem($itemnumber);
+                    my $branch=C4::Circulation::_GetCircControlBranch($iteminfo,$borrowerinfo);
+                    my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$iteminfo->{'itype'});
+                    next if ($branchitemrule->{'holdallowed'} == 0);
+                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $borrowerinfo->{'branchcode'}));
                     $priority = $res->{'priority'};
                     $highest  = $res;
                 }