Fixed issue 29602: tab to check shouldn't be obtained from table's window
authorInigo Sanchez <inigo.sanchez@openbravo.com>
Mon, 01 Jun 2015 13:16:02 +0200
changeset 26816 8721a7b97a6b
parent 26815 a9518a8e931b
child 26817 d4644c111852
Fixed issue 29602: tab to check shouldn't be obtained from table's window

The problem was that tab to check shouldn't be obtained from table's window
but directly from the current window. Now it is taking 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 Jun 01 13:08:42 2015 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java	Mon Jun 01 13:16:02 2015 +0200
@@ -79,19 +79,17 @@
       final String roleId = OBContext.getOBContext().getRole().getId();
       final DalConnectionProvider dalConnectionProvider = new DalConnectionProvider();
       final JSONObject jsonUIPattern = new JSONObject();
+      final String windowType = window.getWindowType();
       for (Tab tab : window.getADTabList()) {
         final boolean readOnlyAccess = org.openbravo.erpCommon.utility.WindowAccessData
             .hasReadOnlyAccess(dalConnectionProvider, roleId, tab.getId());
         String uiPattern = readOnlyAccess ? "RO" : tab.getUIPattern();
         // window should be read only when is assigned with a table defined as a view
-        if (tab.getTable().getWindow() != null) {
-          String windowType = tab.getTable().getWindow().getWindowType();
-          if (!"RO".equals(uiPattern) && tab.getTable().isView()
-              && ("T".equals(windowType) || "M".equals(windowType))) {
-            log4j.warn("Tab \"" + tab.getName()
-                + "\" is set to read only because is assigned with a table defined as a view.");
-            uiPattern = "RO";
-          }
+        if (!"RO".equals(uiPattern)
+            && ("T".equals(windowType) || "M".equals(windowType) && tab.getTable().isView())) {
+          log4j.warn("Tab \"" + tab.getName()
+              + "\" is set to read only because is assigned with a table defined as a view.");
+          uiPattern = "RO";
         }
         jsonUIPattern.put(tab.getId(), uiPattern);
       }