details:   https://code.openbravo.com/erp/devel/pi/rev/b625c136e3de
changeset: 26188:b625c136e3de
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Mon Mar 16 16:42:25 2015 +0100
summary:   Related with issue 28727: Checks if the okButton exists to prevent 
error in log

details:   https://code.openbravo.com/erp/devel/pi/rev/a882ebfc5ae6
changeset: 26189:a882ebfc5ae6
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Mon Mar 16 16:57:41 2015 +0100
summary:   Fixes issue 28727: valueMap is properly initialized in pick and 
execute windows

The problem was that when a line in a pick and execute grid was edited, the 
valueMap of its OBFKComboItems was not properly initialized. The initialization 
is done in the OBPickAndExecuteGrid.processColumnValue function.

Before the Openbravo combos was refactored, the columnValue parameter used to 
contain the full valueMap of the combo in its entries attribute. This atribute 
was passed to the OBPickAndExecuteGrid.setValueMap, and the valueMap of the 
combos was initialized. The problem was that since the combos was refactored 
the columnValue parameter no longer contained the entries attribute, because 
the FIC now only returns the selected value. To fix this, in this case the 
valueMap is built manually based on the column value and identifier. This 
valueMap is passed to the OBPickAndExecuteGrid.setValueMap function to 
initialize the field valueMap.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
 |   4 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
 |  17 ++++++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (46 lines):

diff -r e4c7b3d0a0ff -r a882ebfc5ae6 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
      Mon Mar 16 16:35:31 2015 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
      Mon Mar 16 16:57:41 2015 +0100
@@ -725,7 +725,9 @@
         this.xlsButton.setEnabled(allRequiredSet);
       }
     } else {
-      this.okButton.setEnabled(allRequiredSet);
+      if (this.okButton) {
+        this.okButton.setEnabled(allRequiredSet);
+      }
     }
   },
 
diff -r e4c7b3d0a0ff -r a882ebfc5ae6 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
      Mon Mar 16 16:35:31 2015 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
      Mon Mar 16 16:57:41 2015 +0100
@@ -692,17 +692,22 @@
   },
 
   processColumnValue: function (rowNum, columnName, columnValue) {
-    var field;
+    var field, valueMap = [];
     if (!columnValue) {
       return;
     }
-
+    field = this.getFieldByColumnName(columnName);
+    if (!field) {
+      return;
+    }
     if (columnValue.entries) {
-      field = this.getFieldByColumnName(columnName);
-      if (!field) {
-        return;
-      }
       this.setValueMap(field.name, columnValue.entries);
+    } else if (field.fkField && columnValue.value && columnValue.identifier) {
+      valueMap[0] = {
+        id: columnValue.value,
+        identifier: columnValue.identifier
+      };
+      this.setValueMap(field.name, valueMap);
     }
   },
 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to