details:   https://code.openbravo.com/erp/devel/pi/rev/7e0c66407ed1
changeset: 17984:7e0c66407ed1
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Sep 19 17:49:12 2012 +0200
summary:   Fixes issue 20728: IDs shown only for fields that without 
referencial integrity

Prior to this fix, if one foreign key field contained and non existent id, all 
foreign key fields showed the id instead of the displayed column of the 
referenced field. Now, only the fields that contain nonexistent id will show 
the id.

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
 |  44 +++++----
 1 files changed, 24 insertions(+), 20 deletions(-)

diffs (64 lines):

diff -r 7d048ad0b76f -r 7e0c66407ed1 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
     Wed Sep 19 17:38:29 2012 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
     Wed Sep 19 17:49:12 2012 +0200
@@ -632,8 +632,7 @@
           }
         }
       } catch (Exception e) {
-        throw new OBException(
-            "Couldn't get data for column " + 
field.getColumn().getDBColumnName(), e);
+        log.error("Couldn't get data for column " + 
field.getColumn().getDBColumnName(), e);
       }
     }
 
@@ -1019,27 +1018,32 @@
       currentValue = obj.get(prop.getName());
     }
 
-    if (currentValue != null && !currentValue.toString().equals("null")) {
-      if (currentValue instanceof BaseOBObject) {
-        if (prop.getReferencedProperty() != null) {
-          currentValue = ((BaseOBObject) 
currentValue).get(prop.getReferencedProperty().getName());
+    try {
+      if (currentValue != null && !currentValue.toString().equals("null")) {
+        if (currentValue instanceof BaseOBObject) {
+          if (prop.getReferencedProperty() != null) {
+            currentValue = ((BaseOBObject) currentValue)
+                .get(prop.getReferencedProperty().getName());
+          } else {
+            currentValue = ((BaseOBObject) currentValue).getId();
+          }
         } else {
-          currentValue = ((BaseOBObject) currentValue).getId();
+          currentValue = 
UIDefinitionController.getInstance().getUIDefinition(prop.getColumnId())
+              .convertToClassicString(currentValue);
         }
-      } else {
-        currentValue = 
UIDefinitionController.getInstance().getUIDefinition(prop.getColumnId())
-            .convertToClassicString(currentValue);
+        if (currentValue != null && currentValue.equals("null")) {
+          currentValue = null;
+        }
+        if (currentValue == null) {
+          RequestContext.get().setRequestParameter(
+              "inp" + Sqlc.TransformaNombreColumna(columnName), null);
+        } else {
+          RequestContext.get().setRequestParameter(
+              "inp" + Sqlc.TransformaNombreColumna(columnName), 
currentValue.toString());
+        }
       }
-      if (currentValue != null && currentValue.equals("null")) {
-        currentValue = null;
-      }
-      if (currentValue == null) {
-        RequestContext.get().setRequestParameter("inp" + 
Sqlc.TransformaNombreColumna(columnName),
-            null);
-      } else {
-        RequestContext.get().setRequestParameter("inp" + 
Sqlc.TransformaNombreColumna(columnName),
-            currentValue.toString());
-      }
+    } catch (Exception e) {
+      log.error("Couldn't get the value for column " + columnName);
     }
   }
 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to