details:   https://code.openbravo.com/erp/devel/pi/rev/62c6d119b8f8
changeset: 22145:62c6d119b8f8
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Feb 26 10:51:11 2014 +0100
summary:   Related to issue 25838:Avoids accessing a property of an undefined 
object

The check (if data[this.name]) to avoid accessing a property of 
data[this.name], that can be undefined, has been moved from here

 if (this.getValue() !== data[this.name]) {

to here

data[this.name].getFullYear() <= 1970)

It did not make sense to make the check in the outer if clause, because that 
would disable setting a null value for this property from the datasource.

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 (15 lines):

diff -r 44671c4c2901 -r 62c6d119b8f8 
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
        Wed Feb 26 10:20:31 2014 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
        Wed Feb 26 10:51:11 2014 +0100
@@ -155,9 +155,9 @@
   },
   formSaved: function (request, response, data) {
     var UTCOffsetInMiliseconds;
-    if (data[this.name] && this.getValue() !== data[this.name]) {
+    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] && 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