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