details: https://code.openbravo.com/erp/devel/pi/rev/13bebe76e732 changeset: 20251:13bebe76e732 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed May 01 12:51:36 2013 +0200 summary: fixed bug 23705: Not possible to select a value in drop down filter
This is a temporary fix that should be reviewed again when issue 23706 is fixed details: https://code.openbravo.com/erp/devel/pi/rev/eb2fcc35a947 changeset: 20252:eb2fcc35a947 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed May 01 12:53:04 2013 +0200 summary: related to bug 23706, related to bug 23705 Added comment not to forget to review change for issue 23705 when 23706 is solved diffstat: modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java | 4 ++ src/org/openbravo/base/structure/IdentifierProvider.java | 20 +++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diffs (51 lines): diff -r a7c5a974e6fa -r eb2fcc35a947 modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java --- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java Tue Apr 30 21:05:02 2013 +0200 +++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java Wed May 01 12:53:04 2013 +0200 @@ -169,6 +169,10 @@ jsonResponse.put(JsonConstants.RESPONSE_TOTALROWS, 1); return jsonResult.toString(); } else if (parameters.containsKey(JsonConstants.DISTINCT_PARAMETER)) { + // TODO: BaseOBObjects created by this query are not valid, see issue #23705, when this is + // fixed, IdentifierProvider should be revisited to remove code handling this + // incorrectness + // when distinct an array of values is returned // the first value is the BaseObObject the other values // are part of the order by and such and can be ignored diff -r a7c5a974e6fa -r eb2fcc35a947 src/org/openbravo/base/structure/IdentifierProvider.java --- a/src/org/openbravo/base/structure/IdentifierProvider.java Tue Apr 30 21:05:02 2013 +0200 +++ b/src/org/openbravo/base/structure/IdentifierProvider.java Wed May 01 12:53:04 2013 +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) 2008-2010 Openbravo SLU + * All portions are Copyright (C) 2008-2013 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -118,7 +118,23 @@ // Assign displayColumnProperty to apply formatting if needed property = displayColumnProperty; } else if (property.isTranslatable()) { - value = ((BaseOBObject) dob).get(identifier.getName(), language, (String) dob.get("id")); + // Trying to get id of translatable object. + Object id = dob.get("id"); + if (id instanceof BaseOBObject) { + // When the object is created for a drop down list filter, it is incorrect: id is not a + // String but a BaseOBject. This code deals with this exception. + + // TODO: once issue #23706 is fixed, this should not be needed anymore + id = ((BaseOBObject) id).get("id"); + } + + if (id instanceof String) { + value = ((BaseOBObject) dob).get(identifier.getName(), language, (String) id); + } else { + // give up, couldn't find the id + value = ((BaseOBObject) dob).get(identifier.getName(), language); + } + } else if (!property.isPrimitive() && identifyDeep) { if (dob.get(property.getName()) != null) { value = ((BaseOBObject) dob.get(property.getName())).getIdentifier(); ------------------------------------------------------------------------------ Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET Get 100% visibility into your production application - at no cost. Code-level diagnostics for performance bottlenecks with <2% overhead Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap1 _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits