Fixed bug 0000543
authorDavid Alsasua <david.alsasua@openbravo.com>
Tue, 03 Jun 2008 17:09:52 +0000
changeset 1117 b0d8224384fb
parent 1116 ac7743e0ceec
child 1118 5cfc06d0a9ae
Fixed bug 0000543
src/org/openbravo/erpCommon/ad_actionButton/CreateFile.html
src/org/openbravo/erpCommon/ad_actionButton/CreateFile.java
src/org/openbravo/erpCommon/ad_actionButton/CreateFile.xml
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFile.html	Tue Jun 03 16:28:44 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFile.html	Tue Jun 03 17:09:52 2008 +0000
@@ -47,25 +47,24 @@
     return true;
   }
   </SCRIPT>
-	<SCRIPT language="JavaScript" type="text/javascript">
+  	<SCRIPT language="JavaScript" type="text/javascript">
 	function onLoadDo(){
 		this.windowTables = new Array(
 		  new windowTableId('client', 'buttonOK')
 		);
 		setWindowTableParentElement();
 		enableShortcuts('popup');
-		
-		xx();
 
 		setWindowElementFocus('firstElement');
 	}
 
 	function onResizeDo(){
 	}
-	</SCRIPT>
+	</SCRIPT>  
+
 </HEAD>
 
-<BODY id="paramMessage" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="onLoadDo();" onresize="onResizeDo();">
+<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="onLoadDo();" onresize="onResizeDo();">
 <FORM id="form" method="POST" action="CreateFile.html" name="frmMain">
   <INPUT type="hidden" name="Command">
 <INPUT type="hidden" name="IsPopUpCall" value="1"></INPUT>
@@ -126,6 +125,91 @@
     <tr>
       <td>
         <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client">
+        <!-- MessageBox -->
+
+                            <table cellpadding="0" cellspacing="0" id="messageBoxID" class="MessageBoxyy">
+                              <TBODY>
+                              <tr class="MessageBox_TopMargin">
+                                <td class="MessageBox_LeftMargin"></td>
+                                <td></td>
+                                <td class="MessageBox_RightMargin"></td>
+                              </tr>
+                              <tr>
+                                <td class="MessageBox_LeftMargin"></td>
+                                <td>
+
+                                  <table cellpadding="0" cellspacing="0" style="width: 100%;">
+                                    <TBODY>
+                                    <tr>
+                                      <td>
+                                        <div class="MessageBox_TopLeft"></div>
+                                        <div class="MessageBox_Left"></div>
+                                      </td>
+                                      <td class="MessageBox_bg">
+
+                                        <table class="MessageBox_Top">
+                                        <TBODY>
+                                          <tr>
+                                            <td>
+                                              <span>
+                                              <table cellpadding="0" cellspacing="0" class="MessageBox_Body_ContentCell">
+                                                <TBODY>
+                                                <tr>
+                                                  <td class="MessageBox_Icon_ContentCell">
+                                                    <div class="MessageBox_Icon"></div>
+                                                  </td>
+                                                  <td style="vertical-align: top;" id="messageBoxIDContent">
+                                                    <span>
+                                                      <div class="MessageBox_TextTitle" id="messageBoxIDTitle">
+                                                        xxInfo: AccessTableWithNoView
+                                                      </div>
+                                                      <div class="MessageBox_TextDescription" id="messageBoxIDMessage">
+                                                        xxThe current information is empty.
+                                                      </div>
+                                                      <div class="MessageBox_TextSeparator"></div>
+                                                    </span>
+                                                  </td>
+                                                </tr>
+                                                </TBODY>
+                                              </table>
+                                              </span>
+                                            </td>
+                                          </tr>
+                                          </TBODY>
+                                        </table>
+
+                                      </td>
+                                      <td class="MessageBox_RightTrans">
+                                        <div class="MessageBox_TopRight"></div>
+                                        <div class="MessageBox_Right"></div>
+                                      </td>
+                                    </tr>
+                                    <tr>
+                                      <td rowspan="2" class="MessageBox_BottomLeft">
+                                      </td>
+                                      <td class="MessageBox_BottomTrans MessageBox_bg">
+                                      </td>
+                                      <td rowspan="2" class="MessageBox_BottomRight">
+                                      </td>
+                                    </tr>
+                                    <tr>
+                                      <td class="MessageBox_Bottom">
+                                      </td>
+                                    </tr>
+                                    </TBODY>
+                                  </table>
+
+                                </td>
+                                <td class="MessageBox_RightMargin"></td>
+                              </tr>
+                              <tr class="MessageBox_BottomMargin">
+                                <td class="MessageBox_LeftMargin"></td>
+                                <td></td>
+                                <td class="MessageBox_RightMargin"></td>
+                              </tr>
+                              </TBODY>
+                            </table>              <!-- USER CONTROLS -->
+        
           <table cellspacing="0" cellpadding="0" class="Popup_Client_TablePopup">
 
             <tr>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFile.java	Tue Jun 03 16:28:44 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFile.java	Tue Jun 03 17:09:52 2008 +0000
