details:   https://code.openbravo.com/erp/devel/pi/rev/bdca94625dbf
changeset: 32340:bdca94625dbf
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Wed Jun 21 10:56:26 2017 +0200
summary:   fixes bug 36268: Some fields marked to be shown on picklist show 
empty values

  With the fix for issue #33015 just the required selector properties are sent, 
in order to prevent unneeded joins. With this change the properties of the 
fields to be displayed on the picklist and the extra properties are handled 
separately by the datasource.

  The poblem here is that the datasource was not handling properly the 
properties to be shown in the picklist which are derived, i.e., those 
properties that are resolved through property navigation. But this kind of 
properties are resolved properly if they are sent as extra properties.

  Therefore, to solve this issue, this kind of derived properties are sent as 
part of the extra properties.

diffstat:

 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
 |  23 ++++++++-
 1 files changed, 19 insertions(+), 4 deletions(-)

diffs (54 lines):

diff -r 01ae69f28d45 -r bdca94625dbf 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- 
a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Thu Jun 08 12:46:41 2017 +0200
+++ 
b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Wed Jun 21 10:56:26 2017 +0200
@@ -1105,13 +1105,23 @@
   },
 
   getSelectedPropertiesString: function () {
-    var i, fieldName, selectedProperties = OB.Constants.ID;
+    var i, fieldName, selectedProperties = {};
+    selectedProperties.entityProperties = OB.Constants.ID;
+    selectedProperties.derivedProperties = '';
     for (i = 0; i < this.pickListFields.length; i++) {
       fieldName = this.pickListFields[i].name;
       if (fieldName === OB.Constants.ID || fieldName === 
OB.Constants.IDENTIFIER) {
         continue;
       }
-      selectedProperties += ',' + fieldName;
+      if (fieldName.contains(OB.Constants.FIELDSEPARATOR)) {
+        if (selectedProperties.derivedProperties === '') {
+          selectedProperties.derivedProperties = fieldName;
+        } else {
+          selectedProperties.derivedProperties += ',' + fieldName;
+        }
+      } else {
+        selectedProperties.entityProperties += ',' + fieldName;
+      }
     }
     return selectedProperties;
   },
@@ -1185,6 +1195,8 @@
   // Prepares requestProperties adding contextInfo, this is later used in 
backed
   // to prepare filters 
   prepareDSRequest: function (params, selector, requestType) {
+    var selectedProperties, extraProperties;
+
     function setOrgIdParam(params) {
       if (!params.inpadOrgId) {
         // look for an ad_org_id parameter. If there is no such parameter or 
its value is empty, selector will be filter by natural tree of writable 
organizations
@@ -1255,10 +1267,13 @@
     params[OB.Constants.SORTBY_PARAMETER] = selector.displayField;
 
     if (requestType === 'PickList') {
+      selectedProperties = selector.getSelectedPropertiesString();
+      extraProperties = selector.getExtraPropertiesString();
       // Add the fields to be displayed in the picklist as selected properties
-      params[OB.Constants.SELECTED_PROPERTIES] = 
selector.getSelectedPropertiesString();
+      params[OB.Constants.SELECTED_PROPERTIES] = 
selectedProperties.entityProperties;
       // Include value field, display field and out fields into additional 
properties
-      params[OB.Constants.EXTRA_PROPERTIES] = 
selector.getExtraPropertiesString();
+      // Also include the fields whose value will be obtained through property 
navigation
+      params[OB.Constants.EXTRA_PROPERTIES] = extraProperties + ',' + 
selectedProperties.derivedProperties;
     }
 
     // Parameter windows

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to