details:   /erp/devel/pi/rev/7b63f72ad2dc
changeset: 11474:7b63f72ad2dc
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue Apr 05 10:12:11 2011 +0200
summary:   Moved set of loops to inner method to improve readability of the code

details:   /erp/devel/pi/rev/83b929f61afc
changeset: 11475:83b929f61afc
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue Apr 05 10:29:37 2011 +0200
summary:   Fixed issue 16546. Improved message, and now we show an additional 
message in the server log.

diffstat:

 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
                                    |   2 +-
 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
 |  39 +++++----
 2 files changed, 23 insertions(+), 18 deletions(-)

diffs (83 lines):

diff -r c80a631e4a1f -r 83b929f61afc 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
--- 
a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
        Tue Apr 05 10:10:14 2011 +0200
+++ 
b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
        Tue Apr 05 10:29:37 2011 +0200
@@ -855,7 +855,7 @@
 <!--FF8080812F10C577012F1138306C0027-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--FF8080812F10C577012F1138306C0027-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--FF8080812F10C577012F1138306C0027-->  
<VALUE><![CDATA[OBUIAPP_ExecuteInCallout]]></VALUE>
-<!--FF8080812F10C577012F1138306C0027-->  <MSGTEXT><![CDATA[This window is 
using some functionality (an EXECUTE command in a callout response) which needs 
to be updated to work in Openbravo 3. Therefore, it's likely that this window 
will not work correctly in Openbravo 3 mode. A preference has been added so 
that this window is opened in classic mode until this problem is fixed. Contact 
with your System Administrator, or with the developer of the module to fix 
this. You now need to log out of the application, and login again, so that this 
window is shown in classic mode.]]></MSGTEXT>
+<!--FF8080812F10C577012F1138306C0027-->  <MSGTEXT><![CDATA[This window is 
using some functionality which needs to be updated to work in Openbravo 3. 
Therefore, it's likely that this window will not work correctly in Openbravo 3 
mode. A preference has been added so that this window is opened in classic mode 
until this problem is fixed. Contact with your System Administrator, or with 
the developer of the module to fix this. You now need to log out of the 
application, and login again, so that this window is shown in classic 
mode.]]></MSGTEXT>
 <!--FF8080812F10C577012F1138306C0027-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
 <!--FF8080812F10C577012F1138306C0027-->  
<AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--FF8080812F10C577012F1138306C0027--></AD_MESSAGE>
diff -r c80a631e4a1f -r 83b929f61afc 
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
     Tue Apr 05 10:10:14 2011 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
     Tue Apr 05 10:29:37 2011 +0200
@@ -198,20 +198,8 @@
           calloutsToCall, lastfieldChanged, calloutMessages, changeEventCols);
 
       if (changedCols.size() > 0) {
-        List<String> columnsToComputeAgain = new ArrayList<String>();
-        for (String changedCol : changedCols) {
-          for (String colWithVal : columnsInValidation.keySet()) {
-            for (String colInVal : columnsInValidation.get(colWithVal)) {
-              if (colInVal.equalsIgnoreCase(changedCol)) {
-                if (!columnsToComputeAgain.contains(colInVal)) {
-                  columnsToComputeAgain.add(colWithVal);
-                }
-              }
-            }
-          }
-        }
         RequestContext.get().setRequestParameter("donotaddcurrentelement", 
"true");
-        subsequentComboReload(tab, columnsToComputeAgain, columnValues);
+        subsequentComboReload(tab, columnValues, changedCols, 
columnsInValidation);
       }
 
       if (mode.equals("NEW")) {
@@ -473,17 +461,30 @@
     }
   }
 
-  private void subsequentComboReload(Tab tab, List<String> allColumns,
-      Map<String, JSONObject> columnValues) {
+  private void subsequentComboReload(Tab tab, Map<String, JSONObject> 
columnValues,
+      List<String> changedCols, Map<String, List<String>> columnsInValidation) 
{
+
+    List<String> columnsToComputeAgain = new ArrayList<String>();
+    for (String changedCol : changedCols) {
+      for (String colWithVal : columnsInValidation.keySet()) {
+        for (String colInVal : columnsInValidation.get(colWithVal)) {
+          if (colInVal.equalsIgnoreCase(changedCol)) {
+            if (!columnsToComputeAgain.contains(colInVal)) {
+              columnsToComputeAgain.add(colWithVal);
+            }
+          }
+        }
+      }
+    }
     HashMap<String, Field> columnsOfFields = new HashMap<String, Field>();
     for (Field field : tab.getADFieldList()) {
-      for (String col : allColumns) {
+      for (String col : columnsToComputeAgain) {
         if (col.equalsIgnoreCase(field.getColumn().getDBColumnName())) {
           columnsOfFields.put(col, field);
         }
       }
     }
-    for (String col : allColumns) {
+    for (String col : columnsToComputeAgain) {
       Field field = columnsOfFields.get(col);
       try {
         String columnId = field.getColumn().getId();
@@ -922,6 +923,10 @@
                         "OBUIAPP_ExecuteInCallout", 
RequestContext.get().getVariablesSecureApp()
                             .getLanguage()));
                     createNewPreferenceForWindow(tab.getWindow());
+                    log.warn("An EXECUTE element has been found in the 
response of the callout "
+                        + calloutClassName + ". A preference has been created 
for the window "
+                        + tab.getWindow().getName()
+                        + "so that it's shown in classic mode until this 
problem is fixed.");
                   }
                 }
               } else {

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to