details: https://code.openbravo.com/erp/devel/pi/rev/3b9604eee5d7
changeset: 20486:3b9604eee5d7
user: Augusto Mauch <augusto.mauch <at> openbravo.com>
date: Tue May 28 17:49:38 2013 +0200
summary: Fixes issue 23890: The same hql is generated in the grid and in form
view
The problem was that for that particular selector (Product selector), the
generated displayfield string was 'product$product$name'. This is not correct,
because the Product entity does not have a product property, the correct
displayfield string is product$name. This has been fixed in the
getDisplayFielName method of the FKSelectorUIDefinition class. A check has been
added to make sure that the property used in the display field is part of the
referenced entity. If it is not, then the displayFieldName is returned
directly, instead of trying to append it to the referenced property.
diffstat:
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java
| 25 ++++++++-
1 files changed, 22 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r f5a58673fad6 -r 3b9604eee5d7
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java
---
a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java
Tue May 28 17:46:24 2013 +0200
+++
b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java
Tue May 28 17:49:38 2013 +0200
@@ -110,9 +110,28 @@
// fallback to the default
return null;
}
- final String result = (prop.getName() + DalUtil.FIELDSEPARATOR +
displayFieldName).replace(".",
- DalUtil.FIELDSEPARATOR);
- return result;
+
+ if
(!prop.getReferencedProperty().getEntity().hasProperty(getFirstProperty(displayFieldName)))
{
+ // If the first property of the display field name does not belong to
the referenced entity,
+ // return the displayFieldName
+ // Otherwise trying to append the displayFieldName to the referenced
property would later
+ // result in an error
+ return displayFieldName.replace(".", DalUtil.FIELDSEPARATOR);
+ } else {
+ final String result = (prop.getName() + DalUtil.FIELDSEPARATOR +
displayFieldName).replace(
+ ".", DalUtil.FIELDSEPARATOR);
+ return result;
+ }
+
+ }
+
+ private String getFirstProperty(String displayFieldName) {
+ int dotPosition = displayFieldName.indexOf(DalUtil.DOT);
+ if (dotPosition == -1) {
+ return displayFieldName;
+ } else {
+ return displayFieldName.substring(0, dotPosition);
+ }
}
public String getFieldProperties(Field field) {
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits