details:   https://code.openbravo.com/erp/devel/pi/rev/a410732b5a7f
changeset: 26128:a410732b5a7f
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Thu Mar 05 16:04:13 2015 +0100
summary:   fixed bug 29117: empty linked items if computed column points 
current entity

  Linked items section didn't receive any row and remained in "loading data" 
state
  when a computed column in any entity linked to the entity the section was 
used in.

  The problem was caused by an error when trying to deal with computed column in
  linked items. No error was shown nor in UI nor in openbravo.log.

  This fix:
   - Adds log in openbravo.log including stack trace in case of error computing
     linked items
   - NPE getMessage is null which caused not to be shown in the UI, it is casted
     to String
   - Computed Columns are properly ignored in linked items

  IMPORTANT NOTE: Computed Columns cannot be evaluated in linked items so they
                  are ignored

diffstat:

 src/org/openbravo/erpCommon/utility/UsedByLink.java |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r 1c75a6afca4e -r a410732b5a7f 
src/org/openbravo/erpCommon/utility/UsedByLink.java
--- a/src/org/openbravo/erpCommon/utility/UsedByLink.java       Thu Mar 05 
10:49:36 2015 +0100
+++ b/src/org/openbravo/erpCommon/utility/UsedByLink.java       Thu Mar 05 
16:04:13 2015 +0100
@@ -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) 2001-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2015 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -241,8 +241,10 @@
       jsonObject = buildJsonObject(jsonObject, searchResult);
 
     } catch (Exception e) {
+      log4j.error(
+          "Error getting Categories for windowId: " + windowId + " - entity: " 
+ entityName, e);
       try {
-        jsonObject.put("msg", e.getMessage());
+        jsonObject.put("msg", "" + e.getMessage());
       } catch (JSONException jex) {
         log4j.error("Error trying to generate message: " + jex.getMessage(), 
jex);
       }
@@ -291,8 +293,9 @@
       }
 
     } catch (Exception e) {
+      log4j.error("Error getting linkend items for tab " + adTabId, e);
       try {
-        jsonObject.put("msg", e.getMessage());
+        jsonObject.put("msg", "" + e.getMessage());
       } catch (JSONException jex) {
         log4j.error("Error trying to generate message: " + jex.getMessage(), 
jex);
       }
@@ -538,7 +541,6 @@
         usedByLinkDataJsonObj.put("editOrDeleteOnly", 
"ED".equals(data.uipattern));
         usedByLinkDataJsonObjects.add(usedByLinkDataJsonObj);
       }
-
       jsonObject.put("usedByLinkData", usedByLinkDataJsonObjects);
     }
     if (msg != null) {
@@ -655,7 +657,8 @@
           // ignore one-to-many (a list of children)
           if (!property.isOneToMany() && property.getColumnName() != null
               && property.getTargetEntity() != null
-              && 
property.getTargetEntity().getTableName().equalsIgnoreCase(tableName)) {
+              && 
property.getTargetEntity().getTableName().equalsIgnoreCase(tableName)
+              && !property.isComputedColumn()) {
             // Datasource tables are skipped
             linkedTableId = property.getEntity().getTableId();
             linkedTableObject = OBDal.getInstance().get(Table.class, 
linkedTableId);

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to