7 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
8 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
9 JSAN.errorLevel = "die"; // none, warn, or die
10 JSAN.addRepository('/xul/server/');
11 JSAN.use('util.error'); error = new util.error();
12 error.sdump('D_TRACE','my_init() for alternate_copy_summary.xul');
14 JSAN.use('util.network'); network = new util.network();
15 JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
17 setTimeout( function() { load_item(); }, 1000 ); // timeout so xulG gets a chance to get pushed in
20 try { error.standard_unexpected_error_alert('main/test.xul',E); } catch(F) { alert(E); }
24 function set(name,value) {
25 var nodes = document.getElementsByAttribute('name',name);
26 for (var i = 0; i < nodes.length; i++) {
27 nodes[i].setAttribute('value',value); nodes[i].value = value;
31 function set_tooltip(name,value) {
32 var nodes = document.getElementsByAttribute('name',name);
33 for (var i = 0; i < nodes.length; i++) {
34 nodes[i].setAttribute('tooltiptext',value);
38 function load_item() {
40 if (! xulG.barcode) return;
42 var details = network.simple_request('FM_ACP_DETAILS_VIA_BARCODE.authoritative', [ ses(), xulG.barcode ]);
43 // Should get back .mvr, .copy, .volume, .transit, .circ, .hold
45 if (typeof bib_brief_overlay == 'function') bib_brief_overlay( { 'mvr' : details.mvr, 'acp' : details.copy } );
56 set('types_of_resource', '');
57 set('call_numbers', '');
59 set('online_loc', '');
61 set('physical_description', '');
63 set('copy_count', '');
68 set('title',details.mvr.title());
69 set('author',details.mvr.author());
70 set('doc_id', details.mvr.doc_id());
71 set('doc_type', details.mvr.doc_type());
72 set('pubdate', details.mvr.pubdate());
73 set('isbn',details.mvr.isbn());
74 set('publisher', details.mvr.publisher());
75 set('tcn', details.mvr.tcn());
76 set('subject', details.mvr.subject());
77 set('types_of_resource', details.mvr.types_of_resource());
78 set('call_numbers', details.mvr.call_numbers());
79 set('edition', details.mvr.edition());
80 set('online_loc', details.mvr.online_loc());
81 set('synopsis', details.mvr.synopsis());
82 set('physical_description', details.mvr.physical_description());
83 set('toc', details.mvr.toc());
84 set('copy_count', details.mvr.copy_count());
85 set('series', details.mvr.series());
86 set('serials', details.mvr.serials());
88 set('title',details.copy.dummy_title());
89 set('author',details.copy.dummy_author());
90 set('isbn',details.copy.dummy_isbn());
93 set("stat_cat_entries", '');
94 set("age_protect", '');
95 set("alert_message", '');
97 set("call_number", '');
98 set("circ_as_type", '');
99 set("copy_circ_lib" , '');
100 set("circ_modifier", '');
101 set("circulate", '');
102 set("copy_number", '');
103 set("copy_create_date", '');
104 set("copy_creator", '');
107 set("deposit_amount", '');
108 set("dummy_author", '');
109 set("dummy_title", '');
110 set("copy_edit_date", '');
111 set("copy_editor", '');
112 set("fine_level", '');
115 set("loan_duration", '');
117 set("opac_visible", '');
122 set("stat_cat_entry_copy_maps", '');
123 set("circulations", '');
124 set("total_circ_count", '');
125 set_tooltip("total_circ_count", '');
126 set("total_circ_count_prev_year", '');
127 set("total_circ_count_curr_year", '');
131 set("stat_cat_entries", details.copy.stat_cat_entries());
132 set("age_protect", details.copy.age_protect());
133 set("alert_message", details.copy.alert_message());
134 set("barcode", details.copy.barcode());
135 set("call_number", details.copy.call_number());
136 set("circ_as_type", details.copy.circ_as_type());
137 set("copy_circ_lib" , details.copy.circ_lib());
138 set("circ_modifier", details.copy.circ_modifier());
139 set("circulate", details.copy.circulate());
140 set("copy_number", details.copy.copy_number());
141 set("copy_create_date", details.copy.create_date());
142 set("copy_creator", details.copy.creator());
143 set("deleted", details.copy.deleted());
144 set("deposit", details.copy.deposit());
145 set("deposit_amount", details.copy.deposit_amount());
146 set("dummy_author", details.copy.dummy_author());
147 set("dummy_title", details.copy.dummy_title());
148 set("copy_edit_date", details.copy.edit_date());
149 set("copy_editor", details.copy.editor());
150 set("fine_level", details.copy.fine_level());
151 set("holdable", details.copy.holdable());
152 set("copy_id", details.copy.id());
153 set("loan_duration", details.copy.loan_duration());
154 set("location", details.copy.location());
155 set("opac_visible", details.copy.opac_visible());
156 set("price", details.copy.price());
157 set("ref", details.copy.ref());
158 set("status", details.copy.status());
159 set("notes", details.copy.notes());
160 set("stat_cat_entry_copy_maps", details.copy.stat_cat_entry_copy_maps());
161 set("circulations", details.copy.circulations());
162 set("holds", details.copy.holds());
164 network.simple_request('FM_CIRC_IMPROVED_COUNT_VIA_COPY', [ses(), { 'copy' : details.copy.id() } ], function(req) {
165 var r = req.getResultObject();
166 var total = 0; var tooltip = ''; var year = {};
167 for (var i = 0; i < r.length; i++) {
168 total += Number( r[i].count() );
169 if (typeof year[ r[i].year() ] == 'undefined') year[ r[i].year() ] = 0;
170 year[ r[i].year() ] += Number( r[i].count() ); // Add original circs and renewals together
172 set( 'total_circ_count', total );
173 var curr_year = (new Date()).getFullYear();
174 var prev_year = curr_year - 1;
175 set( 'total_circ_count_curr_year', year[ curr_year ] || 0 );
176 set( 'total_circ_count_prev_year', year[ prev_year ] || 0 );
177 var keys = []; for (var i in year) { keys.push( i ); }; keys.sort();
178 for (var i = 0; i < keys.length; i++) {
179 tooltip += document.getElementById('circStrings').getFormattedString(
180 'staff.circ.copy_details.circ_count_by_year', [
181 keys[i] == -1 ? document.getElementById('circStrings').getString('staff.circ.copy_details.circ_count_by_year.legacy_label') : keys[i],
186 set_tooltip( 'total_circ_count', tooltip );
191 set("volume_create_date", '');
192 set("volume_creator", '');
194 set("volume_edit_date", '');
195 set("volume_editor", '');
196 set("volume_id", '');
198 set("owning_lib" , '');
204 if (details.volume) {
205 set("copies", details.volume.copies());
206 set("volume_create_date", details.volume.create_date());
207 set("volume_creator", details.volume.creator());
208 set("deleted", details.volume.deleted());
209 set("volume_edit_date", details.volume.edit_date());
210 set("volume_editor", details.volume.editor());
211 set("volume_id", details.volume.id());
212 set("label", details.volume.label());
213 set("owning_lib" , details.volume.owning_lib());
214 set("record", details.volume.record());
215 set("notes", details.volume.notes());
216 set("uri_maps", details.volume.uri_maps());
217 set("uris", details.volume.uris());
220 set("copy_status", '');
222 set("dest_recv_time", '');
223 set("transit_id", '');
224 set("persistant_transfer", '');
227 set("source_send_time", '');
228 set("target_copy", '');
229 set("hold_transit_copy", '');
231 if (details.transit) {
232 set("copy_status", details.transit.copy_status());
233 set("dest", details.transit.dest());
234 set("dest_recv_time", details.transit.dest_recv_time());
235 set("transit_id", details.transit.id());
236 set("persistant_transfer", details.transit.persistant_transfer());
237 set("prev_hop", details.transit.prev_hop());
238 set("source", details.transit.source());
239 set("source_send_time", details.transit.source_send_time());
240 set("target_copy", details.transit.target_copy());
241 set("hold_transit_copy", details.transit.hold_transit_copy());
244 set("checkin_lib", '');
245 set("checkin_workstation","");
246 set("checkin_staff", '');
247 set("checkin_time", '');
248 set("checkin_scan_time", '');
249 set("circ_circ_lib" , '');
250 set("circ_staff", '');
251 set("desk_renewal", '');
254 set("duration_rule", '');
255 set("fine_interval", '');
258 set("max_fine_rule", '');
259 set("opac_renewal", '');
260 set("phone_renewal", '');
261 set("recuring_fine", '');
262 set("recuring_fine_rule", '');
263 set("renewal_remaining", '');
264 set("stop_fines", '');
265 set("stop_fines_time", '');
266 set("target_copy", '');
268 set("xact_finish", '');
269 set("xact_start", '');
270 set("create_time", '');
271 set("workstation", '');
274 set("billable_transaction", '');
275 set("circ_type", '');
276 set("billing_total", '');
277 set("payment_total", '');
280 try { set("checkin_lib", typeof details.circ.checkin_lib() == 'object' ? details.circ.checkin_lib().shortname() : data.hash.aou[ details.circ.checkin_lib() ].shortname() ); } catch(E) {};
281 if (details.circ.checkin_workstation()) {
282 set("checkin_workstation", details.circ.checkin_workstation().name());
284 set("checkin_staff", details.circ.checkin_staff());
285 set("checkin_time", details.circ.checkin_time());
286 set("checkin_scan_time", details.circ.checkin_scan_time());
287 try { set("circ_circ_lib" , typeof details.circ.circ_lib() == 'object' ? details.circ.circ_lib().shortname() : data.hash.aou[ details.circ.circ_lib() ].shortname() ); } catch(E) {};
288 set("circ_staff", details.circ.circ_staff());
289 set("desk_renewal", details.circ.desk_renewal());
290 set("due_date", details.circ.due_date());
291 set("duration", details.circ.duration());
292 set("duration_rule", details.circ.duration_rule());
293 set("fine_interval", details.circ.fine_interval());
294 set("circ_id", details.circ.id());
295 set("max_fine", details.circ.max_fine());
296 set("max_fine_rule", details.circ.max_fine_rule());
297 set("opac_renewal", details.circ.opac_renewal());
298 set("phone_renewal", details.circ.phone_renewal());
299 set("recuring_fine", details.circ.recuring_fine());
300 set("recuring_fine_rule", details.circ.recuring_fine_rule());
301 set("renewal_remaining", details.circ.renewal_remaining());
302 set("stop_fines", details.circ.stop_fines());
303 set("stop_fines_time", details.circ.stop_fines_time());
304 set("target_copy", details.circ.target_copy());
305 set("usr", details.circ.usr());
306 set("xact_finish", details.circ.xact_finish());
307 set("xact_start", details.circ.xact_start());
308 set("create_time", details.circ.create_time());
309 set("workstation", details.circ.workstation());
310 set("billings", details.circ.billings());
311 set("payments", details.circ.payments());
312 set("billable_transaction", details.circ.billable_transaction());
313 set("circ_type", details.circ.circ_type());
314 set("billing_total", details.circ.billing_total());
315 set("payment_total", details.circ.payment_total());
320 set("capture_time", '');
321 set("current_copy", '');
322 set("email_notify", '');
323 set("expire_time", '');
324 set("fulfillment_lib", '');
325 set("fulfillment_staff", '');
326 set("fulfillment_time", '');
327 set("hold_type", '');
328 set("holdable_formats", '');
330 set("phone_notify", '');
331 set("pickup_lib", '');
332 set("prev_check_time", '');
333 set("request_lib", '');
334 set("request_time", '');
335 set("requestor", '');
336 set("selection_depth", '');
337 set("selection_ou", '');
340 set("cancel_time", '');
341 set("notify_time", '');
342 set("notify_count", '');
343 set("notifications", '');
345 set("eligible_copies", '');
347 set("thaw_date", '');
348 set("shelf_time", '');
349 set("cancel_cause", '');
350 set("cancel_note", '');
354 set("status", details.hold.status());
355 set("transit", details.hold.transit());
356 set("capture_time", details.hold.capture_time());
357 set("current_copy", details.hold.current_copy());
358 set("email_notify", details.hold.email_notify());
359 set("expire_time", details.hold.expire_time());
360 try { set("fulfillment_lib" , typeof details.hold.fulfillment_lib() == 'object' ? details.hold.fulfillment_lib().shortname() : data.hash.aou[ details.hold.fulfillment_lib() ].shortname() ); } catch(E) {}
361 set("fulfillment_staff", details.hold.fulfillment_staff());
362 set("fulfillment_time", details.hold.fulfillment_time());
363 set("hold_type", details.hold.hold_type());
364 set("holdable_formats", details.hold.holdable_formats());
365 set("hold_id", details.hold.id());
366 set("phone_notify", details.hold.phone_notify());
367 try { set("pickup_lib" , typeof details.hold.pickup_lib() == 'object' ? details.hold.pickup_lib().shortname() : data.hash.aou[ details.hold.pickup_lib() ].shortname() ); } catch(E) {}
368 set("prev_check_time", details.hold.prev_check_time());
369 try { set("request_lib" , typeof details.hold.request_lib() == 'object' ? details.hold.request_lib().shortname() : data.hash.aou[ details.hold.request_lib() ].shortname() ); } catch(E) {}
370 set("request_time", details.hold.request_time());
371 set("requestor", details.hold.requestor());
372 set("selection_depth", details.hold.selection_depth());
373 set("selection_ou" , typeof details.hold.selection_ou() == 'object' ? details.hold.selection_ou().shortname() : data.hash.aou[ details.hold.selection_ou() ].shortname() );
374 set("target", details.hold.target());
375 set("usr", details.hold.usr());
376 set("cancel_time", details.hold.cancel_time());
377 set("notify_time", details.hold.notify_time());
378 set("notify_count", details.hold.notify_count());
379 set("notifications", details.hold.notifications());
380 set("bib_rec", details.hold.bib_rec());
381 set("eligible_copies", details.hold.eligible_copies());
382 set("frozen", details.hold.frozen());
383 set("thaw_date", details.hold.thaw_date());
384 set("shelf_time", details.hold.shelf_time());
385 set("cancel_cause", details.hold.cancel_cause());
386 set("cancel_note", details.hold.cancel_note());
387 set("notes", details.hold.notes());
390 var x = document.getElementById('cat_deck');
392 JSAN.use('util.deck');
393 var d = new util.deck('cat_deck');
394 d.reset_iframe( urls.XUL_MARC_VIEW, {}, { 'docid' : details.mvr ? details.mvr.doc_id() : -1 } );