details:   https://code.openbravo.com/erp/devel/pi/rev/089aa21df4fb
changeset: 30660:089aa21df4fb
user:      Naroa Iriarte <naroa.iriarte <at> openbravo.com>
date:      Mon Nov 14 13:26:18 2016 +0100
summary:   Fixed issue 33850: The Location/Address filter was not working fine

The location/Address filter of the Location/Address subtab of the "Business 
Partner" tab was not working fine when trying to filter by Location/Addresses 
which had not a Region defined.
The problem was in the generated query, there was a concatenation with the 
region name, and when the region was null, all the result was null.
To fix this problem the coalesce funtion has been added to the query in the 
cases where it was not added. Now, if the value is null, as it is the case, the 
empty string will be get in the concatenation.

diffstat:

 
modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
 |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r f050573e9a37 -r 089aa21df4fb 
modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
--- 
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
       Tue Nov 15 18:53:31 2016 +0100
+++ 
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
       Mon Nov 14 13:26:18 2016 +0100
@@ -1626,8 +1626,13 @@
             joinDefinitions.add(joinDefinition);
           }
         }
-
-        sb.append(createIdentifierLeftClause(newIdentifierProperties, 
newPrefix + DalUtil.DOT));
+        if (prop.isMandatory()) {
+          sb.append(createIdentifierLeftClause(newIdentifierProperties, 
newPrefix + DalUtil.DOT));
+        } else {
+          sb.append("COALESCE(to_char("
+              + createIdentifierLeftClause(newIdentifierProperties, newPrefix 
+ DalUtil.DOT)
+              + "),'')");
+        }
       }
     }
 

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to