3 /* load the lib script */
4 load_lib('circ_lib.js');
6 /* collect some useful variables */
7 var copy = environment.copy;
8 var patron = environment.patron;
9 var volume = environment.volume;
10 var title = environment.title;
11 var recDescriptor = environment.titleDescriptor;
12 var patronProfile = patron.profile.name.toLowerCase();
13 var copyStatus = copy.status.name.toLowerCase();
14 var isRenewal = environment.isRenewal;
17 - at some point we should add a library of objects that map
18 codes to names (item_form, item_type, etc.)
19 load_lib('item_form_map.js');
20 var form_name = item_form_map[env.record_descriptor.item_form];
24 log_debug('circ_permit_copy: permit circ on ' +
26 ', Patron:' + patron.id +
27 ', Patron Username:' + patron.usrname +
28 ', Patron Library: ' + patron.home_ou.name +
29 ', Copy status: ' + copyStatus +
30 ', Copy location: ' + copy.location.name +
31 ', Is Renewal: ' + ( (isTrue(isRenewal)) ? "yes" : "no" ) +
32 ', Item Type: ' + recDescriptor.item_type +
33 ', Item Form: ' + recDescriptor.item_form +
34 ', Item Lang: ' + recDescriptor.item_lang +
35 ', Item Audience: ' + recDescriptor.audience +
40 if( ! isTrue(copy.circulate) )
41 result.events.push('COPY_CIRC_NOT_ALLOWED');
43 if( isTrue(copy.ref) )
44 result.events.push('COPY_IS_REFERENCE');
48 if(copyStatus != 'available' &&
49 copyStatus != 'on holds shelf' && copyStatus != 'reshelving' ) {
50 result.events.push('COPY_NOT_AVAILABLE');
53 /* this should happen very rarely .. but it needs to be protected */
54 if( recDescriptor.item_type == 'g' /* projected medium */
55 && copy.circ_lib != patron.home_ou.id )
56 result.events.push('CIRC_EXCEEDS_COPY_RANGE');