details:   /erp/devel/pi/rev/83ea4ee1ef79
changeset: 12641:83ea4ee1ef79
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Wed Jun 01 13:09:41 2011 +0200
summary:   Related to issue 17434: Date fields are not taken the mask XX-XX-XXXX

details:   /erp/devel/pi/rev/947e071da9a7
changeset: 12642:947e071da9a7
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Wed Jun 01 13:10:51 2011 +0200
summary:   Fixes issue 17452: When picking a date from the popup calendar the 
date moves one day

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
 |  34 +++++++++-
 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
   |   2 +-
 2 files changed, 32 insertions(+), 4 deletions(-)

diffs (69 lines):

diff -r 598c6daec11a -r 947e071da9a7 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
        Wed Jun 01 13:01:03 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
        Wed Jun 01 13:10:51 2011 +0200
@@ -178,8 +178,6 @@
 isc.OBDateItem.addProperties(OB.DateItemProperties,
   {
   
-  validateOnExit: true,
-  
   init: function() {
     // this call super.init
     this.doInit();
@@ -193,13 +191,43 @@
     if (oldValue !== newValue) {
       this.storeValue(OB.Utilities.Date.OBToJS(newValue, this.dateFormat));
     }
+    
+    if (!this.inBlur) {
+      this.inBlur = true;
+      this.checkOBDateItemValue();
+      this.inBlur = false;
+    }
+
     return this.Super('blur', arguments);
   },
   
   blurValue: function() {
     return this.getValue();
   },
-
+  
+  // ** {{{ checkOBDateItemValue }}} **
+  // Validate the entered date and add a form error, is called onblur
+  checkOBDateItemValue: function(){
+    var value = this.getValue();
+    var validatorLength = this.validators.length;
+    var isValid = this.validators[validatorLength - 1].condition(this, 
this.form, value);
+    var isRequired = this.required;
+    if (typeof this.name === 'undefined') {
+      this.name = 'isc_' + this.getRandomString(this.getRandomInteger(6, 12));
+    }
+    if (isValid === false) {
+      this.form.addFieldErrors(this.name, isc.OBDateItem.invalidValueLabel, 
false);
+      this.form.markForRedraw();
+    } else if (isRequired === true &&
+    (value === null || value === '' || typeof value === 'undefined')) {
+      this.form.addFieldErrors(this.name, isc.OBDateItem.requiredValueLabel, 
false);
+      this.form.markForRedraw();
+    } else {
+      this.form.clearFieldErrors(this.name, false);
+      this.form.markForRedraw();
+    }
+  },
+  
   validateOBDateItem: function(value){
       var dateValue = OB.Utilities.Date.OBToJS(value, this.dateFormat);
       var isValid = true;
diff -r 598c6daec11a -r 947e071da9a7 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- 
a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Wed Jun 01 13:01:03 2011 +0200
+++ 
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Wed Jun 01 13:10:51 2011 +0200
@@ -28,7 +28,7 @@
 // We have dates/times in the database without timezone, we assume GMT 
therefore 
 // for all our date/times we use GMT on both the server and the client
 // NOTE: causes issue https://issues.openbravo.com/view.php?id=16014
-//Time.setDefaultDisplayTimezone(0);
+Time.setDefaultDisplayTimezone(0);
 
 //Let the click on an ImgButton and Button fall through to its action method 
 isc.ImgButton.addProperties({

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to