From 5d8a3bd8be5575be22bb71b6be040cad0b0dc7d9 Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 18 Sep 2009 18:10:57 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.open-ils.org/ILS/trunk@14053 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/circ/checkin.js | 27 +++++++++++------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js index d1f487bfa1..930718905c 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkin.js +++ b/Open-ILS/xul/staff_client/server/circ/checkin.js @@ -193,19 +193,7 @@ circ.checkin.prototype = { 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 @@ circ.checkin.prototype = { } } 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(); + } } } -- 2.11.0