5 /* useful functions for creating wrappers around system functions */
6 function scratchKey() { return '_' + __scratchKey++; };
7 function scratchPad(key) { return '__SCRATCH.'+ key; }
8 function getScratch(key) { return __SCRATCH[ key ]; }
9 function scratchClear() { for( var o in __SCRATCH ) __SCRATCH[o] = null; }
12 /* note: returns false if the value is 'f' or 'F' ... */
24 /* collect the useful variables */
25 var result = environment.result = {};
26 result.event = 'SUCCESS';
28 result.fatalEvents = [];
29 result.infoEvents = [];
31 var copy = environment.copy;
32 var volume = environment.volume;
33 var title = environment.title;
34 var recDescriptor = environment.titleDescriptor;
35 var patron = environment.patron;
36 var isRenewal = environment.isRenewal;
37 var patronItemsOut = environment.patronItemsOut;
38 var patronOverdueCount = environment.patronOverdueCount;
39 var patronFines = environment.patronFines;
43 if( patron.profile ) patronProfile = patron.profile.name.toLowerCase();
44 if( copy.status ) copyStatus = copy.status.name.toLowerCase();
49 - at some point we should add a library of objects that map
50 codes to names (item_form, item_type, etc.)
51 load_lib('item_form_map.js');
52 var form_name = item_form_map[env.record_descriptor.item_form];
57 /* logs a load of info */
58 function log_vars( prefix ) {
60 var str = prefix + ' : ';
63 str += ' Patron=' + patron.id;
64 str += ', Patron Barcode=' + patron.card.barcode;
65 str += ', Patron Username='+ patron.usrname;
66 str += ', Patron Library=' + patron.home_ou.name;
67 str += ', Patron Fines=' + patronFines;
68 str += ', Patron OverdueCount=' + patronOverdueCount;
69 str += ', Patron Items Out=' + patronItemsOut;
73 str += ', Copy=' + copy.id;
74 str += ', Copy Barcode=' + copy.barcode;
75 str += ', Copy status=' + copyStatus;
76 str += ', Copy location=' + copy.location.name;
79 if(volume) str += ', Volume=' + volume.id;
80 if(title) str += ', Record=' + title.id;
83 str += ', Record Descriptor=' + recDescriptor.id;
84 str += ', Item Type=' + recDescriptor.item_type;
85 str += ', Item Form=' + recDescriptor.item_form;
86 str += ', Item Lang=' + recDescriptor.item_lang;
87 str += ', Item Audience=' + recDescriptor.audience;
90 str += ' Is Renewal: ' + ( (isTrue(isRenewal)) ? "yes" : "no" );