JSAN.use('util.network'); network = new util.network();
JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
- setTimeout( function() { load_item(); }, 1000 ); // timeout so xulG gets a chance to get pushed in
+ // timeout so xulG gets a chance to get pushed in
+ setTimeout(
+ function () { xulG.from_item_details_new = false; load_item(); },
+ 1000
+ );
} catch(E) {
try { error.standard_unexpected_error_alert('main/test.xul',E); } catch(F) { alert(E); }
try {
if (! xulG.barcode) return;
- var details = network.simple_request('FM_ACP_DETAILS_VIA_BARCODE.authoritative', [ ses(), xulG.barcode ]);
- // Should get back .mvr, .copy, .volume, .transit, .circ, .hold
+ if (xulG.fetched_copy_details && xulG.fetched_copy_details[xulG.barcode]) {
+ var details = xulG.fetched_copy_details[xulG.barcode];
+ // We don't want to use these details more than once (i.e., we
+ // don't want cached data after things have potentially changed).
+ delete xulG.fetched_copy_details[xulG.barcode];
+ } else {
+ var details = network.simple_request('FM_ACP_DETAILS_VIA_BARCODE.authoritative', [ ses(), xulG.barcode ]);
+ // Should get back .mvr, .copy, .volume, .transit, .circ, .hold
+ }
if (typeof bib_brief_overlay == 'function') bib_brief_overlay( { 'mvr' : details.mvr, 'acp' : details.copy } );
/*
g.data.stash_retrieve();
if (window.xulG.barcodes && window.xulG.barcodes.length) {
- if (window.xulG.from_item_details_new) {
- // Switch item status display to "alternate view"
- g.copy_status.controller.control_map.cmd_alt_view[1](0);
-
- // This property's truthiness should not persist any
- // longer. Otherwise, user's won't get results if they
- // enter a different barcode into the Alternate View.
- window.xulG.from_item_details_new = false;
- }
-
- // This timeout is needed to populate the
- // "Actions for (Catalogers|Selected Items)" menus.
- // Without this, the other fields still get populated
- // with data about the item referred to by barcode, but
- // for some reason those menus don't start working.
- JSAN.use('util.exec'); var exec = new util.exec();
- var funcs = [];
- for (var i = 0; i < window.xulG.barcodes.length; i++) {
- funcs.push(
- function(b){
- return function() {
- g.copy_status.copy_status(b);
- }
- }(window.xulG.barcodes[i])
- );
- }
- setTimeout(function() { exec.chain(funcs); }, 1000);
+ g.barcodes = window.xulG.barcodes;
} else {
g.barcodes = xul_param(
'barcodes',{
'clear_xpcom' : true,
}
) || [];
+ }
- if (g.barcodes.length > 0) {
- JSAN.use('util.exec'); var exec = new util.exec();
- var funcs = [];
- for (var i = 0; i < g.barcodes.length; i++) {
- funcs.push(
- function(b){
- return function() {
- g.copy_status.copy_status(b);
- }
- }(g.barcodes[i])
- );
- }
- if (window.xulG.from_item_details_new) {
- g.copy_status.controller.control_map.cmd_alt_view[1](0);
- window.xulG.from_item_details_new = false;
- }
- setTimeout(function() { exec.chain(funcs); }, 1000);
- }
+ window.xulG.fetched_copy_details = {};
+
+ if (window.xulG.from_item_details_new) {
+ // Switch item status display to "alternate view"
+ g.copy_status.controller.control_map.cmd_alt_view[1](0);
+ }
+
+ JSAN.use('util.exec'); var exec = new util.exec();
+ var funcs = [];
+ for (var i = 0; i < g.barcodes.length; i++) {
+ funcs.push(
+ function(b){
+ return function() {
+ window.xulG.fetched_copy_details[b] =
+ g.copy_status.copy_status(b);
+ }
+ }(g.barcodes[i])
+ );
}
+ exec.chain(funcs);
} catch(E) {
var err_msg = document.getElementById("commonStrings").getFormattedString('common.exception', ['circ.copy_status.xul', E]);
try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }