details:   /erp/devel/pi/rev/ae7f354c37f9
changeset: 12373:ae7f354c37f9
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue May 24 11:32:08 2011 +0200
summary:   Removed unnecessary methods

details:   /erp/devel/pi/rev/f9c85dd122b0
changeset: 12374:f9c85dd122b0
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue May 24 11:46:51 2011 +0200
summary:   Fixed issue 17330. Preferences will be taken into account in boolean 
columns.

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ApplicationDictionaryCachedStructures.java
 |  33 ----------
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/BooleanUIDefinition.java
                          |  12 +-
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/NumberUIDefinition.java
                           |   7 +-
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/YesNoUIDefinition.java
                            |  14 ++--
 4 files changed, 17 insertions(+), 49 deletions(-)

diffs (145 lines):

diff -r 0c6d4d59d23a -r f9c85dd122b0 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ApplicationDictionaryCachedStructures.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ApplicationDictionaryCachedStructures.java
   Tue May 24 10:02:02 2011 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ApplicationDictionaryCachedStructures.java
   Tue May 24 11:46:51 2011 +0200
@@ -19,8 +19,6 @@
 package org.openbravo.client.application.window;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,9 +28,7 @@
 import org.hibernate.Hibernate;
 import org.hibernate.Query;
 import org.openbravo.base.exception.OBException;
-import org.openbravo.base.model.Property;
 import org.openbravo.base.secureApp.VariablesSecureApp;
-import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.utility.ComboTableData;
 import org.openbravo.model.ad.datamodel.Column;
@@ -61,7 +57,6 @@
   private Map<String, List<Column>> columnMap = new HashMap<String, 
List<Column>>();
   private Map<String, List<AuxiliaryInput>> auxInputMap = new HashMap<String, 
List<AuxiliaryInput>>();
   private Map<String, ComboTableData> comboTableDataMap = new HashMap<String, 
ComboTableData>();
-  private List<Object> initializedObjs = new ArrayList<Object>();
 
   private boolean useCache;
 
@@ -144,34 +139,6 @@
     return auxInputs;
   }
 
-  private void fullyInitializeList(Collection<?> listOfObjs) {
-    if (initializedObjs.contains(listOfObjs)) {
-      return;
-    }
-    for (Object obj : listOfObjs) {
-      fullyInitializeEntity((BaseOBObject) obj);
-    }
-  }
-
-  private void fullyInitializeEntity(BaseOBObject obj) {
-    if (initializedObjs.contains(obj)) {
-      return;
-    }
-    initializedObjs.add(obj);
-    for (Property p : obj.getEntity().getProperties()) {
-      final Object value = obj.get(p.getName());
-      if (value instanceof BaseOBObject || value instanceof Collection<?>) {
-        Hibernate.initialize(value);
-        if (value instanceof BaseOBObject && 
!initializedObjs.contains((BaseOBObject) value)) {
-          fullyInitializeEntity((BaseOBObject) value);
-        } else if (value instanceof Collection<?>) {
-          fullyInitializeList((Collection<?>) value);
-          initializedObjs.add(value);
-        }
-      }
-    }
-  }
-
   public ComboTableData getComboTableData(VariablesSecureApp vars, String ref, 
String colName,
       String objectReference, String validation, String orgList, String 
clientList) {
     String comboId = ref + colName + objectReference + validation + orgList + 
clientList;
diff -r 0c6d4d59d23a -r f9c85dd122b0 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/BooleanUIDefinition.java
--- 
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/BooleanUIDefinition.java
    Tue May 24 10:02:02 2011 +0200
+++ 
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/BooleanUIDefinition.java
    Tue May 24 11:46:51 2011 +0200
@@ -72,16 +72,16 @@
   @Override
   public String getFieldProperties(Field field, boolean getValueFromSession) {
     String result = super.getFieldProperties(field, getValueFromSession);
-    if (!getValueFromSession && field.getColumn().getDefaultValue() == null) {
-      JSONObject jsnobject;
-      try {
-        jsnobject = new JSONObject(result);
+    try {
+      JSONObject jsnobject = new JSONObject(result);
+      if (!getValueFromSession && field.getColumn().getDefaultValue() == null
+          && (!jsnobject.has("value") || jsnobject.get("value").equals(""))) {
         jsnobject.put("value", createFromClassicString("N"));
         jsnobject.put("classicValue", "N");
         return jsnobject.toString();
-      } catch (JSONException e) {
-        throw new OBException("Exception when parsing boolean value", e);
       }
+    } catch (JSONException e) {
+      throw new OBException("Exception when parsing boolean value", e);
     }
     return result;
   }
diff -r 0c6d4d59d23a -r f9c85dd122b0 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/NumberUIDefinition.java
--- 
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/NumberUIDefinition.java
     Tue May 24 10:02:02 2011 +0200
+++ 
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/NumberUIDefinition.java
     Tue May 24 11:46:51 2011 +0200
@@ -113,18 +113,19 @@
   @Override
   public String getFieldProperties(Field field, boolean getValueFromSession) {
     try {
+      JSONObject o = new JSONObject(super.getFieldProperties(field, 
getValueFromSession));
+      o.put("width", "50%");
       // If a column has a numeric reference, and is required, and doesn't 
have a default, then
       // the default '0' is set
       if (!getValueFromSession && field.getColumn().isMandatory()
-          && field.getColumn().getDefaultValue() == null) {
+          && field.getColumn().getDefaultValue() == null
+          && (!o.has("value") || o.get("value").equals(""))) {
         final JSONObject jsonObject = new JSONObject();
         jsonObject.put("value", 0);
         jsonObject.put("classicValue", 0);
         jsonObject.put("width", "50%");
         return jsonObject.toString();
       }
-      JSONObject o = new JSONObject(super.getFieldProperties(field, 
getValueFromSession));
-      o.put("width", "50%");
       return o.toString();
     } catch (JSONException e) {
       throw new OBException(e);
diff -r 0c6d4d59d23a -r f9c85dd122b0 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/YesNoUIDefinition.java
--- 
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/YesNoUIDefinition.java
      Tue May 24 10:02:02 2011 +0200
+++ 
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/YesNoUIDefinition.java
      Tue May 24 11:46:51 2011 +0200
@@ -113,17 +113,17 @@
   @Override
   public String getFieldProperties(Field field, boolean getValueFromSession) {
     String result = super.getFieldProperties(field, getValueFromSession);
-    if (!getValueFromSession && field.getColumn().getDefaultValue() == null) {
-      JSONObject jsnobject;
-      try {
-        jsnobject = new JSONObject(result);
+    try {
+      JSONObject jsnobject = new JSONObject(result);
+      if (!getValueFromSession && field.getColumn().getDefaultValue() == null
+          && (!jsnobject.has("value") || jsnobject.get("value").equals(""))) {
         jsnobject.put("value", createFromClassicString("N"));
         jsnobject.put("classicValue", "N");
         return jsnobject.toString();
-      } catch (JSONException e) {
-        throw new OBException("Exception when parsing boolean value", e);
       }
+      return result;
+    } catch (JSONException e) {
+      throw new OBException("Error while parsing boolean value", e);
     }
-    return result;
   }
 }

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to