details:   https://code.openbravo.com/erp/devel/pi/rev/7feaacbc88b1
changeset: 22139:7feaacbc88b1
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Tue Feb 25 11:21:33 2014 +0100
summary:   Fixes issue 25827: Time fields work properly in timezones with 
negative offsets

Depending on who calls the formSaved function of OBTimeItem, the provided time 
can be already converted to the client local time or not. To know the time has a
lready been converted, the function used to check if the full year of the time 
was 1970. If that was the case, then the time was converted from UTC to local ti
me.

The problem is that if the user is working from a timezone with negative offset 
the full year will not be 1970, but 1969. This has been fixed by replacing data
[this.name].getFullYear() === 1970 with data[this.name].getFullYear() <= 1970

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
 |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r a1adb2aa192e -r 7feaacbc88b1 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
        Tue Feb 25 09:58:00 2014 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
        Tue Feb 25 11:21:33 2014 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011-2013 Openbravo SLU
+ * All portions are Copyright (C) 2011-2014 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -152,7 +152,7 @@
     var UTCOffsetInMiliseconds;
     if (this.getValue() !== data[this.name]) {
       // it has not been converted to the local time yet, do it now
-      if (data[this.name].getFullYear() === 1970) {
+      if (data[this.name].getFullYear() <= 1970) {
         UTCOffsetInMiliseconds = OB.Utilities.Date.getUTCOffsetInMiliseconds();
         data[this.name].setTime(data[this.name].getTime() + 
UTCOffsetInMiliseconds);
       }

------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to