details: https://code.openbravo.com/erp/devel/pi/rev/e16d7577a075
changeset: 22997:e16d7577a075
user: Guillermo Gil <guillermo.gil <at> openbravo.com>
date: Thu May 08 11:09:49 2014 +0200
summary: Fixed issue 26085:Location is not correctly filtered in grid view
If the country does not have a region it was not filtered.
Added new joins if the property is referenced and it can allow null values.
Prefix modified to take into account the alias of the joins.
diffstat:
modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
| 30 +++++++++-
1 files changed, 28 insertions(+), 2 deletions(-)
diffs (40 lines):
diff -r f96e99de3b0f -r e16d7577a075
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
Thu May 08 10:47:28 2014 +0200
+++
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
Thu May 08 11:09:49 2014 +0200
@@ -1397,8 +1397,34 @@
} else {
final List<Property> newIdentifierProperties =
prop.getReferencedProperty().getEntity()
.getIdentifierProperties();
- sb.append(createIdentifierLeftClause(newIdentifierProperties, prefix +
prop.getName()
- + DalUtil.DOT));
+
+ String newPrefix = prefix + prop.getName();
+
+ if (prop.allowNullValues()) {
+
+ boolean addJoin = true;
+
+ // Look if the property has been joined
+ for (JoinDefinition joinableDefinition : joinDefinitions) {
+ if (joinableDefinition.property == prop) {
+ addJoin = false;
+
+ // Update newPrefix with the alias of the joinDefinition
+ newPrefix = joinableDefinition.joinAlias;
+ break;
+ }
+ }
+
+ if (addJoin) {
+ // Add join if this property allows null values
+ final JoinDefinition joinDefinition = new JoinDefinition();
+ joinDefinition.setOwnerAlias(prefix.substring(0, prefix.length() -
1));
+ joinDefinition.setProperty(prop);
+ joinDefinitions.add(joinDefinition);
+ }
+ }
+
+ sb.append(createIdentifierLeftClause(newIdentifierProperties,
newPrefix + DalUtil.DOT));
}
}
------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits