[Koha-patches] [PATCH] (bug #4319) allow reserves on waiting items

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Tue Mar 16 17:12:49 CET 2010


This add a function to check the reserve status, and add a check in IsAvailableForItemLevelRequest() to allow request on items that are waiting
---
 C4/Reserves.pm |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/C4/Reserves.pm b/C4/Reserves.pm
index 75ea16d..7e42ceb 100644
--- a/C4/Reserves.pm
+++ b/C4/Reserves.pm
@@ -101,7 +101,8 @@ BEGIN {
         &GetReserveCount
         &GetReserveFee
 		&GetReserveInfo
-    
+        &GetReserveStatus
+        
         &GetOtherReserves
         
         &ModReserveFill
@@ -755,6 +756,18 @@ sub GetReservesForBranch {
     return (@transreserv);
 }
 
+sub GetReserveStatus {
+    my ($itemnumber) = @_;
+    
+    my $dbh = C4::Context->dbh;
+    
+    my $itemstatus = $dbh->prepare("SELECT found FROM reserves WHERE itemnumber = ?");
+    
+    $itemstatus->execute($itemnumber);
+    my ($found) = $itemstatus->fetchrow_array;
+    return $found;
+}
+
 =item CheckReserves
 
   ($status, $reserve) = &CheckReserves($itemnumber);
@@ -1349,10 +1362,11 @@ sub IsAvailableForItemLevelRequest {
                                $item->{wthdrawn} or
                                $notforloan_per_itemtype;
 
+    
     if (C4::Context->preference('AllowOnShelfHolds')) {
         return $available_per_item;
     } else {
-        return ($available_per_item and $item->{onloan}); 
+        return ($available_per_item and ($item->{onloan} or GetReserveStatus($itemnumber) eq "W")); 
     }
 }
 
-- 
1.6.3.3




More information about the Koha-patches mailing list