details:   https://code.openbravo.com/erp/devel/pi/rev/61ddad3c2054
changeset: 14111:61ddad3c2054
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Wed Oct 26 17:00:51 2011 +0200
summary:   Issue 17781: Small code improvements, too much typeof calls
- When you declare a variable has *undefined* value by default.
  You can improve the check against undefined values declaring a variable
  and using in the comparison.

diffstat:

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

diffs (39 lines):

diff -r 7ee2224706ba -r 61ddad3c2054 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js
     Wed Oct 26 15:23:01 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js
     Wed Oct 26 17:00:51 2011 +0200
@@ -332,7 +332,8 @@
 
   updateContentTitle: function(arrayTitleField, message) {
     var linkImageWidth = this.titleLinkImageWidth,
-      linkImageHeight = this.titleLinkImageHeight;
+        linkImageHeight = this.titleLinkImageHeight,
+        msg = '', i, length, undef;
 
     if (typeof linkImageWidth !== 'undefined') {
       linkImageWidth = linkImageWidth.toString();
@@ -354,7 +355,6 @@
       linkImageHeight = '';
     }
 
-    var msg = '', i, length;
     if (!isc.Page.isRTL()) { // LTR mode
       if (this.statusCode) {
         msg += '<span class="' + 
(this.statusLabelStyle?this.statusLabelStyle:'') + '">' + 
OB.I18N.getLabel(this.statusCode) + '</span>';
@@ -365,7 +365,7 @@
           if (i !== 0 || this.statusCode) {
             msg += '<span class="' + 
(this.separatorLabelStyle?this.separatorLabelStyle:'') + '">' + 
'&nbsp;&nbsp;|&nbsp;&nbsp;' + '</span>';
           }
-          if (arrayTitleField.length === 6 && typeof arrayTitleField[2][i] !== 
'undefined' && typeof arrayTitleField[3][i] !== 'undefined' && typeof 
arrayTitleField[4][i] !== 'undefined' && typeof arrayTitleField[5][i] !== 
'undefined') {
+          if (arrayTitleField.length === 6 && arrayTitleField[2][i] !== undef 
&& arrayTitleField[3][i] !== undef && arrayTitleField[4][i] !== undef && 
arrayTitleField[5][i] !== undef) {
             msg += '<span class="' + 
(this.titleLinkStyle?this.titleLinkStyle:'') + 
               '" onclick="OB.Utilities.openDirectView(\'' + 
arrayTitleField[2][i] + '\', \'' + arrayTitleField[3][i] + '\', \'' + 
arrayTitleField[4][i] + '\', \'' + arrayTitleField[5][i] + '\')">' + 
               arrayTitleField[0][i] + ':&nbsp;<img src="' + 
(this.titleLinkImageSrc?this.titleLinkImageSrc:'') + '" style="' + 
linkImageWidth + linkImageHeight + '" />&nbsp;' + 
@@ -392,7 +392,7 @@
       if (arrayTitleField) {
         for (i = arrayTitleField[0].length-1; i >= 0; i--) {
           msg += '<span class="' + 
(this.fieldLabelStyle?this.fieldLabelStyle:'') + '">' + 
this.getValidValue(arrayTitleField[1][i]) + '</span>';
-          if (typeof arrayTitleField[2][i] !== 'undefined' && typeof 
arrayTitleField[3][i] !== 'undefined' && typeof arrayTitleField[4][i] !== 
'undefined' && typeof arrayTitleField[5][i] !== 'undefined') {
+          if (arrayTitleField[2][i] !== undef && arrayTitleField[3][i] !== 
undef && arrayTitleField[4][i] !== undef && arrayTitleField[5][i] !== undef) {
             msg += '<span class="' + 
(this.titleLinkStyle?this.titleLinkStyle:'') + 
               '" onclick="OB.Utilities.openDirectView(\'' + 
arrayTitleField[2][i] + '\', \'' + arrayTitleField[3][i] + '\', \'' + 
arrayTitleField[4][i] + '\', \'' + arrayTitleField[5][i] + '\')">' + 
               '&nbsp;<img src="' + 
(this.titleLinkImageSrc?this.titleLinkImageSrc:'') + '" style="' + 
linkImageWidth + linkImageHeight + '"/>&nbsp;:' + arrayTitleField[0][i] + 

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to