[open-ils-commits] r18877 - trunk/Open-ILS/xul/staff_client/server/circ (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Nov 30 13:17:50 EST 2010
Author: phasefx
Date: 2010-11-30 13:17:47 -0500 (Tue, 30 Nov 2010)
New Revision: 18877
Modified:
trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
trunk/Open-ILS/xul/staff_client/server/circ/util.js
Log:
add click event to red-text label in check-in UI for retrieving a patron when the associated transaction has a balance owed. Code tweak to reduce the number of getElementById lookups
Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2010-11-30 17:11:34 UTC (rev 18876)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2010-11-30 18:17:47 UTC (rev 18877)
@@ -408,16 +408,18 @@
var row = params.row;
if (typeof params.on_retrieve == 'function') params.on_retrieve(row);
- if (row.my.mbts && ( document.getElementById('no_change_label') || document.getElementById('fine_tally') ) ) {
+ var no_change_label = document.getElementById('no_change_label');
+ if (row.my.mbts && ( no_change_label || document.getElementById('fine_tally') ) ) {
var bill = row.my.mbts;
if (Number(bill.balance_owed()) == 0) { return; }
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
- document.getElementById('no_change_label').setAttribute(
+ if (no_change_label) {
+ var m = no_change_label.getAttribute('value');
+ no_change_label.setAttribute(
'value',
m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.billable.amount', [row.my.acp.barcode(), util.money.sanitize(bill.balance_owed())]) + ' '
);
- document.getElementById('no_change_label').setAttribute('hidden','false');
+ no_change_label.setAttribute('hidden','false');
+ no_change_label.setAttribute('onclick','xulG.new_patron_tab({},{"id" : '+bill.usr()+' })');
}
if (document.getElementById('fine_tally')) {
var amount = Number( document.getElementById('fine_tally').getAttribute('amount') ) + Number( bill.balance_owed() );
Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js 2010-11-30 17:11:34 UTC (rev 18876)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js 2010-11-30 18:17:47 UTC (rev 18877)
@@ -2404,9 +2404,12 @@
if (!check.route_to) { check.route_to = ' '; }
- if (document.getElementById('no_change_label')) {
- document.getElementById('no_change_label').setAttribute('value','');
- document.getElementById('no_change_label').setAttribute('hidden','true');
+ var no_change_label = document.getElementById('no_change_label');
+
+ if (no_change_label) {
+ no_change_label.setAttribute('value','');
+ no_change_label.setAttribute('hidden','true');
+ no_change_label.setAttribute('onclick','');
}
var msg = '';
@@ -2471,11 +2474,12 @@
if (check.ilsevent == 3 /* NO_CHANGE */) {
//msg = 'This item is already checked in.\n';
check.what_happened = 'no_change';
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
+ if (no_change_label) {
+ var m = no_change_label.getAttribute('value');
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');
+ no_change_label.setAttribute('value', m + text + ' ');
+ no_change_label.setAttribute('hidden','false');
+ no_change_label.setAttribute('onclick','');
if (typeof params.info_blurb == 'function') {
params.info_blurb( text );
}
@@ -2708,12 +2712,13 @@
}
}
msg = '';
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
+ if (no_change_label) {
+ var m = no_change_label.getAttribute('value');
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');
+ no_change_label.setAttribute('value', m);
+ no_change_label.setAttribute('hidden','false');
+ no_change_label.setAttribute('onclick','');
if (typeof params.info_blurb == 'function') {
params.info_blurb( text );
}
@@ -2744,11 +2749,12 @@
sound.circ_bad();
}
}
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
+ if (no_change_label) {
+ var m = no_change_label.getAttribute('value');
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');
+ no_change_label.setAttribute('value', m + needs_cat + ' ');
+ no_change_label.setAttribute('hidden','false');
+ no_change_label.setAttribute('onclick','');
if (typeof params.info_blurb == 'function') {
params.info_blurb( needs_cat );
}
@@ -2828,12 +2834,13 @@
}
}
msg = '';
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
+ if (no_change_label) {
+ var m = no_change_label.getAttribute('value');
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');
+ no_change_label.setAttribute('value', m);
+ no_change_label.setAttribute('hidden','false');
+ no_change_label.setAttribute('onclick','');
if (typeof params.info_blurb == 'function') {
params.info_blurb( text );
}
@@ -3088,11 +3095,12 @@
alert(err_msg);
}
}
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
+ if (no_change_label) {
+ var m = no_change_label.getAttribute('value');
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');
+ no_change_label.setAttribute('value', m + trans_msg + ' ');
+ no_change_label.setAttribute('hidden','false');
+ no_change_label.setAttribute('onclick','');
if (typeof params.info_blurb == 'function') {
params.info_blurb( trans_msg );
}
@@ -3117,10 +3125,11 @@
// 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 + ' ');
- document.getElementById('no_change_label').setAttribute('hidden','false');
+ if (no_change_label) {
+ var m = no_change_label.getAttribute('value');
+ no_change_label.setAttribute('value',m + mis_scan_msg + ' ');
+ no_change_label.setAttribute('hidden','false');
+ no_change_label.setAttribute('onclick','');
if (typeof params.info_blurb == 'function') {
params.info_blurb( mis_scan_msg );
}
@@ -3217,10 +3226,11 @@
null,
document.getElementById('circStrings').getString('staff.circ.confirm.msg')
);
- 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 + ' ');
- document.getElementById('no_change_label').setAttribute('hidden','false');
+ if (no_change_label) {
+ var m = no_change_label.getAttribute('value');
+ no_change_label.setAttribute('value',m + mis_scan_msg + ' ');
+ no_change_label.setAttribute('hidden','false');
+ no_change_label.setAttribute('onclick','');
if (typeof params.info_blurb == 'function') {
params.info_blurb( mis_scan_msg );
}
More information about the open-ils-commits
mailing list