details:   https://code.openbravo.com/erp/devel/pi/rev/f61bf8d6176d
changeset: 22868:f61bf8d6176d
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Mon Apr 14 14:12:57 2014 +0200
summary:   Fixes issue 26262: Dates with negative offsets are formatted properly

The proper javascript format for dates and datetimes with timezone offset if 
the following: 2009-12-06T15:59:34+01:00. There if a method in charge of adding 
the semicolon in the datetime part in case it is missing.

Due to a bug in that method, the semicolon was not being added in dates with 
negative timezone offset. This resulted in a failure in the parsing of that 
date in the client side, being the date object actually modified when it was 
parsed.

In Openbravo there is a safety mechanism that detects if a record has changed 
based on its updated field. The updated field was being improperly modified in 
the client, so the safety mechanism was assuming that the record had actually 
been changed by another user, and was preventing the record from being saved.

diffstat:

 
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
 |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (15 lines):

diff -r d80d8cd8e39b -r f61bf8d6176d 
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
--- 
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
  Mon Apr 14 13:32:27 2014 +0200
+++ 
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
  Mon Apr 14 14:12:57 2014 +0200
@@ -136,8 +136,9 @@
    * @return a colon added in the timezone part: 2009-12-06T15:59:34+01:00
    */
   public static String convertToCorrectXSDFormat(String dateValue) {
-    if (dateValue == null || dateValue.length() < 3 || dateValue.indexOf("+") 
== -1
-        || dateValue.indexOf("-") == -1) {
+    int idxT = dateValue.indexOf("T");
+    if (dateValue == null || dateValue.length() < 3 || idxT == -1
+        || (dateValue.indexOf("+", idxT) == -1 && dateValue.indexOf("-", idxT) 
== -1)) {
       return dateValue;
     }
     final int length = dateValue.length();

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to