fixed bug 0009574: Not able to complete the Sales order after entering the required details.
authorAsier Lostalé <asier.lostale@openbravo.com>
Mon, 22 Jun 2009 10:53:58 +0200
changeset 4048 d516efd4a732
parent 4047 906b65e00d8e
child 4049 d8c293b8cc2c
fixed bug 0009574: Not able to complete the Sales order after entering the required details.
src-wad/src/org/openbravo/wad/ActionButton_Relation_data.xsql
src-wad/src/org/openbravo/wad/WadActionButton.java
src-wad/src/org/openbravo/wad/javasource.javaxml
src-wad/src/org/openbravo/wad/javasource.xml
--- a/src-wad/src/org/openbravo/wad/ActionButton_Relation_data.xsql	Mon Jun 22 08:04:09 2009 +0200
+++ b/src-wad/src/org/openbravo/wad/ActionButton_Relation_data.xsql	Mon Jun 22 10:53:58 2009 +0200
@@ -29,7 +29,7 @@
       '' AS htmlfields, '' AS htmltext, '' AS htmlfields_Header, AD_COLUMN.AD_TABLE_ID, '' AS javacode, 
       AD_COLUMN.ad_reference_value_id, '' AS process_Params, '' AS process_code, '' AS additional_code, 
       '' AS process_Params_Code, AD_COLUMN.AD_PROCESS_ID AS xmlid, mo.classname, mom.mappingname,
-      '' AS isjasper, '' as total, '' as comboparacode
+      '' AS isjasper, '' as total, '' as comboparacode, '' as  setsession
       FROM AD_FIELD, AD_COLUMN
             left join ad_model_object mo on ad_column.ad_process_id = mo.ad_process_id 
                           and mo.isactive = 'Y' 
--- a/src-wad/src/org/openbravo/wad/WadActionButton.java	Mon Jun 22 08:04:09 2009 +0200
+++ b/src-wad/src/org/openbravo/wad/WadActionButton.java	Mon Jun 22 10:53:58 2009 +0200
@@ -115,6 +115,7 @@
           fab[i].xmlid = "";
         fab[i].realname = FormatUtilities.replace(fab[i].realname);
         fab[i].columnname = Sqlc.TransformaNombreColumna(fab[i].columnname);
+        fab[i].setsession = getFieldsSession(fab[i]);
         fab[i].htmltext = getFieldsLoad(fab[i], vecFields, vecTotalFields);
         fab[i].javacode = getPrintPageJavaCode(conn, fab[i], vecFields, vecParams, isSOTrx, window,
             tabName, false, fab[i].adProcessId);
@@ -367,9 +368,11 @@
       Vector<Object> vecTotalFields) {
     if (fd == null)
       return "";
+    String processId = fd.adProcessId;
     final StringBuffer html = new StringBuffer();
     if (fd.columnname.equalsIgnoreCase("DocAction")) {
-      html.append("String strdocstatus = vars.getRequiredStringParameter(\"inpdocstatus\");\n");
+      html.append("String strdocstatus = vars.getSessionValue(\"button").append(processId).append(
+          ".inpdocstatus\");\n");
       vecFields.addElement("strdocstatus");
       vecTotalFields.addElement("DocStatus");
       html.append("String stradTableId = \"" + fd.adTableId + "\";\n");
@@ -384,14 +387,29 @@
       vecFields.addElement("stradTableId");
       vecTotalFields.addElement("AD_Table_ID");
     } else if (fd.columnname.equalsIgnoreCase("ChangeProjectStatus")) {
-      html
-          .append("String strprojectstatus = vars.getRequiredStringParameter(\"inpprojectstatus\");\n");
+      html.append("String strprojectstatus = vars.getSessionValue(\"button").append(processId)
+          .append(".inpprojectstatus\");\n");
       vecFields.addElement("strprojectstatus");
       vecTotalFields.addElement("ProjectStatus");
     }
     return html.toString();
   }
 
