Fixes issue 25586: Display logic based on hidden field works
authorAugusto Mauch <augusto.mauch@openbravo.com>
Wed, 29 Jan 2014 11:35:48 +0100
changeset 21992 1dc2a7cc6231
parent 21991 68725a9cdf08
child 21993 49232772ca5d
Fixes issue 25586: Display logic based on hidden field works

Hidden fields that are part of the display logic of other fields are now included in the list of the grid required fields.
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFieldHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFieldHandler.java	Fri Jan 31 11:41:31 2014 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFieldHandler.java	Wed Jan 29 11:35:48 2014 +0100
@@ -74,6 +74,7 @@
   private List<String> windowEntities = null;
   private List<OBViewFieldDefinition> fields;
   private List<String> propertiesInButtonFieldDisplayLogic = new ArrayList<String>();
+  private List<String> hiddenPropertiesInDisplayLogic = new ArrayList<String>();
   private List<String> storedInSessionProperties = new ArrayList<String>();
 
   private List<Field> ignoredFields = new ArrayList<Field>();
@@ -140,6 +141,14 @@
           if (!propertiesInButtonFieldDisplayLogic.contains(property.getName())) {
             propertiesInButtonFieldDisplayLogic.add(property.getName());
           }
+        } else {
+          if (!fieldExpression.isDisplayed()) {
+            Property property = entity.getPropertyByColumnName(fieldExpression.getColumn()
+                .getDBColumnName());
+            if (!hiddenPropertiesInDisplayLogic.contains(property.getName())) {
+              hiddenPropertiesInDisplayLogic.add(property.getName());
+            }
+          }
         }
       }
     }
@@ -2116,6 +2125,10 @@
     return propertiesInButtonFieldDisplayLogic;
   }
 
+  public List<String> getHiddenPropertiesInDisplayLogic() {
+    return hiddenPropertiesInDisplayLogic;
+  }
+
   public boolean hasProcessNowProperty() {
     final Entity entity = ModelProvider.getInstance().getEntityByTableId(
         getTab().getTable().getId());
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java	Fri Jan 31 11:41:31 2014 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java	Wed Jan 29 11:35:48 2014 +0100
@@ -284,6 +284,14 @@
       requiredGridProperties.add(propertyName);
     }
 
+    // List of hidden properties that are part of display logic (see
+    // https://issues.openbravo.com/view.php?id=25586)
+    List<String> hiddenPropertiesInDisplayLogic = getViewTab().getFieldHandler()
+        .getHiddenPropertiesInDisplayLogic();
+    for (String propertyName : hiddenPropertiesInDisplayLogic) {
+      requiredGridProperties.add(propertyName);
+    }
+
     // Always include the propertyt that links to the parent tab
     String linkToParentPropertyName = this.getLinkToParentPropertyName();
     if (linkToParentPropertyName != null && !linkToParentPropertyName.isEmpty()) {