]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/javascript/backend/circ/circ_permit_hold.js
142c0527bbb0400b86cf70cc88290033ec6eff10
[Evergreen.git] / Open-ILS / src / javascript / backend / circ / circ_permit_hold.js
1 function go() {
2
3 load_lib('circ/circ_lib.js');
4 load_lib('JSON_v1.js');
5 log_vars('circ_permit_hold');
6
7
8
9 if( isTrue(patron.barred) ) 
10         result.events.push('PATRON_BARRED');
11
12 if( isTrue(copy.ref) ) 
13         result.events.push('ITEM_NOT_HOLDABLE');
14
15 if( !isTrue(copy.circulate) ) 
16         result.events.push('ITEM_NOT_HOLDABLE');
17
18
19 var config = findGroupConfig(patronProfile);
20
21 if( config ) {
22
23     /* see if they have too many items out */
24     var limit = config.maxHolds;
25     var count = userHoldCount(patron.id);
26     if( limit >= 0 && count >= limit ) {
27         log_info("patron has " + count + " open holds");
28         result.events.push('MAX_HOLDS');
29     }
30 }
31
32
33 } go();
34
35
36