+  private static String getFieldsSession(ActionButtonRelationData fd) {
+    if (fd == null)
+      return "";
+    String processId = fd.adProcessId;
+    final StringBuffer result = new StringBuffer();
+    if (fd.columnname.equalsIgnoreCase("DocAction")) {
+      result.append("vars.setSessionValue(\"button").append(processId).append(
+          ".inpdocstatus\", vars.getRequiredStringParameter(\"inpdocstatus\"));\n");
+    } else if (fd.columnname.equalsIgnoreCase("ChangeProjectStatus")) {
+      result.append("vars.setSessionValue(\"button").append(processId).append(
+          ".inpprojectstatus\", vars.getRequiredStringParameter(\"inpprojectstatus\"));\n");
+    }
+    return result.toString();
+  }
+
   /**
    * Auxiliar method that generates the printPage java code of the action button.
    * 
--- a/src-wad/src/org/openbravo/wad/javasource.javaxml	Mon Jun 22 08:04:09 2009 +0200
+++ b/src-wad/src/org/openbravo/wad/javasource.javaxml	Mon Jun 22 10:53:58 2009 +0200
@@ -393,6 +393,7 @@
         vars.setSessionValue("button<FIELD_TMP id="ProcessID1">xx</FIELD_TMP>.strProcessing", vars.getStringParameter("inpprocessing", "Y"));
         vars.setSessionValue("button<FIELD_TMP id="ProcessID1">xx</FIELD_TMP>.strOrg", vars.getStringParameter("inpadOrgId"));
         vars.setSessionValue("button<FIELD_TMP id="ProcessID1">xx</FIELD_TMP>.strClient", vars.getStringParameter("inpadClientId"));
+        <FIELD_TMP id="SetSession1"></FIELD_TMP>
         
         HashMap&lt;String, String&gt; p = new HashMap&lt;String, String&gt;();
         <FIELD_TMP id="comboParameters1"></FIELD_TMP>
@@ -421,12 +422,13 @@
         vars.setSessionValue("button<FIELD_TMP id="ProcessID4">xx</FIELD_TMP>.strProcessing", vars.getStringParameter("inpprocessing", "Y"));
         vars.setSessionValue("button<FIELD_TMP id="ProcessID4">xx</FIELD_TMP>.strOrg", vars.getStringParameter("inpadOrgId"));
         vars.setSessionValue("button<FIELD_TMP id="ProcessID4">xx</FIELD_TMP>.strClient", vars.getStringParameter("inpadClientId"));
+        <FIELD_TMP id="SetSessionJava1"></FIELD_TMP>
         
         HashMap&lt;String, String&gt; p = new HashMap&lt;String, String&gt;();
         <FIELD_TMP id="comboParametersJava1"></FIELD_TMP>
         
         //Save in session needed params for combos if needed
-        vars.setSessionObject("button<FIELD_TMP id="ProcessID1">xx</FIELD_TMP>.originalParams", FieldProviderFactory.getFieldProvider(p));
+        vars.setSessionObject("button<FIELD_TMP id="ProcessID4">xx</FIELD_TMP>.originalParams", FieldProviderFactory.getFieldProvider(p));
         printPageButtonFS(response, vars, "<FIELD_TMP id="ProcessID4">xx</FIELD_TMP>", request.getServletPath());
       } else if (vars.commandIn("BUTTON<FIELD_TMP id="ProcessID4">button</FIELD_TMP>")) {
         String str<KEY_TMP id="key">PosicionAlmacen</KEY_TMP> = vars.getGlobalVariable("inp<KEY_TMP id="keyData">PosicionAlmacen</KEY_TMP>", windowId + "|<KEY_TMP id="key">PosicionAlmacen</KEY_TMP>", "");
--- a/src-wad/src/org/openbravo/wad/javasource.xml	Mon Jun 22 08:04:09 2009 +0200
+++ b/src-wad/src/org/openbravo/wad/javasource.xml	Mon Jun 22 10:53:58 2009 +0200
@@ -161,6 +161,7 @@
   <FIELD id="ButtonRealName1">realname</FIELD>
   <FIELD id="ButtonMapping1">mappingname</FIELD>
   <FIELD id="FieldsLoad1">htmltext</FIELD>
+  <FIELD id="SetSession1">setsession</FIELD>
   <FIELD id="FieldsLoadName1">htmlfields</FIELD>
   <FIELD id="comboParameters1">comboparacode</FIELD>
   <SECTION id="sectionActionButtons1"/>
@@ -172,6 +173,7 @@
   <FIELD id="ButtonRealName4">realname</FIELD>
   <FIELD id="ButtonMapping4">mappingname</FIELD>
   <FIELD id="FieldsLoad4">htmltext</FIELD>
+  <FIELD id="SetSessionJava1">setsession</FIELD>
   <FIELD id="FieldsLoadName4">htmlfields</FIELD>
   <FIELD id="comboParametersJava1">comboparacode</FIELD>
   <SECTION id="sectionActionButtonsJava1"/>