3 /* load the lib script */
4 load_lib('circ_lib.js');
7 /* collect some useful variables */
8 var copy = environment.copy;
9 var patron = environment.patron;
10 var standing = patron.standing.value.toLowerCase();
11 var profile = patron.profile.name.toLowerCase();
12 var status = copy.status.name.toLowerCase();
13 var itemsOut = environment.patronItemsOut;
14 var fines = environment.patronFines;
15 var isRenewal = environment.isRenewal;
18 log_debug('circ_permit_copy: permit circ on ' +
20 ', Patron:' + patron.id +
21 ', Patron Username:' + patron.usrname +
22 ', Patron Profile: ' + patron.profile.name +
23 ', Patron Standing: ' + patron.standing.value +
24 ', Patron copies: ' + itemsOut +
25 ', Patron Library: ' + patron.home_ou.name +
26 ', Patron fines: ' + fines +
27 ', Copy status: ' + copy.status.name +
28 ', Copy location: ' + copy.location.name +
29 ', Is Renewal: ' + ( (isRenewal) ? "yes" : "no" ) +
34 if( copy.circulate == '0' )
35 return result.event = 'COPY_CIRC_NOT_ALLOWED';
38 return result.event = 'COPY_IS_REFERENCE';
40 if( status != 'available' && status != 'on holds shelf' )
41 return result.event = 'COPY_NOT_AVAILABLE';
43 var holds = copy.fetchHold();
44 for( my i in holds ) {
46 if( hold && hold.usr != patron.id )
47 return result.event = 'COPY_NEEDED_FOR_HOLD';