[open-ils-commits] r18534 - trunk/Open-ILS/xul/staff_client/server/circ (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Oct 28 17:19:54 EDT 2010
Author: phasefx
Date: 2010-10-28 17:19:48 -0400 (Thu, 28 Oct 2010)
New Revision: 18534
Modified:
trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
trunk/Open-ILS/xul/staff_client/server/circ/util.js
Log:
Put a placeholder row into the checkin list to better handle the async checkin option (so that items show up in the same order in which they were scanned; it also feels more responsive). This also forces us into a better way of handling errors: we keep the rows for such scans in the checkin list, but shove the error condition into the alert message field. These rows can't be acted upon with the Actions for Selected Items menu.
Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2010-10-28 20:06:14 UTC (rev 18533)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2010-10-28 21:19:48 UTC (rev 18534)
@@ -54,8 +54,26 @@
var sel = obj.list.retrieve_selection();
obj.selection_list = util.functional.map_list(
sel,
- function(o) { var p = JSON2js(o.getAttribute('retrieve_id')); p.unique_row_counter = o.getAttribute('unique_row_counter'); return p; }
+ function(o) {
+ if (o.getAttribute('retrieve_id')) {
+ try {
+ var p = JSON2js(o.getAttribute('retrieve_id'));
+ p.unique_row_counter = o.getAttribute('unique_row_counter');
+ return p;
+ } catch(E) {
+ return -1;
+ }
+ } else {
+ return -1;
+ }
+ }
);
+ obj.selection_list = util.functional.filter_list(
+ obj.selection_list,
+ function(o) {
+ return o != -1;
+ }
+ );
obj.error.sdump('D_TRACE', 'circ/copy_status: selection list = ' + js2JSON(obj.selection_list) );
if (obj.selection_list.length == 0) {
obj.controller.view.sel_edit.setAttribute('disabled','true');
@@ -458,6 +476,19 @@
if (barcode) {
if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
}
+ var placeholder_item = new acp();
+ placeholder_item.barcode( barcode );
+ var row_params = obj.list.append( {
+ 'row' : {
+ 'my' : {
+ 'acp' : placeholder_item
+ }
+ },
+ 'to_top' : true,
+ 'on_append' : function(rparams) { obj.row_map[ rparams.unique_row_counter ] = rparams; },
+ 'on_remove' : function(unique_row_counter) { delete obj.row_map[ unique_row_counter ]; }
+ } );
+
var backdate = obj.controller.view.checkin_effective_datepicker.value;
var auto_print = document.getElementById('checkin_auto_print_slips');
if (auto_print) auto_print = auto_print.getAttribute('checked') == 'true';
@@ -477,7 +508,10 @@
'checkin_result' : function(checkin) {
textbox.disabled = false;
//obj.controller.view.cmd_checkin_submit_barcode.setAttribute('disabled', 'false');
- obj.checkin2(checkin,backdate);
+ obj.checkin2(checkin,backdate,row_params);
+ },
+ 'info_blurb' : function(text) {
+ try { row_params.row.my.acp.alert_message( text ); } catch(E) {dump('error: ' + E + '\n');}
}
};
var suppress_holds_and_transits = document.getElementById('suppress_holds_and_transits');
@@ -508,10 +542,13 @@
},
- 'checkin2' : function(checkin,backdate) {
+ 'checkin2' : function(checkin,backdate,row_params) {
var obj = this;
try {
- if (!checkin) return obj.on_failure(); /* circ.util.checkin handles errors and returns null currently */
+ if (!checkin) {/* circ.util.checkin used to be sole handler of errors and returns null currently */
+ obj.list.refresh_row( row_params ); /* however, let's refresh the row because we're shoving error text into the dummy placeholder item's alert_message field */
+ return obj.on_failure();
+ }
if (checkin.ilsevent == 7010 /* COPY_ALERT_MESSAGE */
|| checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
|| checkin.ilsevent == -1 /* offline */
@@ -519,33 +556,30 @@
|| checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
|| checkin.ilsevent == 7009 /* CIRC_CLAIMS_RETURNED */
|| checkin.ilsevent == 7011 /* COPY_STATUS_LOST */
- || checkin.ilsevent == 7012 /* COPY_STATUS_MISSING */) return obj.on_failure();
+ || checkin.ilsevent == 7012 /* COPY_STATUS_MISSING */) {
+ obj.list.refresh_row( row_params );
+ return obj.on_failure();
+ }
var retrieve_id = js2JSON( { 'circ_id' : checkin.circ ? checkin.circ.id() : null , 'copy_id' : checkin.copy.id(), 'barcode' : checkin.copy.barcode(), 'doc_id' : (typeof checkin.record != 'undefined' ? ( typeof checkin.record.ilsevent == 'undefined' ? checkin.record.doc_id() : null ) : null ) } );
if (checkin.circ && checkin.circ.checkin_time() == 'now') checkin.circ.checkin_time(backdate);
if (document.getElementById('trim_list')) {
var x = document.getElementById('trim_list');
if (x.checked) { obj.list.trim_list = 20; } else { obj.list.trim_list = null; }
}
- obj.list.append(
- {
- 'retrieve_id' : retrieve_id,
- 'row' : {
- 'my' : {
- 'circ' : checkin.circ,
- 'mbts' : checkin.circ ? checkin.circ.billable_transaction().summary() : null,
- 'mvr' : checkin.record,
- 'acp' : checkin.copy,
- 'au' : checkin.patron,
- 'status' : checkin.status,
- 'route_to' : checkin.route_to,
- 'message' : checkin.message
- }
- },
- 'to_top' : true,
- 'on_append' : function(rparams) { obj.row_map[ rparams.unique_row_counter ] = rparams; },
- 'on_remove' : function(unique_row_counter) { delete obj.row_map[ unique_row_counter ]; }
+ row_params['retrieve_id'] = retrieve_id;
+ row_params['row'] = {
+ 'my' : {
+ 'circ' : checkin.circ,
+ 'mbts' : checkin.circ ? checkin.circ.billable_transaction().summary() : null,
+ 'mvr' : checkin.record,
+ 'acp' : checkin.copy,
+ 'au' : checkin.patron,
+ 'status' : checkin.status,
+ 'route_to' : checkin.route_to,
+ 'message' : checkin.message
}
- );
+ };
+ obj.list.refresh_row( row_params );
obj.list.node.view.selection.select(0);
JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js 2010-10-28 20:06:14 UTC (rev 18533)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js 2010-10-28 21:19:48 UTC (rev 18534)
@@ -2473,8 +2473,12 @@
check.what_happened = 'no_change';
if (document.getElementById('no_change_label')) {
var m = document.getElementById('no_change_label').getAttribute('value');
- document.getElementById('no_change_label').setAttribute('value', m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_checked_in', [params.barcode]) + ' ');
+ var text = document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_checked_in', [params.barcode]);
+ document.getElementById('no_change_label').setAttribute('value', m + text + ' ');
document.getElementById('no_change_label').setAttribute('hidden','false');
+ if (typeof params.info_blurb == 'function') {
+ params.info_blurb( text );
+ }
}
}
if (check.ilsevent == 1202 /* ITEM_NOT_CATALOGED */ && check.copy.status() != 11) {
@@ -2706,9 +2710,13 @@
msg = '';
if (document.getElementById('no_change_label')) {
var m = document.getElementById('no_change_label').getAttribute('value');
- m += document.getElementById('circStrings').getFormattedString('staff.circ.utils.capture', [params.barcode]);
+ var text = document.getElementById('circStrings').getFormattedString('staff.circ.utils.capture', [params.barcode]);
+ m += text + ' ';
document.getElementById('no_change_label').setAttribute('value', m);
document.getElementById('no_change_label').setAttribute('hidden','false');
+ if (typeof params.info_blurb == 'function') {
+ params.info_blurb( text );
+ }
}
break;
case 6: /* IN TRANSIT */
@@ -2741,6 +2749,9 @@
var needs_cat = document.getElementById('circStrings').getFormattedString('staff.circ.utils.needs_cataloging', [params.barcode]);
document.getElementById('no_change_label').setAttribute('value', m + needs_cat + ' ');
document.getElementById('no_change_label').setAttribute('hidden','false');
+ if (typeof params.info_blurb == 'function') {
+ params.info_blurb( needs_cat );
+ }
}
break;
case 15: // ON_RESERVATION_SHELF
@@ -2819,9 +2830,13 @@
msg = '';
if (document.getElementById('no_change_label')) {
var m = document.getElementById('no_change_label').getAttribute('value');
- m += document.getElementById('circStrings').getFormattedString('staff.circ.utils.reservation_capture', [params.barcode]);
+ var text = document.getElementById('circStrings').getFormattedString('staff.circ.utils.reservation_capture', [params.barcode]);
+ m += text + ' ';
document.getElementById('no_change_label').setAttribute('value', m);
document.getElementById('no_change_label').setAttribute('hidden','false');
+ if (typeof params.info_blurb == 'function') {
+ params.info_blurb( text );
+ }
}
break;
default:
@@ -3078,6 +3093,9 @@
var trans_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.in_transit', [params.barcode]);
document.getElementById('no_change_label').setAttribute('value', m + trans_msg + ' ');
document.getElementById('no_change_label').setAttribute('hidden','false');
+ if (typeof params.info_blurb == 'function') {
+ params.info_blurb( trans_msg );
+ }
}
} else /* ASSET_COPY_NOT_FOUND */ if (check.ilsevent == 1502) {
@@ -3103,6 +3121,9 @@
var m = document.getElementById('no_change_label').getAttribute('value');
document.getElementById('no_change_label').setAttribute('value',m + mis_scan_msg + ' ');
document.getElementById('no_change_label').setAttribute('hidden','false');
+ if (typeof params.info_blurb == 'function') {
+ params.info_blurb( mis_scan_msg );
+ }
}
} else /* HOLD_CAPTURE_DELAYED */ if (check.ilsevent == 7019) {
@@ -3200,6 +3221,9 @@
var m = document.getElementById('no_change_label').getAttribute('value');
document.getElementById('no_change_label').setAttribute('value',m + mis_scan_msg + ' ');
document.getElementById('no_change_label').setAttribute('hidden','false');
+ if (typeof params.info_blurb == 'function') {
+ params.info_blurb( mis_scan_msg );
+ }
}
break;
case 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */ : break;
More information about the open-ils-commits
mailing list