Fixes bug 27709: Inactive Window/Tab/Field Access records are not considered
authorAugusto Mauch <augusto.mauch@openbravo.com>
Tue, 30 Sep 2014 11:20:31 +0200
changeset 25002 30ffca2dd8ad
parent 25001 04065681d156
child 25003 8792ae5475eb
Fixes bug 27709: Inactive Window/Tab/Field Access records are not considered

The problem was that even if a WIndow/Tab/Field access record was inactive, it was being taken into account by the WindowSettionsActionHandler class. Now this no longer happen.

This fix comes with a behavioural change in the way the Is Active field of these tabs is handled. Before this fix the flag was ignored, now is taken into account.
modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java	Mon Oct 06 09:44:38 2014 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java	Tue Sep 30 11:20:31 2014 +0200
@@ -100,30 +100,35 @@
       final JSONArray tabs = new JSONArray();
       json.put("tabs", tabs);
       for (WindowAccess winAccess : window.getADWindowAccessList()) {
-        if (winAccess.getRole().getId().equals(roleId)) {
+        if (winAccess.isActive() && winAccess.getRole().getId().equals(roleId)) {
           for (TabAccess tabAccess : winAccess.getADTabAccessList()) {
-            boolean tabEditable = tabAccess.isEditableField();
-            final Entity entity = ModelProvider.getInstance().getEntityByTableId(
-                tabAccess.getTab().getTable().getId());
-            final JSONObject jTab = new JSONObject();
-            tabs.put(jTab);
-            jTab.put("tabId", tabAccess.getTab().getId());
-            jTab.put("updatable", tabEditable);
-            final JSONObject jFields = new JSONObject();
-            jTab.put("fields", jFields);
-            final Set<String> fields = new TreeSet<String>();
-            for (Field field : tabAccess.getTab().getADFieldList()) {
-              if (!field.isReadOnly() && !field.isShownInStatusBar()) {
-                fields.add(KernelUtils.getProperty(entity, field).getName());
+            if (tabAccess.isActive()) {
+              boolean tabEditable = tabAccess.isEditableField();
+              final Entity entity = ModelProvider.getInstance().getEntityByTableId(
+                  tabAccess.getTab().getTable().getId());
+              final JSONObject jTab = new JSONObject();
+              tabs.put(jTab);
+              jTab.put("tabId", tabAccess.getTab().getId());
+              jTab.put("updatable", tabEditable);
+              final JSONObject jFields = new JSONObject();
+              jTab.put("fields", jFields);
+              final Set<String> fields = new TreeSet<String>();
+              for (Field field : tabAccess.getTab().getADFieldList()) {
+                if (!field.isReadOnly() && !field.isShownInStatusBar()) {
+                  fields.add(KernelUtils.getProperty(entity, field).getName());
+                }
               }
-            }
-            for (FieldAccess fieldAccess : tabAccess.getADFieldAccessList()) {
-              final String name = KernelUtils.getProperty(entity, fieldAccess.getField()).getName();
-              jFields.put(name, fieldAccess.isEditableField());
-              fields.remove(name);
-            }
-            for (String name : fields) {
-              jFields.put(name, tabEditable);
+              for (FieldAccess fieldAccess : tabAccess.getADFieldAccessList()) {
+                if (fieldAccess.isActive()) {
+                  final String name = KernelUtils.getProperty(entity, fieldAccess.getField())
+                      .getName();
+                  jFields.put(name, fieldAccess.isEditableField());
+                  fields.remove(name);
+                }
+              }
+              for (String name : fields) {
+                jFields.put(name, tabEditable);
+              }
             }
           }
         }