]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/javascript/backend/penalty/patron_penalty.js
cleaning up, testing
[working/Evergreen.git] / Open-ILS / src / javascript / backend / penalty / patron_penalty.js
1 function go() {
2
3 /* load the lib script */
4 load_lib('../circ/circ_lib.js');
5 log_vars('patron_penalty');
6
7
8 var PROFILES = {};
9 PROFILES['class']                       = { fineLimit : 10, overdueLimit : 10 };
10 PROFILES['patrons']             = { fineLimit : 10, overdueLimit : 10 };
11 PROFILES['restricted']  = { fineLimit : 0, overdueLimit : 0 };
12 PROFILES['circulators'] = { fineLimit : -1, overdueLimit : -1 };
13 PROFILES['local system administrator'] = { fineLimit : -1, overdueLimit : -1 };
14 /* add profiles as necessary ... */
15
16 var profile = PROFILES[patronProfile];
17
18 if( profile ) {
19
20         /* check the fine limit */
21         if( profile.fineLimit > 0 && patronFines >= profile.fineLimit )
22                 result.fatalEvents.push('PATRON_EXCEEDS_FINES');
23
24         /* check the overdue limit */
25         if( profile.overdueLimit > 0 && patronOverdueCount > profile.overdueLimit )
26                 result.fatalEvents.push('PATRON_EXCEEDS_OVERDUE_COUNT');
27
28 } else {
29         log_warn("profile has no configured information: " + patronProfile);
30 }
31
32
33
34
35
36
37 } go();
38
39