4 function scratchKey() { return '_' + __scratchKey++; };
5 function scratchPad(key) { return '__SCRATCH.'+ key; }
6 function getScratch(key) { return __SCRATCH[ key ]; }
7 function scratchClear() { for( var o in __SCRATCH ) __SCRATCH[o] = null; }
11 /* -- Copy functions ----------------------------------------------------- */
13 if( environment.copy ) {
14 environment.copy.fetchHolds = function() {
15 var key = scratchKey();
16 environment.copy.__OILS_FUNC_fetch_hold(scratchPad(key));
17 var val = getScratch(key);
18 return (val) ? val : null;
24 /* note: returns false if the value is 'f' or 'F' ... */
36 /* collect the useful variables */
37 var copy = environment.copy;
38 var volume = environment.volume;
39 var title = environment.title;
40 var recDescriptor = environment.titleDescriptor;
41 var patron = environment.patron;
42 var isRenewal = environment.isRenewal;
43 var patronItemsOut = environment.patronItemsOut;
44 var patronOverdueCount = environment.patronOverdueCount;
45 var patronFines = environment.patronFines;
49 if( patron.profile ) patronProfile = patron.profile.name.toLowerCase();
50 if( copy.status ) copyStatus = copy.status.name.toLowerCase();
55 - at some point we should add a library of objects that map
56 codes to names (item_form, item_type, etc.)
57 load_lib('item_form_map.js');
58 var form_name = item_form_map[env.record_descriptor.item_form];
63 /* logs a load of info */
64 function log_vars( prefix ) {
66 var str = prefix + ' : ';
69 str += ' Patron=' + patron.id;
70 str += ', Patron Barcode=' + patron.card.barcode;
71 str += ', Patron Username='+ patron.usrname;
72 str += ', Patron Library=' + patron.home_ou.name;
73 str += ', Patron Fines=' + patronFines;
74 str += ', Patron OverdueCount=' + patronOverdueCount;
75 str += ', Patron Items Out=' + patronItemsOut;
79 str += ', Copy=' + copy.id;
80 str += ', Copy Barcode=' + copy.barcode;
81 str += ', Copy status=' + copyStatus;
82 str += ', Copy location=' + copy.location.name;
85 if(volume) str += ', Volume=' + volume.id;
86 if(title) str += ', Record=' + title.id;
89 str += ', Record Descriptor=' + recDescriptor.id;
90 str += ', Item Type=' + recDescriptor.item_type;
91 str += ', Item Form=' + recDescriptor.item_form;
92 str += ', Item Lang=' + recDescriptor.item_lang;
93 str += ', Item Audience=' + recDescriptor.audience;
96 str += ' Is Renewal: ' + ( (isTrue(isRenewal)) ? "yes" : "no" );