details:   https://code.openbravo.com/erp/devel/pi/rev/27e680a3b013
changeset: 33954:27e680a3b013
user:      Javier Armendáriz <javier.armendariz <at> openbravo.com>
date:      Mon May 14 17:18:34 2018 +0200
summary:   Related to bug 38422: Characteristic desc. selector not working with 
filter.

Adding null check and applied formatter.

diffstat:

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

diffs (37 lines):

diff -r 3cfefec60b5f -r 27e680a3b013 
src/org/openbravo/materialmgmt/ProductCharacteristicsDS.java
--- a/src/org/openbravo/materialmgmt/ProductCharacteristicsDS.java      Mon May 
14 10:58:55 2018 +0000
+++ b/src/org/openbravo/materialmgmt/ProductCharacteristicsDS.java      Mon May 
14 17:18:34 2018 +0200
@@ -23,8 +23,8 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.Map.Entry;
-import java.util.Set;
 
 import javax.inject.Inject;
 
@@ -202,7 +202,7 @@
     hqlBuilder.append(" and v.characteristic = c");
     hqlBuilder.append(this.getClientOrgFilter());
 
-    if (StringUtils.isNotBlank(gridWhereClause)) {
+    if (StringUtils.isNotBlank(gridWhereClause) && parentGridEntity != null) {
       hqlBuilder.append(" and exists (from ProductCharacteristicValue pcv, " + 
parentGridEntity
           + gridWhereClause + "  and pcv.characteristicValue = v and 
pcv.product = " + productPath
           + ")");
@@ -211,11 +211,10 @@
       hqlBuilder.append(" and exists (from ProductCharacteristicValue pcv, "
           + customSelectorWhereClause + "  and pcv.characteristicValue = v and 
pcv.product = "
           + productPath + ")");
-    }
-    else if (parentGridEntity != null){
+
+    } else if (parentGridEntity != null) {
       hqlBuilder.append(" and exists (from ProductCharacteristicValue pcv, " + 
parentGridEntity
-        + " as e where pcv.characteristicValue = v and pcv.product = "
-        + productPath + ")");
+          + " as e where pcv.characteristicValue = v and pcv.product = " + 
productPath + ")");
     }
 
     hqlBuilder.append(" order by c.name, ");

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