Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0020684Openbravo ERPA. Platformpublic2012-06-06 09:402012-06-27 05:28
alostale 
AugustoMauch 
immediatemajoralways
closedfixed 
5
 
3.0MP13 
Core
No
0020684: Incorrect time in process request with different timezones in client/server
Having client and server in different time zones, time in process request window doesn't work properly.
Server in UTC, client in UTC+2.

-Create a new process request in form view, start time: 10:00:00
-Go to grid view, start time is 9:00:00 -> incorrect
-Edit in grid, it changes back to 10:00:00
-Check how it was saved in server: it is 9:00:00-> incorrect: it should be 8:00:00 as it is the equivalent time in server timezone
-Check when the process is executed: it should be at 10:00 client time/8:00 server time
No tags attached.
related to defect 00204963.0MP13 closed migueldejuana The date on the process monitor window changes when moving from form to grid depending on the timezone 
related to defect 00185613.0MP7 closed alostale Time reference showed incorrectly in Process Request window 
related to defect 00204793.0MP13 closed migueldejuana The filter on the startdate column on the process monitor grid is not working properly. 
related to defect 00207513.0MP13 closed AugustoMauch API change: time fields are sent in UTC 
related to defect 00208193.0MP13 closed AugustoMauch NullPointerException is thrown if a time is null 
related to defect 00249343.0MP31 closed AugustoMauch Columns with reference Time are not displayed/stored properly 
Issue History
2012-06-06 09:40alostaleNew Issue
2012-06-06 09:40alostaleAssigned To => alostale
2012-06-06 09:40alostaleModules => Core
2012-06-06 09:41alostaleRelationship addedrelated to 0020496
2012-06-06 09:41alostalePrioritynormal => urgent
2012-06-06 09:41alostaleDescription Updatedbug_revision_view_page.php?rev_id=3527#r3527
2012-06-06 10:23alostaleRelationship addedrelated to 0018561
2012-06-06 13:25alostaleAssigned Toalostale => AugustoMauch
2012-06-06 13:26alostalePriorityurgent => immediate
2012-06-12 11:25hgbotCheckin
2012-06-12 11:25hgbotNote Added: 0049753
2012-06-12 11:25hgbotStatusnew => resolved
2012-06-12 11:25hgbotResolutionopen => fixed
2012-06-12 11:25hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/976c8398def2e80de470ab55db222555d88566d8 [^]
2012-06-12 11:47AugustoMauchNote Added: 0049754
2012-06-12 11:54AugustoMauchNote Added: 0049755
2012-06-12 13:30AugustoMauchNote Added: 0049761
2012-06-12 16:52alostaleNote Added: 0049774
2012-06-12 16:52alostaleStatusresolved => new
2012-06-12 16:52alostaleResolutionfixed => open
2012-06-13 10:11hgbotCheckin
2012-06-13 10:11hgbotNote Added: 0049793
2012-06-13 10:11hgbotStatusnew => resolved
2012-06-13 10:11hgbotResolutionopen => fixed
2012-06-13 10:11hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/976c8398def2e80de470ab55db222555d88566d8 [^] => http://code.openbravo.com/erp/devel/pi/rev/eec8991a4efd7418ca88181f454f8a956ef77c38 [^]
2012-06-13 10:26alostaleRelationship addedrelated to 0020479
2012-06-13 10:54hgbotCheckin
2012-06-13 10:54hgbotNote Added: 0049798
2012-06-13 16:17AugustoMauchRelationship addedrelated to 0020751
2012-06-20 16:58AugustoMauchRelationship addedrelated to 0020819
2012-06-20 17:04hgbotCheckin
2012-06-20 17:04hgbotNote Added: 0049954
2012-06-22 09:57alostaleNote Added: 0050020
2012-06-22 09:57alostaleStatusresolved => closed
2012-06-22 09:57alostaleFixed in Version => 3.0MP13
2012-06-27 05:28hudsonbotCheckin
2012-06-27 05:28hudsonbotNote Added: 0050133
2013-10-24 11:30mtaalRelationship addedrelated to 0024934

Notes
(0049753)
hgbot   
2012-06-12 11:25   
Repository: erp/devel/pi
Changeset: 976c8398def2e80de470ab55db222555d88566d8
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Jun 12 11:24:28 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/976c8398def2e80de470ab55db222555d88566d8 [^]

Fixes issue 20684: Time fields are passed in UTC format

The problem was due to:
- Time fields were not being passed between client and server in UTC format
- When constructing a date based on a time (i.e. 10:00:00), the date used was 1970-01-01. This way, it was not possible to convert from UTC to local hour, because the DST offset depends
 on the date.

