3 load_lib('circ/circ_lib.js');
4 log_vars('circ_permit_hold');
8 /* non-staff members are allowed 50 open holds at most */
9 if( ! isGroupDescendant('Staff', patronProfile) ) {
10 var count = userHoldCount(patron.id);
11 log_info("patron has " + count + " open holds");
13 result.events.push('MAX_HOLDS');
17 if( isTrue(patron.barred) )
18 result.events.push('PATRON_BARRED');
20 if( isTrue(copy.ref) )
21 result.events.push('ITEM_NOT_HOLDABLE');
23 if( !isTrue(copy.circulate) )
24 result.events.push('ITEM_NOT_HOLDABLE');
26 /* all STATELIB items are holdable regardless of type */
27 if( isOrgDescendent('STATELIB', copy.circ_lib.id) ) return;
29 var mod = (copy.circ_modifier) ? copy.circ_modifier.toLowerCase() : "";
31 log_info("circ-modifier = "+mod);
33 if( mod == 'bestsellernh' )
34 result.events.push('ITEM_NOT_HOLDABLE');
36 var marcItemType = getMARCItemType();
39 if( ( marcItemType == 'g' ||
40 marcItemType == 'i' ||
41 marcItemType == 'j' ||
42 mod == 'softwrlong' ||
53 mod == 'equip-long' ||
56 isTrue(copy.deposit) ||
57 mod == 'video-long' ||
60 isAnc = hasCommonAncestor( copy.circ_lib.id, patron.home_ou.id, 1 );
63 log_info("patron and copy circ_lib share a common ancestor, hold allowed");
66 log_info("patron and copy circ_lib do NOT share a common ancestor");
68 if( hasCommonAncestor( copy.circ_lib.id, holdRequestLib.id, 1) ) {
69 log_info("request_lib and copy circ_lib DO share a common ancestor");
73 log_info("request_lib and copy circ_lib also do NOT share a common ancestor, hold on this type of material not allowed");
74 result.events.push('ITEM_NOT_HOLDABLE');