[open-ils-commits] r14959 - trunk/Open-ILS/xul/staff_client/server/circ (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 18 16:58:40 EST 2009
Author: erickson
Date: 2009-11-18 16:58:35 -0500 (Wed, 18 Nov 2009)
New Revision: 14959
Modified:
trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js
trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js
trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul
Log:
Patch from Lebbeous Fogle-Weekley to remove some duplicate network calls in the copy status and details UI
Modified: trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js 2009-11-18 21:03:57 UTC (rev 14958)
+++ trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js 2009-11-18 21:58:35 UTC (rev 14959)
@@ -14,7 +14,11 @@
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); }
@@ -57,8 +61,15 @@
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 } );
/*
Modified: trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js 2009-11-18 21:03:57 UTC (rev 14958)
+++ trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js 2009-11-18 21:58:35 UTC (rev 14959)
@@ -1165,13 +1165,12 @@
}
obj.controller.view.copy_status_barcode_entry_textbox.value = '';
obj.controller.view.copy_status_barcode_entry_textbox.focus();
-
+ return result; // In some cases we're going to want to save this
} catch(E) {
obj.error.standard_unexpected_error_alert('barcode = ' + barcode,E);
obj.controller.view.copy_status_barcode_entry_textbox.select();
obj.controller.view.copy_status_barcode_entry_textbox.focus();
}
-
},
'spawn_copy_editor' : function() {
Modified: trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul 2009-11-18 21:03:57 UTC (rev 14958)
+++ trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul 2009-11-18 21:58:35 UTC (rev 14959)
@@ -61,33 +61,7 @@
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',{
@@ -97,26 +71,28 @@
'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); }
More information about the open-ils-commits
mailing list