details: /erp/devel/pi/rev/e1c0ba4f475e
changeset: 11146:e1c0ba4f475e
user: Martin Taal <martin.taal <at> openbravo.com>
date: Wed Mar 09 08:38:21 2011 -0600
summary: Fixes issue 16014: Date fields on edit mode decrease by one day
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
| 2 +-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
| 27 +++++---
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities-date.js
| 32 ++++++---
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
| 8 +-
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
| 10 +-
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
| 4 +-
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
| 3 +-
7 files changed, 48 insertions(+), 38 deletions(-)
diffs (188 lines):
diff -r 252e627ff277 -r e1c0ba4f475e
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Wed Mar 09 15:25:11 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Wed Mar 09 08:38:21 2011 -0600
@@ -626,7 +626,7 @@
isc.ClassFactory.defineClass('OBDateItem', DateItem);
isc.OBDateItem.addClassProperties({
-
+
// ** {{{ autoCompleteData }}} **
//
// Autocomplets the date entered.
diff -r 252e627ff277 -r e1c0ba4f475e
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Wed Mar 09 15:25:11 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Wed Mar 09 08:38:21 2011 -0600
@@ -1584,15 +1584,15 @@
if (type.createClassicString) {
contextInfo[properties[i].inpColumn] =
type.createClassicString(value);
} else {
- contextInfo[properties[i].inpColumn] =
this.convertContextValue(value);
+ contextInfo[properties[i].inpColumn] =
this.convertContextValue(value, propertyObj.type);
}
} else {
- contextInfo[properties[i].inpColumn] =
this.convertContextValue(value);
+ contextInfo[properties[i].inpColumn] =
this.convertContextValue(value, propertyObj.type);
}
} else {
// surround the property name with @ symbols to make them different
// from filter criteria and such
- contextInfo['@' + this.entity + '.' + properties[i].property +
'@'] = this.convertContextValue(value);
+ contextInfo['@' + this.entity + '.' + properties[i].property +
'@'] = this.convertContextValue(value, propertyObj.type);
}
}
}
@@ -1629,15 +1629,20 @@
return contextInfo;
},
- convertContextValue: function(value) {
+ convertContextValue: function(value, type) {
if (isc.isA.Date(value)) {
- // this prevents strange timezone issues, the result is a timezoneless
- // string
- var oldXMLSchemaMode = isc.Comm.xmlSchemaMode;
- isc.Comm.xmlSchemaMode = true;
- var ret = value.toSerializeableDate();
- isc.Comm.xmlSchemaMode = oldXMLSchemaMode;
- return ret;
+ var ret, isTime = type && isc.SimpleType.getType(type).inheritsFrom ===
'time';
+ if (isTime) {
+ return value.getUTCHours() + ':' + value.getUTCMinutes() + ':' +
value.getUTCSeconds();
+ } else {
+ // this prevents strange timezone issues, the result is a timezoneless
+ // string
+ var oldXMLSchemaMode = isc.Comm.xmlSchemaMode;
+ isc.Comm.xmlSchemaMode = true;
+ ret = value.toSerializeableDate();
+ isc.Comm.xmlSchemaMode = oldXMLSchemaMode;
+ return ret;
+ }
}
return value;
},
diff -r 252e627ff277 -r e1c0ba4f475e
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities-date.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities-date.js
Wed Mar 09 15:25:11 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities-date.js
Wed Mar 09 08:38:21 2011 -0600
@@ -139,13 +139,21 @@
}
JSDate.setFullYear(year);
}
- JSDate.setMonth(month - 1);
- JSDate.setDate(day);
- JSDate.setHours(hours);
- JSDate.setMinutes(minutes);
- JSDate.setSeconds(seconds);
- JSDate.setMilliseconds(0);
-
+ if (dateFormat.indexOf('%H') !== -1) {
+ JSDate.setUTCMonth(month - 1);
+ JSDate.setUTCDate(day);
+ JSDate.setUTCHours(hours);
+ JSDate.setUTCMinutes(minutes);
+ JSDate.setUTCSeconds(seconds);
+ JSDate.setUTCMilliseconds(0);
+ } else {
+ JSDate.setMonth(month - 1);
+ JSDate.setDate(day);
+ JSDate.setHours(hours);
+ JSDate.setMinutes(minutes);
+ JSDate.setSeconds(seconds);
+ JSDate.setMilliseconds(0);
+ }
if (JSDate.toString() === 'Invalid Date' || JSDate.toString() === 'NaN') {
return null;
} else {
@@ -172,11 +180,11 @@
var year = JSDate.getYear().toString();
var fullYear = JSDate.getFullYear().toString();
- var month = (JSDate.getMonth() + 1).toString();
- var day = JSDate.getDate().toString();
- var hours = JSDate.getHours().toString();
- var minutes = JSDate.getMinutes().toString();
- var seconds = JSDate.getSeconds().toString();
+ var month = (JSDate.getUTCMonth() + 1).toString();
+ var day = JSDate.getUTCDate().toString();
+ var hours = JSDate.getUTCHours().toString();
+ var minutes = JSDate.getUTCMinutes().toString();
+ var seconds = JSDate.getUTCSeconds().toString();
var centuryReference = OB.Utilities.Date.centuryReference;
if (dateFormat.indexOf('%y') !== -1) {
diff -r 252e627ff277 -r e1c0ba4f475e
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
---
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
Wed Mar 09 15:25:11 2011 +0100
+++
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
Wed Mar 09 08:38:21 2011 -0600
@@ -74,14 +74,12 @@
if (value.indexOf(":") == 2 && value.indexOf(":", 3) == 5) {
if (!value.contains("+") && !value.contains("-")) {
return value + "+00:00";
- } else {
- return value;
}
-
+ return value;
}
final java.util.Date date = getClassicFormat().parse(value);
- final String timeStr = xmlTimeFormat.format(date);
- return JsonUtils.convertToCorrectXSDFormat(timeStr);
+ // always return in gmt
+ return xmlTimeFormat.format(date) + "+00:00";
} catch (Exception e) {
throw new OBException("Exception when handling value " + value, e);
}
diff -r 252e627ff277 -r e1c0ba4f475e
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
---
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
Wed Mar 09 15:25:11 2011 +0100
+++
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
Wed Mar 09 08:38:21 2011 -0600
@@ -227,13 +227,11 @@
final Class<?> clz = property.getPrimitiveObjectType();
if (Date.class.isAssignableFrom(clz)) {
if (property.getDomainType() instanceof TimestampDomainType) {
- final String strValue = xmlTimeFormat.format(value);
- final String repairedValue =
JsonUtils.convertToCorrectXSDFormat(strValue);
- return repairedValue;
+ // always assume gmt for times
+ return xmlTimeFormat.format(value) + "+00:00";
} else if (property.isDatetime() ||
Timestamp.class.isAssignableFrom(clz)) {
- final String strValue = xmlDateTimeFormat.format(value);
- final String repairedValue =
JsonUtils.convertToCorrectXSDFormat(strValue);
- return repairedValue;
+ // always assume gmt for times
+ return xmlDateTimeFormat.format(value) + "+00:00";
} else {
return xmlDateFormat.format(value);
}
diff -r 252e627ff277 -r e1c0ba4f475e
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
Wed Mar 09 15:25:11 2011 +0100
+++
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
Wed Mar 09 08:38:21 2011 -0600
@@ -61,7 +61,7 @@
* date format has lenient set to true.
*/
public static SimpleDateFormat createTimeFormat() {
- final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ssZ");
+ final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
dateFormat.setLenient(true);
return dateFormat;
}
@@ -76,7 +76,7 @@
public static SimpleDateFormat createDateTimeFormat() {
// Note users of this method will also use the convertToCorrectXSDFormat
// method
- final SimpleDateFormat dateFormat = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+ final SimpleDateFormat dateFormat = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
dateFormat.setLenient(true);
return dateFormat;
}
diff -r 252e627ff277 -r e1c0ba4f475e
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 Mar 09 15:25:11 2011 +0100
+++
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
Wed Mar 09 08:38:21 2011 -0600
@@ -27,7 +27,8 @@
// 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
-Time.setDefaultDisplayTimezone(0);
+// NOTE: causes issue https://issues.openbravo.com/view.php?id=16014
+//Time.setDefaultDisplayTimezone(0);
//Let the click on an ImgButton and Button fall through to its action method
isc.ImgButton.addProperties({
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits