Fixes issue 23870: Filters work properly with property columns
authorAugusto Mauch <augusto.mauch@openbravo.com>
Fri, 24 May 2013 08:56:53 +0200
changeset 20467 5ac834636f94
parent 20466 f3fe4a52f51e
child 20468 d2f5bade4728
Fixes issue 23870: Filters work properly with property columns

In the buildFieldClause method of the AdvancedQueryBuilder class there was a bug that prevented filtering from working in the case where the size of the properties array was longer than 2. This happened because at one point the useFieldName string was being truncated from the first occurrence of the point, when it should have been truncated from the last.
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	Fri May 24 08:52:11 2013 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Fri May 24 08:56:53 2013 +0200
@@ -495,7 +495,7 @@
                 && referencedTable.getDisplayedColumn().isActive()) {
               useProperty = property.getEntity().getPropertyByColumnName(
                   referencedTable.getDisplayedColumn().getDBColumnName());
-              final int index = useFieldName.indexOf(DalUtil.DOT);
+              final int index = useFieldName.lastIndexOf(DalUtil.DOT);
               useFieldName = useFieldName.substring(0, index + 1) + useProperty.getName();
               break;
             }