details:   https://code.openbravo.com/erp/devel/pi/rev/6f50b0fae846
changeset: 33937:6f50b0fae846
user:      Javier Armendáriz <javier.armendariz <at> openbravo.com>
date:      Wed May 09 10:46:34 2018 +0200
summary:   Related to issue 38422: Characteristic desc. selector not working 
with filter.

Adding filtering by ProductWithCharacteristicValue when no filter is applied in
the parent grid. This makes the characteristics selector behavior coherent with
the rest of selectors: if no filtering is performed, shows only the
characteristics present in the grid entries instead of all available values,
same as if we were filtering.

diffstat:

 src/org/openbravo/materialmgmt/ProductCharacteristicsDS.java |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 140e25aff39f -r 6f50b0fae846 
src/org/openbravo/materialmgmt/ProductCharacteristicsDS.java
--- a/src/org/openbravo/materialmgmt/ProductCharacteristicsDS.java      Wed May 
09 05:00:42 2018 +0000
+++ b/src/org/openbravo/materialmgmt/ProductCharacteristicsDS.java      Wed May 
09 10:46:34 2018 +0200
@@ -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) 2013-2016 Openbravo SLU
+ * All portions are Copyright (C) 2013-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -203,15 +203,20 @@
     hqlBuilder.append(this.getClientOrgFilter());
 
     if (StringUtils.isNotBlank(gridWhereClause)) {
-      hqlBuilder.append("  and exists (from ProductCharacteristicValue pcv, " 
+ parentGridEntity
+      hqlBuilder.append(" and exists (from ProductCharacteristicValue pcv, " + 
parentGridEntity
           + gridWhereClause + "  and pcv.characteristicValue = v and 
pcv.product = " + productPath
           + ")");
 
     } else if (StringUtils.isNotBlank(customSelectorWhereClause)) {
-      hqlBuilder.append("  and exists (from ProductCharacteristicValue pcv, "
+      hqlBuilder.append(" and exists (from ProductCharacteristicValue pcv, "
           + customSelectorWhereClause + "  and pcv.characteristicValue = v and 
pcv.product = "
           + productPath + ")");
     }
+    else if (parentGridEntity != null){
+      hqlBuilder.append(" and exists (from ProductCharacteristicValue pcv, " + 
parentGridEntity
+        + " as e where pcv.characteristicValue = v and pcv.product = "
+        + productPath + ")");
+    }
 
     hqlBuilder.append(" order by c.name, ");
     hqlBuilder.append("          coalesce(tn.reportSet, '-1'), ");

------------------------------------------------------------------------------
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