details: https://code.openbravo.com/erp/devel/pi/rev/2174cbb90a5a
changeset: 32598:2174cbb90a5a
user: Carlos Aristu <carlos.aristu <at> openbravo.com>
date: Tue Aug 29 13:02:40 2017 +0200
summary: fixes bug 36728: Can't use fields based on some properties in
selector picklist
With the fix for issue #36268 the selector fields based on derived properties
that are shown in the picklist are sent as 'extra properties' in order to
calculate them properly.
The problem is that the fix was not complete when the derived properties were
not primitive. In that case the DataToJsonConverter class was not calculating
properly the referenced property.
Now that kind of properties are calculated properly.
diffstat:
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
| 33 +---------
1 files changed, 3 insertions(+), 30 deletions(-)
diffs (57 lines):
diff -r 40963c034a8f -r 2174cbb90a5a
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
---
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
Tue Aug 29 10:10:18 2017 +0200
+++
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
Tue Aug 29 13:02:40 2017 +0200
@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2009-2016 Openbravo SLU
+ * All portions are Copyright (C) 2009-2017 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
@@ -214,7 +214,8 @@
if (value == null) {
jsonObject.put(replaceDots(additionalProperty), (Object) null);
} else if (value instanceof BaseOBObject) {
- final Property additonalPropertyObject = getPropertyFromPath(bob,
additionalProperty);
+ final Property additonalPropertyObject =
DalUtil.getPropertyFromPath(bob.getEntity(),
+ additionalProperty);
addBaseOBObject(jsonObject, additonalPropertyObject,
additionalProperty,
additonalPropertyObject.getReferencedProperty(), (BaseOBObject)
value);
} else {
@@ -256,34 +257,6 @@
return value.replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR);
}
- private Property getPropertyFromPath(BaseOBObject bob, String propertyPath) {
- final String[] parts = propertyPath.split("\\.");
- BaseOBObject currentBob = bob;
- Property result = null;
- Object value = null;
- for (String part : parts) {
- // only consider it as an identifier if it is called an identifier and
- // the entity does not accidentally have an identifier property
- // && !currentEntity.hasProperty(part)
- // NOTE disabled for now, there is one special case: AD_Column.IDENTIFIER
- // which is NOT HANDLED
- final Entity currentEntity = currentBob.getEntity();
- if (!currentEntity.hasProperty(part)) {
- return null;
- }
- result = currentEntity.getProperty(part);
- value = currentBob.get(part);
- // if there is a next step, just make it
- // if it is last then we stop anyway
- if (value instanceof BaseOBObject) {
- currentBob = (BaseOBObject) value;
- } else {
- return currentEntity.getProperty(part);
- }
- }
- return result;
- }
-
private void addBaseOBObject(JSONObject jsonObject, Property
referencingProperty,
String propertyName, Property referencedProperty, BaseOBObject obObject)
throws JSONException {
String identifier = null;
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits