added hold permit flag for new holds to prevent max-holds checks on existing holds
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 22 Feb 2008 00:09:41 +0000 (00:09 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 22 Feb 2008 00:09:41 +0000 (00:09 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8811 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/src/javascript/backend/circ/circ_permit_hold.js
Open-ILS/src/javascript/backend/circ/circ_lib.js
Open-ILS/src/javascript/backend/circ/circ_permit_hold.js
Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/OpenILS/Utils/PermitHold.pm

index b2b22ed..c40e885 100644 (file)
@@ -10,10 +10,12 @@ var isStaffHold = isGroupDescendantId('Staff', requestor.profile);
 
 /* non-staff members are allowed 50 open holds at most */
 if( ! isStaffHold ) {
-   var count = userHoldCount(patron.id);
-   log_info("patron has " + count + " open holds");
-   if( count >= 50 ) 
-      result.events.push('MAX_HOLDS');
+    if(newHold) {
+        var count = userHoldCount(patron.id);
+        log_info("patron has " + count + " open holds");
+        if( count >= 50 ) 
+            result.events.push('MAX_HOLDS');
+    }
 } else {
     log_info("This is a staff-placed hold");
 }
index 5cad8b4..a39794b 100644 (file)
@@ -43,6 +43,7 @@ var currentLocation   = environment.location;
 var holdRequestLib     = environment.requestLib;
 var holdPickupLib       = environment.pickupLib; /* hold pickup lib */
 var requestor = environment.requestor || patron;
+var newHold = environment.newHold;
 
 
 
index 142c052..942aace 100644 (file)
@@ -18,14 +18,20 @@ if( !isTrue(copy.circulate) )
 
 var config = findGroupConfig(patronProfile);
 
+
 if( config ) {
 
     /* see if they have too many items out */
-    var limit = config.maxHolds;
-    var count = userHoldCount(patron.id);
-    if( limit >= 0 && count >= limit ) {
-        log_info("patron has " + count + " open holds");
-        result.events.push('MAX_HOLDS');
+    if(newHold) {
+        log_info("This is a new hold, checking maxHolds...");
+        var limit = config.maxHolds;
+        var count = userHoldCount(patron.id);
+        if( limit >= 0 && count >= limit ) {
+            log_info("patron has " + count + " open holds");
+            result.events.push('MAX_HOLDS');
+        }
+    } else {
+        log_info("Ignoring maxHolds on existing hold...");
     }
 }
 
index 7014ba3..cbbf604 100644 (file)
@@ -1335,7 +1335,8 @@ sub verify_copy_for_hold {
                        title                           => $title, 
                        title_descriptor        => $title->fixed_fields, # this is fleshed into the title object
                        pickup_lib                      => $pickup_lib,
-                       request_lib                     => $request_lib 
+                       request_lib                     => $request_lib,
+            new_hold            => 1
                } 
        );
        return 0;
index 5f69de9..fcef298 100644 (file)
@@ -34,6 +34,7 @@ sub permit_copy_hold {
                _direct => {
                        requestLib      => $$params{request_lib},
                        pickupLib       => $$params{pickup_lib},
+            newHold    => $$params{new_hold},
                }
        };