[open-ils-commits] r16243 - in trunk/Open-ILS: src/sql/Pg src/sql/Pg/upgrade xul/staff_client/chrome/content/util xul/staff_client/server/circ (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Apr 15 14:56:16 EDT 2010
Author: phasefx
Date: 2010-04-15 14:56:11 -0400 (Thu, 15 Apr 2010)
New Revision: 16243
Modified:
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
trunk/Open-ILS/src/sql/Pg/upgrade/0234.data.org-setting-ui.circ.suppress_checkin_popups.sql
trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js
trunk/Open-ILS/xul/staff_client/server/circ/util.js
Log:
* tweak wording for ui.circ.suppress_checkin_popups setting so that it sorts better
* suppressing alerts/dialogs based on setting
* auto_override_these_events option for util.network
* use auto_override_these_events during checkin based on setting
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-04-15 16:02:48 UTC (rev 16242)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-04-15 18:56:11 UTC (rev 16243)
@@ -1946,12 +1946,12 @@
'ui.circ.suppress_checkin_popups',
oils_i18n_gettext(
'ui.circ.suppress_checkin_popups',
- 'Suppress popup-dialogs during check-in.',
+ 'Circ: Suppress popup-dialogs during check-in.',
'coust',
'label'),
oils_i18n_gettext(
'ui.circ.suppress_checkin_popups',
- 'Suppress popup-dialogs during check-in.',
+ 'Circ: Suppress popup-dialogs during check-in.',
'coust',
'description'),
'bool'
Modified: trunk/Open-ILS/src/sql/Pg/upgrade/0234.data.org-setting-ui.circ.suppress_checkin_popups.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0234.data.org-setting-ui.circ.suppress_checkin_popups.sql 2010-04-15 16:02:48 UTC (rev 16242)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0234.data.org-setting-ui.circ.suppress_checkin_popups.sql 2010-04-15 18:56:11 UTC (rev 16243)
@@ -6,12 +6,12 @@
'ui.circ.suppress_checkin_popups',
oils_i18n_gettext(
'ui.circ.suppress_checkin_popups',
- 'Suppress popup-dialogs during check-in.',
+ 'Circ: Suppress popup-dialogs during check-in.',
'coust',
'label'),
oils_i18n_gettext(
'ui.circ.suppress_checkin_popups',
- 'Suppress popup-dialogs during check-in.',
+ 'Circ: Suppress popup-dialogs during check-in.',
'coust',
'description'),
'bool'
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js 2010-04-15 16:02:48 UTC (rev 16242)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/network.js 2010-04-15 18:56:11 UTC (rev 16243)
@@ -416,8 +416,34 @@
var obj = this;
try {
if (!override_params.text) override_params.text = {};
+ if (!override_params.auto_override_these_events) override_params.auto_override_these_events = [];
function override(r) {
try {
+ // test to see if we can suppress this dialog and auto-override
+ var auto_override = false;
+ if (override_params.auto_override_these_events.length > 0) {
+ auto_override = true;
+ for (var i = 0; i < r.length; i++) {
+ if (
+ (r[i].ilsevent != 'undefined') &&
+ (
+ (override_params.auto_override_these_events.indexOf( r[i].ilsevent == null ? null : Number(r[i].ilsevent) ) != -1) ||
+ (override_params.auto_override_these_events.indexOf( r[i].textcode ) != -1)
+ )
+ ) {
+ // so far so good
+ } else {
+ // showstopper
+ auto_override = false;
+ }
+ }
+ }
+ if (auto_override) {
+ obj.sound.bad();
+ req = obj._request(app,name + '.override',params);
+ return req;
+ }
+
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
obj.sound.bad();
var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">' +
Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js 2010-04-15 16:02:48 UTC (rev 16242)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js 2010-04-15 18:56:11 UTC (rev 16243)
@@ -2253,6 +2253,8 @@
}
}
+ var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
+
var check = network.request(
api.CHECKIN_VIA_BARCODE.app,
api.CHECKIN_VIA_BARCODE.method,
@@ -2260,6 +2262,19 @@
async ? checkin_callback : null,
{
'title' : document.getElementById('circStrings').getString('staff.circ.utils.checkin.override'),
+ 'auto_override_these_events' : suppress_popups ? [
+ null /* custom event */,
+ 1203 /* COPY_BAD_STATUS */,
+ 1213 /* PATRON_BARRED */,
+ 1217 /* PATRON_INACTIVE */,
+ 1224 /* PATRON_ACCOUNT_EXPIRED */,
+ 1234 /* ITEM_DEPOSIT_PAID */,
+ 7009 /* CIRC_CLAIMS_RETURNED */,
+ 7010 /* COPY_ALERT_MESSAGE */,
+ 7011 /* COPY_STATUS_LOST */,
+ 7012 /* COPY_STATUS_MISSING */,
+ 7013 /* PATRON_EXCEEDS_FINES */
+ ] : [],
'overridable_events' : [
null /* custom event */,
1203 /* COPY_BAD_STATUS */,
@@ -2271,7 +2286,7 @@
7010 /* COPY_ALERT_MESSAGE */,
7011 /* COPY_STATUS_LOST */,
7012 /* COPY_STATUS_MISSING */,
- 7013 /* PATRON_EXCEEDS_FINES */,
+ 7013 /* PATRON_EXCEEDS_FINES */
],
'text' : {
'1203' : function(r) {
@@ -2307,6 +2322,7 @@
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.sound'); var sound = new util.sound();
error.sdump('D_DEBUG','check = ' + error.pretty_print( js2JSON( check ) ) );
@@ -2526,11 +2542,14 @@
msg += '\n';
}
var rv = 0;
- var no_print_prompting = data.hash.aous['circ.staff_client.do_not_auto_attempt_print'];
+ var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
+ if (suppress_popups) {
+ rv = auto_print ? 0 : -1; auto_print = true; // skip dialog and PRINT or DO NOT PRINT based on Auto-Print checkbox
+ }
+ var x = data.hash.aous['circ.staff_client.do_not_auto_attempt_print'];
+ var no_print_prompting = x ? ( x.indexOf( "Hold Slip" ) > -1) : false;
if (no_print_prompting) {
- if (no_print_prompting.indexOf( "Hold Slip" ) > -1) {
- rv = -1; auto_print = true; // DO NOT PRINT and skip dialog
- }
+ rv = -1; auto_print = true; // DO NOT PRINT and skip dialog
}
print_data.slip_date = util.date.formatted_date(new Date(),'%F');
print_data.slip_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.slip_date', [print_data.slip_date]);
@@ -2548,6 +2567,11 @@
document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
'/xul/server/skin/media/images/turtle.gif'
);
+ } else {
+ if (suppress_popups && !no_print_prompting) {
+ // FIXME: Add SFX and/or GFX
+ sound.circ_bad();
+ }
}
if (rv == 0) {
try {
@@ -2599,15 +2623,17 @@
check.what_happened = 'cataloging';
check.route_to = 'CATALOGING';
print_data.route_to;
- if (document.getElementById('do_not_alert_on_precat')) {
- var x = document.getElementById('do_not_alert_on_precat');
- if (x.getAttribute('checked') != 'true') {
- print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
- msg += print_data.route_to_msg;
- }
- } else {
+ var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
+ var x = document.getElementById('do_not_alert_on_precat');
+ var do_not_alert_on_precats = x ? ( x.getAttribute('checked') == 'true' ) : false;
+ if ( !suppress_popups && !do_not_alert_on_precats ) {
print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
msg += print_data.route_to_msg;
+ } else {
+ if (suppress_popups && !do_not_alert_on_precats) {
+ // FIXME: add SFX and/or GFX
+ sound.circ_bad();
+ }
}
if (document.getElementById('no_change_label')) {
var m = document.getElementById('no_change_label').getAttribute('value');
@@ -2763,11 +2789,14 @@
msg += '\n';
}
var rv = 0;
- var no_print_prompting = data.hash.aous['circ.staff_client.do_not_auto_attempt_print'];
+ var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
+ if (suppress_popups) {
+ rv = auto_print ? 0 : -1; auto_print = true; // skip dialog and PRINT or DO NOT PRINT based on Auto-Print checkbox
+ }
+ var x = data.hash.aous['circ.staff_client.do_not_auto_attempt_print'];
+ var no_print_prompting = x ? (x.indexOf( check.payload.hold ? "Hold/Transit Slip" : "Transit Slip" ) > -1) : false;
if (no_print_prompting) {
- if (no_print_prompting.indexOf( check.payload.hold ? "Hold/Transit Slip" : "Transit Slip" ) > -1) {
- rv = -1; auto_print = true; // DO NOT PRINT and skip dialog
- }
+ rv = -1; auto_print = true; // DO NOT PRINT and skip dialog
}
print_data.slip_date = util.date.formatted_date(new Date(),'%F');
print_data.slip_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.slip_date', [print_data.slip_date]);
@@ -2784,6 +2813,11 @@
document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
'/xul/server/skin/media/images/turtle.gif'
);
+ } else {
+ if (suppress_popups && !no_print_prompting) {
+ // FIXME: add SFX and/or GFX
+ sound.circ_bad();
+ }
}
if (rv == 0) {
try {
@@ -2826,14 +2860,20 @@
check.what_happened = 'not_found';
check.route_to = 'CATALOGING';
var mis_scan_msg = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [params.barcode]);
- error.yns_alert(
- mis_scan_msg,
- document.getElementById('circStrings').getString('staff.circ.alert'),
- null,
- document.getElementById('circStrings').getString('staff.circ.utils.msg.ok'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
+ var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
+ if (!suppress_popups) {
+ error.yns_alert(
+ mis_scan_msg,
+ document.getElementById('circStrings').getString('staff.circ.alert'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.utils.msg.ok'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ } else {
+ // FIXME: add SFX and/or GFX
+ sound.circ_bad();
+ }
if (document.getElementById('no_change_label')) {
var m = document.getElementById('no_change_label').getAttribute('value');
document.getElementById('no_change_label').setAttribute('value',m + mis_scan_msg + ' ');
@@ -2845,15 +2885,21 @@
check.what_happened = 'hold_capture_delayed';
var rv = 0;
msg += document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.description');
- rv = error.yns_alert_formatted(
- msg,
- document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.titlebar'),
- document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.prompt_for_nocapture'),
- document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.prompt_for_capture'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
- '/xul/server/skin/media/images/stop_sign.png'
- );
+ var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popupst'];
+ if (!suppress_popups) {
+ rv = error.yns_alert_formatted(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.titlebar'),
+ document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.prompt_for_nocapture'),
+ document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.prompt_for_capture'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
+ '/xul/server/skin/media/images/stop_sign.png'
+ );
+ } else {
+ // FIXME: add SFX and/or GFX
+ sound.circ_bad();
+ }
params.capture = rv == 0 ? 'nocapture' : 'capture';
return circ.util.checkin_via_barcode(session,params,backdate,auto_print,false);
More information about the open-ils-commits
mailing list