3 /* load the lib script */
4 load_lib('circ_lib.js');
6 log_debug('CIRC PERMIT: permit circ on ' +
8 ', Patron:' + patron.id +
9 ', Patron Username:' + patron.usrname +
10 ', Patron Profile: ' + patron.profile.name +
11 ', Patron Standing: ' + patron.standing.value +
12 ', Patron copies: ' + patron_info.items_out +
13 ', Patron Library: ' + patron.home_ou.name +
14 ', Patron fines: ' + patron_info.fines +
15 ', Copy status: ' + copy.status.name +
16 ', Copy location: ' + copy.location.name +
20 /* collect some useful variables */
21 var standing = patron.standing.value.toLowerCase();
22 var profile = patron.profile.name.toLowerCase();
23 var status = copy.status.name.toLowerCase();
25 if( standing != 'good' )
26 return result.event = 'PATRON_BAD_STANDING';
28 if( copy.circulate == '0' )
29 return result.event = 'COPY_CIRC_NOT_ALLOWED';
32 return result.event = 'COPY_IS_REFERENCE';
34 if( status != 'available' && status != 'on holds shelf' )
35 return result.event = 'COPY_NOT_AVAILABLE';
40 if( profile == 'patrons' && patron_info.items_out > 10 )
41 return result.event = 'PATRON_EXCEEDS_CHECKOUT_COUNT';
43 if( profile == 'staff' && patron_info.items_out > 30 )
44 return result.event = 'PATRON_EXCEEDS_CHECKOUT_COUNT';
47 var hold = copy.fetchHold();
48 if( hold && hold.usr != patron.id )
49 return result.event = 'COPY_NEEDED_FOR_HOLD';