@@ -19,6 +19,7 @@
 package org.openbravo.erpCommon.ad_actionButton;
 
 import org.openbravo.erpCommon.ad_combos.*;
+import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.utils.Replace;
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
@@ -45,7 +46,7 @@
       String strWindow = vars.getStringParameter("inpwindowId");
       String strKey = vars.getStringParameter("inpcRemittanceId");
       String strMessage = "";
-      printPage(response, vars, strKey, strWindow, strProcessId, strMessage);
+      printPage(response, vars, strKey, strWindow, strProcessId, strMessage, true);
     } else if(vars.commandIn("GENERATE")){
       String strKey = vars.getStringParameter("inpcRemittanceId");
       getPrintPage(response, vars, strKey);
@@ -53,7 +54,7 @@
   }
 
 
-  void printPage(HttpServletResponse response, VariablesSecureApp vars, String strKey, String windowId, String strProcessId, String strMessage)
+  void printPage(HttpServletResponse response, VariablesSecureApp vars, String strKey, String windowId, String strProcessId, String strMessage, boolean isDefault)
     throws IOException, ServletException {
       if (log4j.isDebugEnabled()) log4j.debug("Output: Button create file msg:"+strMessage);
 
@@ -77,8 +78,31 @@
       xmlDocument.setParameter("theme", vars.getTheme());
       xmlDocument.setParameter("description", strDescription);
       xmlDocument.setParameter("help", strHelp);
-      xmlDocument.setParameter("message",strMessage.equals("")?"":"alert('" + strMessage + "');");
-
+      
+      if(isDefault){
+        xmlDocument.setParameter("messageType", "");
+        xmlDocument.setParameter("messageTitle", "");
+        xmlDocument.setParameter("messageMessage", "");
+      }else{
+        OBError myMessage = new OBError();
+        myMessage.setTitle("");
+        if(log4j.isDebugEnabled()) log4j.debug("CreateFile - before setMessage");
+        if(strMessage==null || strMessage.equals("")) myMessage.setType("Success");
+        else myMessage.setType("Error");
+        if(strMessage!=null && !strMessage.equals("")) {
+          myMessage.setMessage(strMessage);
+        } else Utility.translateError(this, vars, vars.getLanguage(), "Success");
+        if(log4j.isDebugEnabled()) log4j.debug("CreateFile - Message Type: " + myMessage.getType());
+        vars.setMessage("CreateFile", myMessage);
+        if(log4j.isDebugEnabled()) log4j.debug("CreateFile - after setMessage");
+        if (myMessage!=null) {
+          xmlDocument.setParameter("messageType", myMessage.getType());
+          xmlDocument.setParameter("messageTitle", myMessage.getTitle());
+          xmlDocument.setParameter("messageMessage", myMessage.getMessage());
+        }
+      }
+      
+      
       response.setContentType("text/html; charset=UTF-8");
       PrintWriter out = response.getWriter();
       out.println(xmlDocument.print());
@@ -114,13 +138,13 @@
 
     if(comprobacion1 != 0 || comprobacion2 == 0 || comprobacion3 !=1 || comprobacion4 == 0){
     strMessage = Utility.messageBD(this, "CreateFileError", vars.getLanguage());
-    printPage(response, vars, strKey, "", "", strMessage);
+    printPage(response, vars, strKey, "", "", strMessage, false);
     }
     int contador = 2;
     // dubugging headers
     if (Principio == null || Principio.length == 0){
         strMessage = Utility.messageBD(this, "DefaultAccountError", vars.getLanguage());
-        printPage(response, vars, strKey, "", "", strMessage);
+        printPage(response, vars, strKey, "", "", strMessage, false);
 		return;
     }
     if (Lineas == null || Total == null)return;
@@ -192,7 +216,7 @@
     strBuf = strBuf.append("5970").append(Principio[0].nif).append(strContract);
     strBuf = strBuf.append(NLineas[0].ordenantes).append(Total[0].payamt).append(Total[0].nFactura).append(NLineas[0].lineas);
     if (!strMessage.equals("")){
-      printPage(response, vars, strKey, "", "", strMessage);
+      printPage(response, vars, strKey, "", "", strMessage, false);
     }else{
       response.setContentType("application/rtf");
       response.setHeader("Content-Disposition","attachment; filename=BANK.DAT");
@@ -218,14 +242,14 @@
     if(comprobacion1 != 0 || comprobacion2 == 0 || comprobacion3 !=1 || comprobacion4 == 0){
       if (log4j.isDebugEnabled()) log4j.debug("Error: c1:"+comprobacion1+" c2:"+comprobacion2+" c3:"+comprobacion3+" c4:"+comprobacion4);
       strMessage = Utility.messageBD(this, "CreateFileError", vars.getLanguage());
-      printPage(response, vars, strKey, "", "", strMessage);
+      printPage(response, vars, strKey, "", "", strMessage, false);
     }
     if (log4j.isDebugEnabled()) log4j.debug("check1 ok");
     int contador = 2;
     //debugging headers
     if (Principio == null || Principio.length == 0){
         strMessage = Utility.messageBD(this, "DefaultAccountError", vars.getLanguage());
-        printPage(response, vars, strKey, "", "", strMessage);
+        printPage(response, vars, strKey, "", "", strMessage, false);
 		return;
     }
     if (Lineas == null || Total == null)return;
@@ -308,7 +332,7 @@
     strBuf = strBuf.append("5980").append(Principio[0].nif).append(strContract);
     strBuf = strBuf.append(NLineas[0].ordenantes).append(Total[0].payamt).append(Total[0].nFactura).append(NLineas[0].lineas);
     if (!strMessage.equals("")){
-      printPage(response, vars, strKey, "", "", strMessage);
+      printPage(response, vars, strKey, "", "", strMessage, false);
     }else{
       response.setContentType("application/rtf");
       response.setHeader("Content-Disposition","attachment; filename=BANK.DAT");
@@ -377,7 +401,7 @@
     if(comprobacion1 != 0 || comprobacion2 == 0 || comprobacion3 !=1 || comprobacion4 == 0){
       if (log4j.isDebugEnabled()) log4j.debug("Error: c1:"+comprobacion1+" c2:"+comprobacion2+" c3:"+comprobacion3+" c4:"+comprobacion4);
       strMessage = Utility.messageBD(this, "CreateFileError", vars.getLanguage());
-      printPage(response, vars, strKey, "", "", strMessage);
+      printPage(response, vars, strKey, "", "", strMessage, false);
     }
 
     if (log4j.isDebugEnabled()) log4j.debug("Principio[0].taxid = " + Principio[0].taxid);
@@ -388,20 +412,20 @@
     //debugging headers
     if (Principio == null || Principio.length == 0){
         strMessage = Utility.messageBD(this, "DefaultAccountError", vars.getLanguage());
-        printPage(response, vars, strKey, "", "", strMessage);
+        printPage(response, vars, strKey, "", "", strMessage, false);
 		    return;
     }
     if (Lineas == null || Total == null) return;
     if (Principio[0].taxid == null || Principio[0].taxid.length()!=9){
         strMessage = Utility.messageBD(this, "NIFError", vars.getLanguage());
         if (log4j.isDebugEnabled()) log4j.debug("VAT number");
-        printPage(response, vars, strKey, "", "", strMessage);
+        printPage(response, vars, strKey, "", "", strMessage, false);
         return;
     }
     if (Principio[0].acct == null || Principio[0].acct.length()!=18){
         strMessage = Utility.messageBD(this, "BankAccountError", vars.getLanguage());
         if (log4j.isDebugEnabled()) log4j.debug("bankaccount");
-        printPage(response, vars, strKey, "", "", strMessage);
+        printPage(response, vars, strKey, "", "", strMessage, false);
         return;
     }
 
@@ -409,7 +433,7 @@
     {
        strMessage = Utility.messageBD(this, "TodayHigherDueData", vars.getLanguage());
        if (log4j.isDebugEnabled()) log4j.debug("TodayHigherDueData");
-       printPage(response, vars, strKey, "", "", strMessage);
+       printPage(response, vars, strKey, "", "", strMessage, false);
        return;
     }*/
 
@@ -447,37 +471,37 @@
         if (Lineas[i].nom == null || Lineas[i].nom.length()<1){
           if (log4j.isDebugEnabled()) log4j.debug("NameError");
             strMessage = Utility.messageBD(this, "NameError", vars.getLanguage()) + Lineas[i].nif;
-            printPage(response, vars, strKey, "", "", strMessage);
+            printPage(response, vars, strKey, "", "", strMessage, false);
             return;
         }
         if (Lineas[i].taxid == null || Lineas[i].taxid.length()!=9){
             if (log4j.isDebugEnabled()) log4j.debug("NIFError");
             strMessage = Utility.messageBD(this, "NIFBPartnerError", vars.getLanguage()) + Lineas[i].nombre;
-            printPage(response, vars, strKey, "", "", strMessage);
+            printPage(response, vars, strKey, "", "", strMessage, false);
             return;
         }
         if (Lineas[i].acct == null || Lineas[i].acct.length()!=20){
             if (log4j.isDebugEnabled()) log4j.debug("CodeBankBPError");
             strMessage = Utility.messageBD(this, "CodeBankBPError", vars.getLanguage()) + Lineas[i].nombre;
-            printPage(response, vars, strKey, "", "", strMessage);
+            printPage(response, vars, strKey, "", "", strMessage, false);
             return;
         }
         if (Lineas[i].dom == null || Lineas[i].dom.length()<1){
           if (log4j.isDebugEnabled()) log4j.debug("AddressError");
             strMessage = Utility.messageBD(this, "AddressError", vars.getLanguage()) + Lineas[i].nombre;
-            printPage(response, vars, strKey, "", "", strMessage);
+            printPage(response, vars, strKey, "", "", strMessage, false);
             return;
         }
         if (Lineas[i].pla == null || Lineas[i].pla.length()<1){
           if (log4j.isDebugEnabled()) log4j.debug("SquareError");
             strMessage = Utility.messageBD(this, "SquareError", vars.getLanguage()) + Lineas[i].nombre;
-            printPage(response, vars, strKey, "", "", strMessage);
+            printPage(response, vars, strKey, "", "", strMessage, false);
             return;
         }
         if (Lineas[i].prov == null || Lineas[i].prov.length()<1){
           if (log4j.isDebugEnabled()) log4j.debug("AddressError");
             strMessage = Utility.messageBD(this, "AddressError", vars.getLanguage()) + Lineas[i].nombre;
-            printPage(response, vars, strKey, "", "", strMessage);
+            printPage(response, vars, strKey, "", "", strMessage, false);
             return;
         }
         //010
@@ -514,7 +538,7 @@
    strBuf = strBuf.append(NLineas[0].ordenantes).append(NLineas[0].lineas).append(NLineas[0].hueco).append("\r\n");
 
     if (!strMessage.equals("")){
-      printPage(response, vars, strKey, "", "", strMessage);
+      printPage(response, vars, strKey, "", "", strMessage, false);
     }else{
       response.setContentType("application/rtf");
       response.setHeader("Content-Disposition","attachment; filename=BANK.DAT");
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFile.xml	Tue Jun 03 16:28:44 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFile.xml	Tue Jun 03 17:09:52 2008 +0000
@@ -22,7 +22,6 @@
 	<PARAMETER id="paramLanguage" name="language" default=""/>
 	<PARAMETER id="paramcRemittanceId" name="key" default="" attribute="value"/>
 	<PARAMETER id="window" name="window" default="" attribute="value"/>
-	<PARAMETER id="paramMessage" name="message" default="" attribute="onload" replace="xx();"/>
 	<SUBREPORT id="reportTyperemittance" name="reportTyperemittance" report="org/openbravo/erpCommon/reference/List">
 		<ARGUMENT name="parameterListSelected"/>
 	</SUBREPORT>
@@ -30,5 +29,8 @@
 	<PARAMETER id="paramCSS" name="theme" attribute="href" replace="Default"/>
 	<PARAMETER id="processDescription" name="description" replaceCharacters="htmlHelp" default=""/>
 	<PARAMETER id="processHelp" name="help" replaceCharacters="htmlHelp" default=""/>
+	<PARAMETER id="messageBoxID" name="messageType" attribute="class" replace="yy" default="HIDDEN"/>
+	<PARAMETER id="messageBoxIDTitle" name="messageTitle" default=""/>
+	<PARAMETER id="messageBoxIDMessage" name="messageMessage" default=""/>
 	<DISCARD id="discard"/>
 </REPORT>