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("status_changed_time", '');
105 set("copy_creator", '');
108 set("deposit_amount", '');
109 set("dummy_author", '');
110 set("dummy_title", '');
111 set("copy_edit_date", '');
112 set("copy_editor", '');
113 set("fine_level", '');
116 set("loan_duration", '');
118 set("opac_visible", '');
123 set("stat_cat_entry_copy_maps", '');
124 set("circulations", '');
125 set("total_circ_count", '');
126 set_tooltip("total_circ_count", '');
127 set("total_circ_count_prev_year", '');
128 set("total_circ_count_curr_year", '');
132 set("stat_cat_entries", details.copy.stat_cat_entries());
133 set("age_protect", details.copy.age_protect());
134 set("alert_message", details.copy.alert_message());
135 set("barcode", details.copy.barcode());
136 set("call_number", details.copy.call_number());
137 set("circ_as_type", details.copy.circ_as_type());
138 set("copy_circ_lib" , details.copy.circ_lib());
139 set("circ_modifier", details.copy.circ_modifier());
140 set("circulate", details.copy.circulate());
141 set("copy_number", details.copy.copy_number());
142 set("copy_create_date", details.copy.create_date());
143 set("status_changed_time", details.copy.status_changed_time());
144 set("copy_creator", details.copy.creator());
145 set("deleted", details.copy.deleted());
146 set("deposit", details.copy.deposit());
147 set("deposit_amount", details.copy.deposit_amount());
148 set("dummy_author", details.copy.dummy_author());
149 set("dummy_title", details.copy.dummy_title());
150 set("copy_edit_date", details.copy.edit_date());
151 set("copy_editor", details.copy.editor());
152 set("fine_level", details.copy.fine_level());
153 set("holdable", details.copy.holdable());
154 set("copy_id", details.copy.id());
155 set("loan_duration", details.copy.loan_duration());
156 set("location", details.copy.location());
157 set("opac_visible", details.copy.opac_visible());
158 set("price", details.copy.price());
159 set("ref", details.copy.ref());
160 set("status", details.copy.status());
161 set("notes", details.copy.notes());
162 set("stat_cat_entry_copy_maps", details.copy.stat_cat_entry_copy_maps());
163 set("circulations", details.copy.circulations());
164 set("holds", details.copy.holds());
166 network.simple_request('FM_CIRC_IMPROVED_COUNT_VIA_COPY', [ses(), { 'copy' : details.copy.id() } ], function(req) {
167 var r = req.getResultObject();
168 var total = 0; var tooltip = ''; var year = {};
169 for (var i = 0; i < r.length; i++) {
170 total += Number( r[i].count() );
171 if (typeof year[ r[i].year() ] == 'undefined') year[ r[i].year() ] = 0;
172 year[ r[i].year() ] += Number( r[i].count() ); // Add original circs and renewals together
174 set( 'total_circ_count', total );
175 var curr_year = (new Date()).getFullYear();
176 var prev_year = curr_year - 1;
177 set( 'total_circ_count_curr_year', year[ curr_year ] || 0 );
178 set( 'total_circ_count_prev_year', year[ prev_year ] || 0 );
179 var keys = []; for (var i in year) { keys.push( i ); }; keys.sort();
180 for (var i = 0; i < keys.length; i++) {
181 tooltip += document.getElementById('circStrings').getFormattedString(
182 'staff.circ.copy_details.circ_count_by_year', [
183 keys[i] == -1 ? document.getElementById('circStrings').getString('staff.circ.copy_details.circ_count_by_year.legacy_label') : keys[i],
188 set_tooltip( 'total_circ_count', tooltip );
193 set("volume_create_date", '');
194 set("volume_creator", '');
196 set("volume_edit_date", '');
197 set("volume_editor", '');
198 set("volume_id", '');
200 set("owning_lib" , '');
206 if (details.volume) {
207 set("copies", details.volume.copies());
208 set("volume_create_date", details.volume.create_date());
209 set("volume_creator", details.volume.creator());
210 set("deleted", details.volume.deleted());
211 set("volume_edit_date", details.volume.edit_date());
212 set("volume_editor", details.volume.editor());
213 set("volume_id", details.volume.id());
214 set("label", details.volume.label());
215 set("owning_lib" , details.volume.owning_lib());
216 set("record", details.volume.record());
217 set("notes", details.volume.notes());
218 set("uri_maps", details.volume.uri_maps());
219 set("uris", details.volume.uris());
222 set("copy_status", '');
224 set("dest_recv_time", '');
225 set("transit_id", '');
226 set("persistant_transfer", '');
229 set("source_send_time", '');
230 set("target_copy", '');
231 set("hold_transit_copy", '');
233 if (details.transit) {
234 set("copy_status", details.transit.copy_status());
235 set("dest", details.transit.dest());
236 set("dest_recv_time", details.transit.dest_recv_time());
237 set("transit_id", details.transit.id());
238 set("persistant_transfer", details.transit.persistant_transfer());
239 set("prev_hop", details.transit.prev_hop());
240 set("source", details.transit.source());
241 set("source_send_time", details.transit.source_send_time());
242 set("target_copy", details.transit.target_copy());
243 set("hold_transit_copy", details.transit.hold_transit_copy());
246 set("checkin_lib", '');
247 set("checkin_workstation","");
248 set("checkin_staff", '');
249 set("checkin_time", '');
250 set("checkin_scan_time", '');
251 set("circ_circ_lib" , '');
252 set("circ_staff", '');
253 set("desk_renewal", '');
256 set("duration_rule", '');
257 set("fine_interval", '');
260 set("max_fine_rule", '');
261 set("opac_renewal", '');
262 set("phone_renewal", '');
263 set("recuring_fine", '');
264 set("recuring_fine_rule", '');
265 set("renewal_remaining", '');
266 set("stop_fines", '');
267 set("stop_fines_time", '');
268 set("target_copy", '');
270 set("xact_finish", '');
271 set("xact_start", '');
272 set("create_time", '');
273 set("workstation", '');
274 set("renewal_workstation", '');
275 set("checkout_workstation", '');
278 set("billable_transaction", '');
279 set("circ_type", '');
280 set("billing_total", '');
281 set("payment_total", '');
284 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) {};
285 if (details.circ.checkin_workstation()) {
286 set("checkin_workstation", details.circ.checkin_workstation().name());
288 set("checkin_staff", details.circ.checkin_staff());
289 set("checkin_time", details.circ.checkin_time());
290 set("checkin_scan_time", details.circ.checkin_scan_time());
291 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) {};
292 set("circ_staff", details.circ.circ_staff());
293 set("desk_renewal", details.circ.desk_renewal());
294 set("due_date", details.circ.due_date());
295 set("duration", details.circ.duration());
296 set("duration_rule", details.circ.duration_rule());
297 set("fine_interval", details.circ.fine_interval());
298 set("circ_id", details.circ.id());
299 set("max_fine", details.circ.max_fine());
300 set("max_fine_rule", details.circ.max_fine_rule());
301 set("opac_renewal", details.circ.opac_renewal());
302 set("phone_renewal", details.circ.phone_renewal());
303 set("recuring_fine", details.circ.recuring_fine());
304 set("recuring_fine_rule", details.circ.recuring_fine_rule());
305 set("renewal_remaining", details.circ.renewal_remaining());
306 set("stop_fines", details.circ.stop_fines());
307 set("stop_fines_time", details.circ.stop_fines_time());
308 set("target_copy", details.circ.target_copy());
309 set("usr", details.circ.usr());
310 set("xact_finish", details.circ.xact_finish());
311 set("xact_start", details.circ.xact_start());
312 set("create_time", details.circ.create_time());
313 set("workstation", details.circ.workstation());
314 if (get_bool(details.circ.opac_renewal())||get_bool(details.circ.phone_renewal())||get_bool(details.circ.desk_renewal())) {
315 set("renewal_workstation", typeof details.circ.workstation() == 'object' ? details.circ.workstation().name() : details.circ.workstation() );
316 network.simple_request('FM_CIRC_CHAIN', [ses(), details.circ.id() ], function(req) { // Tiny race condition between details.circ and circs[circs.length-1] here, but meh :)
318 var circs = req.getResultObject();
319 set("checkout_workstation", typeof circs[0].workstation() == 'object' ? circs[0].workstation().name() : circs[0].workstation() );
321 alert('Error in alternate_copy_summary.js, FM_CIRC_CHAIN: ' + E);
325 set("checkout_workstation", typeof details.circ.workstation() == 'object' ? details.circ.workstation().name() : details.circ.workstation() );
327 set("billings", details.circ.billings());
328 set("payments", details.circ.payments());
329 set("billable_transaction", details.circ.billable_transaction());
330 set("circ_type", details.circ.circ_type());
331 set("billing_total", details.circ.billing_total());
332 set("payment_total", details.circ.payment_total());
337 set("capture_time", '');
338 set("current_copy", '');
339 set("email_notify", '');
340 set("expire_time", '');
341 set("fulfillment_lib", '');
342 set("fulfillment_staff", '');
343 set("fulfillment_time", '');
344 set("hold_type", '');
345 set("holdable_formats", '');
347 set("phone_notify", '');
348 set("pickup_lib", '');
349 set("prev_check_time", '');
350 set("request_lib", '');
351 set("request_time", '');
352 set("requestor", '');
353 set("selection_depth", '');
354 set("selection_ou", '');
357 set("cancel_time", '');
358 set("notify_time", '');
359 set("notify_count", '');
360 set("notifications", '');
362 set("eligible_copies", '');
364 set("thaw_date", '');
365 set("shelf_time", '');
366 set("cancel_cause", '');
367 set("cancel_note", '');
371 set("status", details.hold.status());
372 set("transit", details.hold.transit());
373 set("capture_time", details.hold.capture_time());
374 set("current_copy", details.hold.current_copy());
375 set("email_notify", details.hold.email_notify());
376 set("expire_time", details.hold.expire_time());
377 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) {}
378 set("fulfillment_staff", details.hold.fulfillment_staff());
379 set("fulfillment_time", details.hold.fulfillment_time());
380 set("hold_type", details.hold.hold_type());
381 set("holdable_formats", details.hold.holdable_formats());
382 set("hold_id", details.hold.id());
383 set("phone_notify", details.hold.phone_notify());
384 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) {}
385 set("prev_check_time", details.hold.prev_check_time());
386 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) {}
387 set("request_time", details.hold.request_time());
388 set("requestor", details.hold.requestor());
389 set("selection_depth", details.hold.selection_depth());
390 set("selection_ou" , typeof details.hold.selection_ou() == 'object' ? details.hold.selection_ou().shortname() : data.hash.aou[ details.hold.selection_ou() ].shortname() );
391 set("target", details.hold.target());
392 set("usr", details.hold.usr());
393 set("cancel_time", details.hold.cancel_time());
394 set("notify_time", details.hold.notify_time());
395 set("notify_count", details.hold.notify_count());
396 set("notifications", details.hold.notifications());
397 set("bib_rec", details.hold.bib_rec());
398 set("eligible_copies", details.hold.eligible_copies());
399 set("frozen", details.hold.frozen());
400 set("thaw_date", details.hold.thaw_date());
401 set("shelf_time", details.hold.shelf_time());
402 set("cancel_cause", details.hold.cancel_cause());
403 set("cancel_note", details.hold.cancel_note());
404 set("notes", details.hold.notes());
407 var x = document.getElementById('cat_deck');
409 JSAN.use('util.deck');
410 var d = new util.deck('cat_deck');
411 d.reset_iframe( urls.XUL_MARC_VIEW, {}, { 'docid' : details.mvr ? details.mvr.doc_id() : -1 } );