/* 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");
}
var holdRequestLib = environment.requestLib;
var holdPickupLib = environment.pickupLib; /* hold pickup lib */
var requestor = environment.requestor || patron;
+var newHold = environment.newHold;
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...");
}
}
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;
_direct => {
requestLib => $$params{request_lib},
pickupLib => $$params{pickup_lib},
+ newHold => $$params{new_hold},
}
};