[open-ils-commits] r11917 - trunk/Open-ILS/xul/staff_client/server/circ
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jan 22 15:52:03 EST 2009
Author: phasefx
Date: 2009-01-22 15:51:57 -0500 (Thu, 22 Jan 2009)
New Revision: 11917
Modified:
trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
trunk/Open-ILS/xul/staff_client/server/circ/util.js
Log:
refactor checkin to fix audibles coming after dialogs instead of before. The checkin code for the main checkin interface was effectively asynchronous; sound and dialogs appear to misbehave when in asynchronous callbacks
Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-01-22 20:48:07 UTC (rev 11916)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-01-22 20:51:57 UTC (rev 11917)
@@ -301,8 +301,10 @@
if (auto_print) auto_print = auto_print.checked;
JSAN.use('circ.util');
circ.util.checkin_via_barcode(
- ses(), { 'barcode' : barcode }, backdate, auto_print, {
- 'disable_textbox' : function() {
+ ses(),
+ {
+ 'barcode' : barcode,
+ 'disable_textbox' : function() {
obj.controller.view.checkin_barcode_entry_textbox.disabled = true;
obj.controller.view.cmd_checkin_submit_barcode.setAttribute('disabled', 'true');
},
@@ -315,7 +317,9 @@
obj.controller.view.cmd_checkin_submit_barcode.setAttribute('disabled', 'false');
obj.checkin2(checkin,backdate);
}
- }
+ },
+ backdate,
+ auto_print
);
} catch(E) {
obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.exception', [E]));
Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js 2009-01-22 20:48:07 UTC (rev 11916)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js 2009-01-22 20:51:57 UTC (rev 11917)
@@ -1871,39 +1871,44 @@
JSAN.use('util.error'); var error = new util.error();
JSAN.use('util.network'); var network = new util.network();
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- JSAN.use('util.date');
+ JSAN.use('util.date'); JSAN.use('util.functional');
if (backdate && (backdate == util.date.formatted_date(new Date(),'%Y-%m-%d')) ) backdate = null;
//var params = { 'barcode' : barcode };
if (backdate) params.backdate = util.date.formatted_date(backdate + ' 00:00:00','%{iso8601}');
- if (typeof async == 'object') {
- try { async.disable_textbox(); }
- catch(E) { error.sdump('D_ERROR','async.disable_textbox() = ' + E); };
+ if (typeof params.disable_textbox == 'function') {
+ try { params.disable_textbox(); }
+ catch(E) { error.sdump('D_ERROR','params.disable_textbox() = ' + E); };
}
+
+ function checkin_callback(req) {
+ try {
+ var check = req.getResultObject();
+ var r = circ.util.checkin_via_barcode2(session,params,backdate,auto_print,check);
+ if (typeof params.checkin_result == 'function') {
+ try { params.checkin_result(r); }
+ catch(E) { error.sdump('D_ERROR','params.checkin_result() = ' + E); };
+ }
+ if (typeof async == 'function') async(check);
+ return check;
+ } catch(E) {
+ JSAN.use('util.error'); var error = new util.error();
+ error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.error', ['1']), E);
+ if (typeof params.enable_textbox == 'function') {
+ try { params.enable_textbox(); }
+ catch(E) { error.sdump('D_ERROR','params.disable_textbox() = ' + E); };
+ }
+ return null;
+ }
+ }
+
var check = network.request(
api.CHECKIN_VIA_BARCODE.app,
api.CHECKIN_VIA_BARCODE.method,
- [ session, params ],
- async ? function(req) {
- try {
- var check = req.getResultObject();
- var r = circ.util.checkin_via_barcode2(session,params,backdate,auto_print,check);
- if (typeof async == 'object') {
- try { async.checkin_result(r); }
- catch(E) { error.sdump('D_ERROR','async.checkin_result() = ' + E); };
- }
- } catch(E) {
- JSAN.use('util.error'); var error = new util.error();
- error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.error', ['1']), E);
- if (typeof async == 'object') {
- try { async.enable_textbox(); }
- catch(E) { error.sdump('D_ERROR','async.disable_textbox() = ' + E); };
- }
- return null;
- }
- } : null,
+ [ session, util.functional.filter_object( params, function(i,o) { return typeof o != 'function'; } ) ],
+ async ? checkin_callback : null,
{
'title' : document.getElementById('circStrings').getString('staff.circ.utils.checkin.override'),
'overridable_events' : [
@@ -1932,16 +1937,16 @@
}
}
);
- if (!async) {
- return circ.util.checkin_via_barcode2(session,params,backdate,auto_print,check);
+ if (! async ) {
+ return checkin_callback( { 'getResultObject' : function() { return check; } } );
}
} catch(E) {
JSAN.use('util.error'); var error = new util.error();
error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.error', ['2']), E);
- if (typeof async == 'object') {
- try { async.enable_textbox(); } catch(E) { error.sdump('D_ERROR','async.disable_textbox() = ' + E); };
+ if (typeof params.enable_textbox == 'function') {
+ try { params.enable_textbox(); } catch(E) { error.sdump('D_ERROR','params.disable_textbox() = ' + E); };
}
return null;
}
More information about the open-ils-commits
mailing list