3 /* load the lib script */
4 load_lib('circ_lib.js');
8 /* collect some useful variables */
9 var copy = environment.copy;
10 var patron = environment.patron;
11 var standing = patron.standing.value.toLowerCase();
12 var profile = patron.profile.name.toLowerCase();
13 var status = copy.status.name.toLowerCase();
14 var itemsOut = environment.patronItemsOut;
15 var fines = environment.patronFines;
16 var isRenewal = environment.isRenewal;
19 log_debug('CIRC PERMIT: permit circ on ' +
21 ', Patron:' + patron.id +
22 ', Patron Username:' + patron.usrname +
23 ', Patron Profile: ' + patron.profile.name +
24 ', Patron Standing: ' + patron.standing.value +
25 ', Patron copies: ' + itemsOut +
26 ', Patron Library: ' + patron.home_ou.name +
27 ', Patron fines: ' + fines +
28 ', Copy status: ' + copy.status.name +
29 ', Copy location: ' + copy.location.name +
30 ', Is Renewal: ' + ( (isRenewal) ? "yes" : "no" ) +
35 if( standing != 'good' )
36 return result.event = 'PATRON_BAD_STANDING';
38 if( copy.circulate == '0' )
39 return result.event = 'COPY_CIRC_NOT_ALLOWED';
42 return result.event = 'COPY_IS_REFERENCE';
44 if( status != 'available' && status != 'on holds shelf' )
45 return result.event = 'COPY_NOT_AVAILABLE';
50 if( profile == 'patrons' && itemsOut > 10 )
51 return result.event = 'PATRON_EXCEEDS_CHECKOUT_COUNT';
53 if( profile == 'staff' && itemsOut > 30 )
54 return result.event = 'PATRON_EXCEEDS_CHECKOUT_COUNT';
57 var hold = copy.fetchHold();
58 if( hold && hold.usr != patron.id )
59 return result.event = 'COPY_NEEDED_FOR_HOLD';