[open-ils-commits] r14053 - trunk/Open-ILS/xul/staff_client/server/circ (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Sep 18 14:11:01 EDT 2009
Author: phasefx
Date: 2009-09-18 14:10:57 -0400 (Fri, 18 Sep 2009)
New Revision: 14053
Modified:
trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
Log:
changing the value of a datepicker within a change event handler can fire another event.. alert boxes also seem to make it act funny. Replacing with a sound effect for now
Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-09-18 17:30:03 UTC (rev 14052)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-09-18 18:10:57 UTC (rev 14053)
@@ -193,19 +193,7 @@
function(ev) {
if (ev.target.nodeName == 'datepicker') {
try {
- var flag = false;
- var darray = ev.target.value.split('-');
- var year = darray[0]; var month = darray[1]; var day = darray[2];
- if ( (!year) || (year.length != 4) || (!Number(year)) ) flag = true;
- if ( (!month) || (month.length !=2) || (!Number(month)) ) flag = true;
- if ( (!day) || (day.length !=2) || (!Number(day)) ) flag = true;
- if (flag) {
- throw('invalid date format');
- }
- var d = new Date( year, month - 1, day );
- if (d.toString() == 'Invalid Date') throw(document.getElementById('circStrings').getString('staff.circ.invalid_date'));
- if ( d > new Date() ) throw(document.getElementById('circStrings').getString('staff.circ.future_date'));
- ev.target.value = util.date.formatted_date(d,'%F');
+ if ( ev.target.dateValue > new Date() ) throw(document.getElementById('circStrings').getString('staff.circ.future_date'));
var x = document.getElementById('background');
if (x) {
if ( ev.target.value == util.date.formatted_date(new Date(),'%F') ) {
@@ -218,9 +206,18 @@
}
} catch(E) {
+ var x = document.getElementById('background');
+ if (x) {
+ x.setAttribute('style','background-color: green');
+ document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getString('staff.circ.process_item'));
+ }
dump('checkin:effective_date: ' + E + '\n');
- alert(document.getElementById('circStrings').getFormattedString('staff.circ.backdate.exception', [E]));
- ev.target.value = util.date.formatted_date(new Date(),'%F');
+ ev.target.disabled = true;
+ //alert(document.getElementById('circStrings').getFormattedString('staff.circ.backdate.exception', [E]));
+ ev.target.value = util.date.formatted_date(new Date(),'%F');
+ ev.target.disabled = false;
+ JSAN.use('util.sound'); var sound = new util.sound(); sound.bad();
+
}
}
}
More information about the open-ils-commits
mailing list