details:   https://code.openbravo.com/erp/devel/pi/rev/f659f0e3adc5
changeset: 28183:f659f0e3adc5
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Tue Jan 12 11:09:07 2016 +0100
summary:   fixes issue 31454: Can not filter by Attribute Set in Return From 
Customer P&E

We are making use of the existing creatingJoinsInWhereClauseIsPrevented flag, 
which is true for HQLDataSourceService, to avoid the join resolving in the 
computeLeftWhereClauseForIdentifier() method of the AdvancedQueryBuilder class.

Before this fix, a new alias was being included in the where clause but it was 
never defined before, causing the generation of a wrong query.

diffstat:

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

diffs (22 lines):

diff -r f8951754dc84 -r f659f0e3adc5 
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
       Mon Jan 11 19:22:20 2016 +0100
+++ 
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
       Tue Jan 12 11:09:07 2016 +0100
@@ -969,7 +969,7 @@
     final int index = leftWherePart.lastIndexOf(DalUtil.DOT);
     if (key.equals(JsonConstants.IDENTIFIER)) {
       prefix = getMainAlias() + DalUtil.DOT;
-    } else if (key.endsWith(JsonConstants.IDENTIFIER)) {
+    } else if (key.endsWith(JsonConstants.IDENTIFIER) && 
!creatingJoinsInWhereClauseIsPrevented) {
       final String propPath = key.substring(0, 
key.indexOf(JsonConstants.IDENTIFIER) - 1);
       boolean fromCriteria = true;
       final String join = resolveJoins(
@@ -2044,6 +2044,9 @@
    * when the AdvancedQueryBuilder is used to obtain the WHERE clause, but 
when the FROM clause
    * built is not used (i.e. en HQLDataSourceService)
    * 
+   * @param preventedCreatingJoinsInWhereClause
+   *          If true, the creation of new join alias is prevented when the 
where clause is built
+   * 
    */
   public void preventCreatingJoinsInWhereClause(boolean 
preventedCreatingJoinsInWhereClause) {
     this.creatingJoinsInWhereClauseIsPrevented = 
preventedCreatingJoinsInWhereClause;

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to