]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/javascript/backend/circ/circ_permit_patron.js
cleaning up, testing
[working/Evergreen.git] / Open-ILS / src / javascript / backend / circ / circ_permit_patron.js
1 function go() {
2
3 /* load the script library */
4 load_lib('circ_lib.js');
5 log_vars('circ_permit_patron');
6
7
8
9 /* make sure they are not barred */
10 if( isTrue(patron.barred) ) 
11         result.events.push('PATRON_BARRED');
12
13
14 /* ---------------------------------------------------------------------
15         Set up the limits for the various profiles.
16         values of -1 mean there is no limit 
17         --------------------------------------------------------------------- */
18 var PROFILES = {};
19 PROFILES['class']                       = { itemsOutLimit : 10 };
20 PROFILES['patrons']             = { itemsOutLimit : 10 };
21 PROFILES['restricted']  = { itemsOutLimit : 2 };
22 PROFILES['circulators'] = { itemsOutLimit : -1 };
23 PROFILES['local system administrator'] = { itemsOutLimit : -1 };
24 /* add profiles as necessary ... */
25
26
27
28
29 /* ---------------------------------------------------------------------
30         Check the items out count 
31         --------------------------------------------------------------------- */
32 var profile = PROFILES[patronProfile];
33 if( profile ) {
34         if( patronItemsOut > 0 && patronItemsOut > profile.itemsOutLimit )
35                 result.events.push('PATRON_EXCEEDS_CHECKOUT_COUNT');
36 } else {
37         log_warn("profile has no configured information: " + patronProfile);
38 }
39
40
41 } go();
42
43