]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/javascript/backend/circ/circ_permit_hold.js
Docs: 2.8 Patron Message Center
[working/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
22 if( config ) {
23
24     /* see if they have too many items out */
25     if(newHold) {
26         log_info("This is a new hold, checking maxHolds...");
27         var limit = config.maxHolds;
28         var count = userHoldCount(patron.id);
29         if( limit >= 0 && count >= limit ) {
30             log_info("patron has " + count + " open holds");
31             result.events.push('MAX_HOLDS');
32         }
33     } else {
34         log_info("Ignoring maxHolds on existing hold...");
35     }
36 }
37
38
39 } go();
40
41
42