It has been fixed by:
- Sending the time fields in UTC format. Upon receiving a time field, converting it to local time.
- Upon receiving a time field, creating a new date using todays date instead of 1970-01-01
: Enter commit message. Lines beginning with 'HG:' are removed.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
M modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
M modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java
M modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
---
(0049754)
AugustoMauch   
2012-06-12 11:47   
Summary of the changes:
- ob-formitem-time.js: When getting and setting a time field as a date, the current date is used, instead of 1970-01-01
- ob-view-form.js: In the editRecord function, sometimes the time fields will be in UTC format (when called from fetchDataReply) and other times (when claled from OBStandardView.editRecord) will be in local time format. If the time fields are in UTC format, they are converted to local time.
- ob-view-grid.js: When data is received from the datasource, convert the time fields from UTC to local time.
- ob-standard-view.js: When calling viewForm.editRecord, pass a new parameter that indicates that the time fields are in local time. When receiving a time, convert it to date using the current date.
- TimeUIDefinition.java: Overrides getFieldProperties to make sure that the time fields are passed to createFromClassicString in local time. Modifies createFromClassicString to make sure that time fields are sent to the client in UTC format.
- JSONUtils.java: A new time format has been created that does not contain the GMT offset.
- DataToJsonConverter.java. Time fields are stored in local time in the database, and converted to UTC before sending them to the client.
- JsonToDataConverter.java. Time fields are received in UTC format from the client, and converted to local time before storing them in the database.
(0049755)
AugustoMauch   
2012-06-12 11:54   
All the changes should only affect time fields, and they have been tested thoroughly, so I guess that this fix should not be risky.
(0049761)
AugustoMauch   
2012-06-12 13:30   
This fix has been tested with all possible client-server configurations:
- Both in the same time zone
- With a positive time zone difference
- With a negative time zone difference

The following has been tested in the Process Request window for each configuration:
- Show in grid the Start Time column
- Add a new record in grid view and save it.
- Open that record in form view, modify it and save it.
- Click refresh
- Add a new record in for view and save it.

In all cases the time shown is in client local time, it is sent to the server in UTC time and saved in the database in server local time.

- Create a process request to be executed at a specific time and schedule it. Check in Process Monitor that the process is executed at the time specified.
(0049774)
alostale   
2012-06-12 16:52   
Reopening issue after code review:

*ob-view-form.js: incorrect formatting (tabs and spaces)
*the fix assumes timezone difference of complete hours, not working for hour and minutes offsets.
(0049793)
hgbot   
2012-06-13 10:11   
Repository: erp/devel/pi
Changeset: eec8991a4efd7418ca88181f454f8a956ef77c38
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Jun 13 13:55:34 2012 +0545
URL: http://code.openbravo.com/erp/devel/pi/rev/eec8991a4efd7418ca88181f454f8a956ef77c38 [^]

Fixes issue 20684: Hour and minutes time zone offset is supported

Instead of using the hour time zone offset, now the millisecond time zone offset is applied, supporting the time zones where the offset with UTC is measured in hours and minutes.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
M modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
M modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java
---
(0049798)
hgbot   
2012-06-13 10:54   
Repository: erp/devel/pi
Changeset: c3c5bb6a8f84d5159d07776af1ad57975d79ec62
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Jun 13 14:38:07 2012 +0545
URL: http://code.openbravo.com/erp/devel/pi/rev/c3c5bb6a8f84d5159d07776af1ad57975d79ec62 [^]

Related to issue 20684: Refactorization to remove duplicate code

The function convertUTCTimeToLocalTime and getTime fields of ob-view-grid and ob-view-form were very similar and shared much of its code. They code has been generalized and moved to OB.Utilities.Date

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
---
(0049954)
hgbot   
2012-06-20 17:04   
Repository: erp/devel/pi
Changeset: 99602b3c2a1798756c847feeae94437babed2d9c
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Jun 20 17:03:55 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/99602b3c2a1798756c847feeae94437babed2d9c [^]

Fixes issue 20819. Related to issue 20684. NPE prevented.

A NullPointerException has been prevented by replacing columnValue.isEmpty() with StringUtils.isEmpty(columnValue), which returns true if columnValue is null, instead of throwing a NullPointerException.

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
---
(0050020)
alostale   
2012-06-22 09:57   
Code reviewed and verified on pi@889f630ff69d
(0050133)
hudsonbot   
2012-06-27 05:28   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/cf3a7135839f [^]

Maturity status: Test