[open-ils-commits] r12219 - branches/rel_1_2/Open-ILS/xul/staff_client/server/circ (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Feb 18 14:08:44 EST 2009
Author: phasefx
Date: 2009-02-18 14:08:41 -0500 (Wed, 18 Feb 2009)
New Revision: 12219
Modified:
branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkin.js
branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/util.js
Log:
backport of checkin fix for audibles that were getting delayed by dialogs. Thanks to MLC for testing the patch! Still need to port this to 1.4
Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-02-18 17:15:13 UTC (rev 12218)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-02-18 19:08:41 UTC (rev 12219)
@@ -306,7 +306,9 @@
if (auto_print) auto_print = auto_print.checked;
JSAN.use('circ.util');
circ.util.checkin_via_barcode(
- ses(), { 'barcode' : barcode }, backdate, auto_print, {
+ 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');
@@ -320,7 +322,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('Something went wrong in circ.util.checkin: ',E);
Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/util.js 2009-02-18 17:15:13 UTC (rev 12218)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/circ/util.js 2009-02-18 19:08:41 UTC (rev 12219)
@@ -1020,36 +1020,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('Check In Failed (in circ.util.checkin): ',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' : 'Override Checkin Failure?',
'overridable_events' : [
@@ -1078,16 +1086,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('Check In Failed (in circ.util.checkin): ',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