[newupgrade] Final changes in Improved Upgrade Process
authorAntonio Moreno <antonio.moreno@openbravo.com>
Tue, 24 Nov 2009 18:48:35 +0100
changeset 5603 ac876221d3c1
parent 5602 09951eb2df99
child 5604 c255da3a3e6b
[newupgrade] Final changes in Improved Upgrade Process
build.xml
src-db/database/build.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src-wad/src/org/openbravo/wad/Wad.java
src/build.xml
src/org/openbravo/base/SystemStatusListener.java
src/org/openbravo/base/SystemStatusListener_data.xsql
src/org/openbravo/base/secureApp/HttpSecureAppServlet.java
src/org/openbravo/base/secureApp/LoginHandler.java
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
src/org/openbravo/erpCommon/ad_forms/ModuleManagement_data.xsql
src/org/openbravo/erpCommon/ad_forms/Role.java
src/org/openbravo/erpCommon/ad_process/ApplyModules.html
src/org/openbravo/erpCommon/ad_process/ApplyModules.java
src/org/openbravo/erpCommon/ad_process/ApplyModules.xml
src/org/openbravo/erpCommon/ad_process/ApplyModulesNew.html
src/org/openbravo/erpCommon/ad_process/ApplyModulesNew.xml
src/org/openbravo/erpCommon/ad_process/ApplyModules_data.xsql
src/org/openbravo/erpCommon/ad_process/RestartTomcat.html
src/org/openbravo/erpCommon/ad_process/RestartTomcat.xml
src/org/openbravo/erpCommon/modules/ApplyModule.java
--- a/build.xml	Tue Nov 24 10:27:25 2009 +0100
+++ b/build.xml	Tue Nov 24 18:48:35 2009 +0100
@@ -309,7 +309,6 @@
     <CheckSumCondition obDir="${basedir}"
                            type="md5.wad"
                            property="test.md5.wad"/>
-    <antcall target="update.finalcompile.status" />
   </target>
 
   <target name="compile.complete.development" depends="init" if="mode.class">
@@ -626,13 +625,11 @@
   </target>
 
   <target name="db.apply.modules" if="apply.modules.on.create">
-    <echo message="applying modules" />    
     <antcall inheritall="true" inheritrefs="true" target="apply.module" />
   </target>
 
   <target name="db.apply.modules.sampledata" if="apply.modules.on.create">
     <antcall target="generate.entities" />
-    <echo message="applying modules" />    
     <antcall inheritall="true" inheritrefs="true" target="apply.module" />
     <antcall target="import.sample.data" />
     <antcall target="load.logoimages" />
@@ -640,7 +637,6 @@
 
 
   <target name="apply.modules">
-    <echo>Applying ${module} modules...</echo>
     <antcall target="update.database.mod" />
 
     <antcall target="update.generate.entities.status" inheritall="true" inheritrefs="true"/>
@@ -657,6 +653,8 @@
     </condition>
     
     <antcall target="apply.modules.compile"/>
+    <ant dir="${base.db}" target="setApplied.${bbdd.rdbms}" inheritAll="true" inheritRefs="true" />
+     
   </target>
   
   <target name="apply.module.forked">
--- a/src-db/database/build.xml	Tue Nov 24 10:27:25 2009 +0100
+++ b/src-db/database/build.xml	Tue Nov 24 18:48:35 2009 +0100
@@ -450,6 +450,36 @@
     </sql>
   </target>
 
+  <target name="setApplied.ORACLE">
+    <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="abort" autocommit="true">
+      <classpath>
+        <fileset dir="${base.lib}">
+          <include name="**/*.jar">
+          </include>
+        </fileset>
+      </classpath>
+      <transaction>
+          UPDATE AD_MODULE SET STATUS='A',ISINDEVELOPMENT='N' WHERE STATUS='P';
+          DELETE FROM AD_MODULE WHERE STATUS = 'U';
+      </transaction>
+    </sql>
+  </target>
+
+  <target name="setApplied.POSTGRE">
+    <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="abort" autocommit="true">
+      <classpath>
+        <fileset dir="${base.lib}">
+          <include name="**/*.jar">
+          </include>
+        </fileset>
+      </classpath>
+      <transaction>
+          UPDATE AD_MODULE SET STATUS='A',ISINDEVELOPMENT='N' WHERE STATUS='P';
+          DELETE FROM AD_MODULE WHERE STATUS = 'U';
+      </transaction>
+    </sql>
+  </target>
+  
   <target name="update.customized.database">
     <altercustomizeddatabasedata driver="${bbdd.driver}" url="${bbdd.owner.url}" user="${bbdd.user}" excludeobjects="com.openbravo.db.OpenbravoExcludeFilter" password="${bbdd.password}" filter="com.openbravo.db.OpenbravoMetadataFilter" model="model" orgModel="../originalDatabase/model" data="${basedir}/sourcedata" orgData="${basedir}/../originalDatabase/sourcedata" verbosity="${bbdd.verbosity}" />
     <antcall target="database.postcreate.${bbdd.rdbms}" />
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Nov 24 10:27:25 2009 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Nov 24 18:48:35 2009 +0100
@@ -64064,6 +64064,17 @@
 <!--57901FDF810046F3A5C6DFCC31C0665E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--57901FDF810046F3A5C6DFCC31C0665E--></AD_MESSAGE>
 
+<!--584FAADEFE06422E988159E2B3800F3B--><AD_MESSAGE>
+<!--584FAADEFE06422E988159E2B3800F3B-->  <AD_MESSAGE_ID><![CDATA[584FAADEFE06422E988159E2B3800F3B]]></AD_MESSAGE_ID>
+<!--584FAADEFE06422E988159E2B3800F3B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--584FAADEFE06422E988159E2B3800F3B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--584FAADEFE06422E988159E2B3800F3B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--584FAADEFE06422E988159E2B3800F3B-->  <VALUE><![CDATA[Restart_Tomcat]]></VALUE>
+<!--584FAADEFE06422E988159E2B3800F3B-->  <MSGTEXT><![CDATA[Restart Tomcat]]></MSGTEXT>
+<!--584FAADEFE06422E988159E2B3800F3B-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--584FAADEFE06422E988159E2B3800F3B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--584FAADEFE06422E988159E2B3800F3B--></AD_MESSAGE>
+
 <!--59E27235F1D1402B9DC1E9EE5BC64814--><AD_MESSAGE>
 <!--59E27235F1D1402B9DC1E9EE5BC64814-->  <AD_MESSAGE_ID><![CDATA[59E27235F1D1402B9DC1E9EE5BC64814]]></AD_MESSAGE_ID>
 <!--59E27235F1D1402B9DC1E9EE5BC64814-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-wad/src/org/openbravo/wad/Wad.java	Tue Nov 24 10:27:25 2009 +0100
+++ b/src-wad/src/org/openbravo/wad/Wad.java	Tue Nov 24 18:48:35 2009 +0100
@@ -325,8 +325,9 @@
       if (dirWebClients != null && !dirWebClients.equals("")) {
         fileWebXmlClient = new File(dirWebClients);
         if (!fileWebXmlClient.exists()) {
-          log4j.warn("No such directory: " + fileWebXmlClient.getAbsoluteFile());
           fileWebXmlClient = null;
+        } else {
+          log4j.info("srcClient folder found.");
         }
       }
 
--- a/src/build.xml	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/build.xml	Tue Nov 24 18:48:35 2009 +0100
@@ -327,7 +327,6 @@
 	  <antcall inheritall="true" target="calculate.instance.version"/>
 	</target>
 	<target name="calculate.instance.version" depends="calculate.version.from.hg, calculate.version.from.file">
-		<echo message="Instance version: ${instance.version}"/>
 	    <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" delimiter="/">
 	      <classpath>
 	        <fileset dir="${base.lib}">
@@ -780,7 +779,7 @@
   <target name="update.finalcompile.status" >
       	<sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
       	  	       <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-      	  	       <transaction> UPDATE ad_system_info SET system_status='RB50' ;
+      	  	       <transaction> UPDATE ad_system_info SET system_status='RB51' ;
                      DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
       	</sql>
   </target>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/base/SystemStatusListener.java	Tue Nov 24 18:48:35 2009 +0100
@@ -0,0 +1,29 @@
+package org.openbravo.base;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletException;
+
+import org.jfree.util.Log;
+import org.openbravo.database.ConnectionProvider;
+
+public class SystemStatusListener implements ServletContextListener {
+
+  @Override
+  public void contextDestroyed(ServletContextEvent arg0) {
+
+  }
+
+  @Override
+  public void contextInitialized(ServletContextEvent sce) {
+    ConnectionProvider cp = ConnectionProviderContextListener.getPool(sce.getServletContext());
+    try {
+      String st = SystemStatusListenerData.getSystemStatus(cp);
+      if (st.equals("RB60") || st.equals("RB50"))
+        SystemStatusListenerData.setSystemStatus(cp, "RB70");
+    } catch (ServletException e) {
+      Log.error("Error while updating system status", e);
+    }
+
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/base/SystemStatusListener_data.xsql	Tue Nov 24 18:48:35 2009 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SL 
+ * All portions are Copyright (C) 2009 Openbravo SL 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+-->
+
+
+
+<SqlClass name="SystemStatusListenerData" package="org.openbravo.base">
+
+   <SqlMethod name="getSystemStatus" type="preparedStatement" return="String">
+      <SqlMethodComment>Gets the system status value, from Ad_System_Info table</SqlMethodComment>
+      <Sql>
+        SELECT SYSTEM_STATUS 
+        FROM AD_SYSTEM_INFO 
+      </Sql>
+   </SqlMethod>
+   
+   <SqlMethod name="setSystemStatus" type="preparedStatement" return="rowCount">
+      <SqlMethodComment>Sets the system status value, from Ad_System_Info table</SqlMethodComment>
+      <Sql>
+        UPDATE AD_SYSTEM_INFO
+        SET SYSTEM_STATUS = ?
+      </Sql>
+      <Parameter name="systemStatus"/>
+   </SqlMethod>
+
+</SqlClass>
--- a/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Tue Nov 24 18:48:35 2009 +0100
@@ -52,6 +52,7 @@
 import org.openbravo.base.HttpBaseServlet;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
 import org.openbravo.data.FieldProvider;
 import org.openbravo.erpCommon.obps.ActivationKey;
 import org.openbravo.erpCommon.obps.ActivationKey.LicenseRestriction;
@@ -61,6 +62,7 @@
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.PrintJRData;
 import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.model.ad.system.SystemInformation;
 import org.openbravo.utils.FileUtility;
 import org.openbravo.utils.Replace;
 import org.openbravo.xmlEngine.XmlDocument;
@@ -206,11 +208,14 @@
           String strOrg = "";
           String strWarehouse = "";
 
+          SystemInformation sysInfo = OBDal.getInstance().get(SystemInformation.class, "0");
+          boolean correctSystemStatus = sysInfo.getSystemStatus() == null
+              || sysInfo.getSystemStatus().equals("RB70");
           ActivationKey ak = new ActivationKey();
           LicenseRestriction limitation = ak.checkOPSLimitations(variables.getDBSession());
           if (limitation == LicenseRestriction.OPS_INSTANCE_NOT_ACTIVE
               || limitation == LicenseRestriction.NUMBER_OF_CONCURRENT_USERS_REACHED
-              || limitation == LicenseRestriction.MODULE_EXPIRED) {
+              || limitation == LicenseRestriction.MODULE_EXPIRED || !correctSystemStatus) {
             // it is only allowed to log as system administrator
             strRole = DefaultOptionsData.getDefaultSystemRole(this, strUserAuth);
             if (strRole == null || strRole.equals("")) {
--- a/src/org/openbravo/base/secureApp/LoginHandler.java	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/base/secureApp/LoginHandler.java	Tue Nov 24 18:48:35 2009 +0100
@@ -125,7 +125,8 @@
           || this.globalParameters.getOBProperty("safe.mode", "false").equalsIgnoreCase("false")) {
         // Last build went fine and tomcat was restarted. We should login as usual
         goToTarget(res, vars);
-      } else if (sysInfo.getSystemStatus().equals("RB60")) {
+      } else if (sysInfo.getSystemStatus().equals("RB60")
+          || sysInfo.getSystemStatus().equals("RB50")) {
         String msg = Utility.messageBD(myPool, "TOMCAT_NOT_RESTARTED", vars.getLanguage());
         String title = Utility.messageBD(myPool, "TOMCAT_NOT_RESTARTED_TITLE", vars.getLanguage());
         goToRetry(res, vars, msg, title, "Warning", "../security/Menu.html");
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java	Tue Nov 24 18:48:35 2009 +0100
@@ -254,6 +254,14 @@
             + Utility.messageBD(this, "RebuildNow", lang) + "</a>";
         return rt;
       }
+      String restartTomcat = ModuleManagementData.selectRestartTomcat(this);
+      // Check if last build was done but Tomcat wasn't restarted
+      if (!restartTomcat.equals("0")) {
+        rt = "<a class=\"LabelLink_noicon\" href=\"#\" onclick=\"openServletNewWindow('TOMCAT', false, '../ad_process/ApplyModules.html', 'BUTTON', null, true, 650, 900);return false;\">"
+            + Utility.messageBD(this, "Restart_Tomcat", lang) + "</a>";
+        return rt;
+
+      }
 
       // Check for updates
       total = ModuleManagementData.selectUpdate(this);
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_data.xsql	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_data.xsql	Tue Nov 24 18:48:35 2009 +0100
@@ -76,12 +76,21 @@
          SELECT COUNT(*) AS TOTAL
            FROM (SELECT 1 
                    FROM AD_MODULE 
-                  WHERE STATUS IN ('I','U')
+                  WHERE STATUS IN ('I','U','P')
                   UNION ALL
                  SELECT 1
                    FROM AD_MODULE_INSTALL) A
       </Sql>
    </SqlMethod>
+   
+   <SqlMethod name="selectRestartTomcat" type="preparedStatement" return="string">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql>
+         SELECT COUNT(*) AS TOTAL
+           FROM AD_SYSTEM_INFO WHERE SYSTEM_STATUS='RB60'
+      </Sql>
+   </SqlMethod>
+   
    <SqlMethod name="selectUpdate" type="preparedStatement" return="string">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
--- a/src/org/openbravo/erpCommon/ad_forms/Role.java	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/Role.java	Tue Nov 24 18:48:35 2009 +0100
@@ -33,10 +33,12 @@
 import org.openbravo.base.secureApp.LoginUtils;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.obps.ActivationKey;
 import org.openbravo.erpCommon.obps.ActivationKey.LicenseRestriction;
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.model.ad.system.SystemInformation;
 import org.openbravo.utils.FormatUtilities;
 import org.openbravo.xmlEngine.XmlDocument;
 
@@ -190,10 +192,13 @@
     RoleComboData[] datarole = null;
     try {
       ActivationKey ak = new ActivationKey();
+      SystemInformation sysInfo = OBDal.getInstance().get(SystemInformation.class, "0");
+      boolean correctSystemStatus = sysInfo.getSystemStatus() == null
+          || sysInfo.getSystemStatus().equals("RB70");
       LicenseRestriction limitation = ak.checkOPSLimitations(vars.getDBSession());
       if (limitation == LicenseRestriction.OPS_INSTANCE_NOT_ACTIVE
           || limitation == LicenseRestriction.NUMBER_OF_CONCURRENT_USERS_REACHED
-          || limitation == LicenseRestriction.MODULE_EXPIRED) {
+          || limitation == LicenseRestriction.MODULE_EXPIRED || !correctSystemStatus) {
         // allow only system login
         datarole = RoleComboData.selectSystem(this, vars.getUser());
       } else {
--- a/src/org/openbravo/erpCommon/ad_process/ApplyModules.html	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_process/ApplyModules.html	Tue Nov 24 18:48:35 2009 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2008-2009 Openbravo SL 
+ * All portions are Copyright (C) 2009 Openbravo SL 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -28,49 +28,363 @@
   <script language="JavaScript" src="../../../../../web/js/dojoConfig.js" type="text/javascript"></script>
   <script language="JavaScript" src="../../../../../web/js/dojo/dojo.js" type="text/javascript"></script>
   <script language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></script>
-  <script language="JavaScript" src="../utility/DynamicJS.js" type="text/javascript"></script>
   <script language="JavaScript" src="../../../../../web/js/default/MessageBox.js" type="text/javascript"></script>
-  <script language="JavaScript" type="text/javascript" id="paramLanguage">defaultLang = "en_US";</script>
+  <script language="JavaScript" type="text/javascript" id="paramLanguage"></script>
   <script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
   <script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
-  <script type="text/javascript">
-    dojo.hostenv.writeIncludes(); //makes debugging in Venkman possible
-  </script>
-  <script language="JavaScript" type="text/javascript" id="paramDirectory">
-    var baseDirectory="../../../../../web/";
-  </script>
+  <script language="JavaScript" type="text/javascript" id="paramDirectory"></script>
   <script language="JavaScript" type="text/javascript">
     function closeThisPage() {
       window.close();
       return true;
     }
   </script>
+  <script language="JavaScript" type="text/javascript">
+    var lc_isChronoEnabled = true;
+    var current_state=0;
+    var possible_states=[11,12,13,14,15,21,31,41,42,43,44,45,51,60];
+    var error_status=['','','','','','','','','','','','','',''];
+    var numofwarns=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
+    var numoferrs=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
+    var warnings=[];
+    var errors=[];
+    var start=false;
+    var mainTimeout;
 
-  <script language="JavaScript" type="text/javascript">
+    
     function restart() {
-      if (document.frmMain.option[0].checked) {
-        window.opener.submitCommandForm('RESTART', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
-        closeThisPage();
-        return false;
-      } else if (document.frmMain.option[1].checked) {
-        window.opener.submitCommandForm('RELOAD', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
-        closeThisPage();
-        return false;
-      } else if (document.frmMain.option[2].checked) {
-        closeThisPage();
-      }
-    } 
-  
-    function setMessage(text){
-      messageResponse(text);
+        if (document.frmMain.option[0].checked) {
+          window.opener.submitCommandForm('RESTART', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
+          closeThisPage();
+          return false;
+        } else if (document.frmMain.option[1].checked) {
+          window.opener.submitCommandForm('RELOAD', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
+          closeThisPage();
+          return false;
+        } else if (document.frmMain.option[2].checked) {
+          closeThisPage();
+        }
+      } 
+
+    function getError1(paramXMLParticular, XMLHttpRequestObj) {
+        var strText = "";
+        if (getReadyStateHandler(XMLHttpRequestObj,null,false)) {
+          try {
+            if (XMLHttpRequestObj.responseText) strText = XMLHttpRequestObj.responseText;
+          } catch (e) {
+            initialize_MessageBox('messageBoxID');
+            setValues_MessageBox('messageBoxID','ERROR','ERROR',e);
+          }
+          if (strText == "") {
+            showJSMessage(22);
+          } else {
+            //Expecting msg in JSON format
+            var msg = eval("("+strText+")");;
+            initialize_MessageBox('messageBoxID');
+            setValues_MessageBox('messageBoxID',msg.OBError.type, msg.OBError.title, msg.OBError.message);
+            if(msg.OBError.type!="Error"){
+                displayLogicElement('restartOptions',true);
+            }
+            document.getElementById("rebuildMessage").style.display = "none";
+          }
+        }
+        return true;
+    }
+      
+    
+    function getError() {
+      var frm = document.frmMain;
+      var paramXMLReq = null;
+      return submitXmlHttpRequest(getError1, frm, "GETERR", "ApplyModules.html", false, null, paramXMLReq);
     }
     
-    function addText(text) {
-      var element = document.getElementById('log');
-      element.innerHTML = text;
-      element.scrollTop = element.scrollHeight - element.clientHeight;
+    function finalize() {
+      processing = false;
+      top.opener.setProcessingMode('window', false);
+      
+      setTimeout("getError()",100);
     }
-  
+    
+    function endProcess(paramXMLParticular, XMLHttpRequestObj) {
+        var strText = "";
+        var id = "";
+        var imageId = "";
+        if (getReadyStateHandler(XMLHttpRequestObj)) finalize();
+        return true;
+    }
+    
+    function startProcessing() {
+      startLocalChrono('localChrono');
+      processing = true;
+      top.opener.setProcessingMode('window', true, false);
+      var frm = document.frmMain;
+      displayLogicElement('confirmation',false);
+      displayLogicElement('rebuildTable',true);
+      var paramXMLReq = null;
+      return submitXmlHttpRequest(endProcess, frm, "STARTAPPLY", "ApplyModules.html", false, null, paramXMLReq);
+    }
+    
+    function stopLocalChrono() {
+      lc_isChronoEnabled = false;
+    }
+
+    function startLocalChrono(destiny) {
+      var referenceDate = new Date();
+      referenceDate = referenceDate.getTime();
+      LocalChrono(destiny, referenceDate);
+    }
+
+    function getStatusIndex(state){
+      for(i=0;i<possible_states.length;i++){
+          if(possible_states[i]==state){
+              return i;
+          }
+      }
+    }
+
+    function askForErrorStatus(paramXMLParticular, XMLHttpRequestObj) {
+    	var strText = "";
+        if (getReadyStateHandler(XMLHttpRequestObj,null,false)) {
+          try {
+            if (XMLHttpRequestObj.responseText) strText = XMLHttpRequestObj.responseText;
+          } catch (e) {
+          }
+
+          if(start==true){
+            var msg = eval("("+strText+")");
+            
+            var state=msg.Response.state;
+            var errorStatus=msg.Response.statusofstate;
+            var stateindex=getStatusIndex(state);
+            progList_changeStatus(correspondingNode(state), errorStatus);
+            error_status[stateindex]=errorStatus;
+            insertWarnsAndErrors(msg.Response);
+          }
+
+          var ind11=getStatusIndex(11);
+          if(error_status[ind11]=='Success' && error_status[ind11+1]=='Success' && error_status[ind11+2]=='Success' && error_status[ind11+3]=='Success' && error_status[ind11+4]=='Success'){
+              progList_changeStatus('1', 'Success');
+          }else if(error_status[ind11]=='Error' || error_status[ind11+1]=='Error'|| error_status[ind11+2]=='Error'|| error_status[ind11+3]=='Error'|| error_status[ind11+4]=='Error'){
+              progList_changeStatus('1', 'Error');
+          }else if(error_status[ind11]=='Warning' || error_status[ind11+1]=='Warning'|| error_status[ind11+2]=='Warning'|| error_status[ind11+3]=='Warning'|| error_status[ind11+4]=='Warning'){
+              progList_changeStatus('1', 'Warning');
+          }
+          var ind41=getStatusIndex(41);
+          if(error_status[ind41]=='Success' && error_status[ind41+1]=='Success' && error_status[ind41+2]=='Success' && error_status[ind41+3]=='Success' && error_status[ind41+4]=='Success'){
+              progList_changeStatus('4', 'Success');
+          }else if(error_status[ind41]=='Error' || error_status[ind41+1]=='Error'|| error_status[ind41+2]=='Error'|| error_status[ind41+3]=='Error'|| error_status[ind41+4]=='Error'){
+              progList_changeStatus('4', 'Error');
+          }else if(error_status[ind41]=='Warning' || error_status[ind41+1]=='Warning'|| error_status[ind41+2]=='Warning'|| error_status[ind41+3]=='Warning'|| error_status[ind41+4]=='Warning'){
+              progList_changeStatus('4', 'Warning');
+          }
+        }
+    }
+
+    function correspondingNode(state_index){
+        state_index=parseFloat(state_index)/10;
+        return state_index.toString();
+    }
+
+    
+    function insertWarnsAndErrors(response){
+        if(start==true){
+	        if(response.statusofstate=="Warning"){
+	            var warns=response.warnings.string;
+	            if(warns!=null){
+	                if(!(warns instanceof Array)){
+	                    warns=[warns];
+	                }
+	                if(numofwarns[getStatusIndex(response.state)]<warns.length){
+	                    for(i=numofwarns[getStatusIndex(response.state)];i<warns.length;i++){
+	                    	    var old=document.getElementById("warning_"+correspondingNode(response.state)).title;
+	                    	    if(old===""){
+		                    	    old="Warnings: ";
+	                    	    }else{
+		                    	    old+=",";
+	                    	    }
+	                    	    document.getElementById("warning_"+correspondingNode(response.state)).title=old+warns[i];
+	                            warnings.push(warns[i]);
+	                            progList_addTextToTextArea('<i>Warning: </i>'+warns[i]);
+	                    }
+	                    numofwarns[getStatusIndex(response.state)]=warns.length;
+	                }
+	            }
+	        }
+	        if(response.statusofstate=="Error"){
+	            var errs=response.errors.string;
+	            if(errs!=null){
+	                if(!(errs instanceof Array)){
+	                    errs=[errs];
+	                }
+	                if(numoferrs[getStatusIndex(response.state)]<errs.length){
+	                    for(i=numoferrs[getStatusIndex(response.state)];i<errs.length;i++){
+	                            warnings.push(errs[i]);
+	                            progList_addTextToTextArea('<b>Error: </b>'+errs[i]);
+	                    }
+	                    numoferrs[getStatusIndex(response.state)]=errs.length;
+	                }
+	            }
+	        }
+        }
+    }
+    
+    function update(paramXMLParticular, XMLHttpRequestObj) {
+    	var strText = "";
+        if (getReadyStateHandler(XMLHttpRequestObj,null,false)) {
+          try {
+            if (XMLHttpRequestObj.responseText) strText = XMLHttpRequestObj.responseText;
+          } catch (e) {
+          }
+
+          var msg = eval("("+strText+")");
+          
+          var state=msg.Response.state;
+          if(state=="11" || start==true){
+             if(state=="60"){
+                 clearTimeout(mainTimeout);
+             }
+             start=true;
+	         var errorStatus=msg.Response.statusofstate;
+	         var stateindex=getStatusIndex(state);
+	         if(stateindex>current_state){
+	           for(i=current_state;i<stateindex;i++){
+	               //We need to ask for warning/error state for the intermediate status
+	               document.getElementById("reqStatus").value=possible_states[i];
+	               submitXmlHttpRequest(askForErrorStatus, frmMain, "REQUESTERRORSTATE", "ApplyModules.html", false, null, null);
+	           }
+	         }
+	         
+	         error_status[getStatusIndex(state)]=errorStatus;
+	         var message;
+	         if(msg.Response.lastmessage!=null){
+		         message=msg.Response.lastmessage.substring(0,50);
+	         }else{
+		         message="";
+	         }
+	         
+             insertWarnsAndErrors(msg.Response);
+             if(state!="60"){
+            	  progList_changeStatus(correspondingNode(state), errorStatus, message);
+             }
+	         
+	         current_state=stateindex;
+	      
+          }
+          
+        }
+    }
+
+    function LocalChrono(destiny, referenceDate) {
+      var actualDate = new Date();
+      actualDate = actualDate.getTime();
+
+      var difDate = actualDate - referenceDate;
+      difDate = difDate / 1000;
+      difDate = Math.floor(difDate);
+
+      var seconds = difDate%60;
+      var minutes = Math.floor(difDate/60);
+
+      var seconds_string = seconds.toString();
+      var minutes_string = minutes.toString();
+
+      if (seconds_string.length == 1) {
+        seconds_string = "0" + seconds_string;
+      }
+      if (minutes_string.length == 1) {
+        minutes_string = "0" + minutes_string;
+      }
+      var output = minutes_string + ":" + seconds_string;
+      document.getElementById(destiny).innerHTML=output;
+
+
+      submitXmlHttpRequest(update, frmMain, "UPDATESTATUS", "ApplyModules.html", false, null, null);
+      
+
+      if (lc_isChronoEnabled) {
+        mainTimeout=setTimeout(function() {LocalChrono(destiny, referenceDate);},1000);
+      }
+    }
+
+    function progList_changeStatus(node, newStatus, text) {
+	      node=node.toString();
+	      if (newStatus == "Success") {
+	        document.getElementById("icon_" + node).className = "CheckList_Icon_Success";
+	        document.getElementById("processing_" + node).innerHTML = " ";
+	        document.getElementById("processing_" + node).style.display = "none";
+	        document.getElementById("error_" + node).style.display = "none";
+	        document.getElementById("exception_" + node).style.display = "none";
+	        document.getElementById("warning_" + node).style.display = "none";
+	      } else if (newStatus == "Error") {
+	        document.getElementById("icon_" + node).className = "CheckList_Icon_Error";
+	        document.getElementById("processing_" + node).innerHTML = " ";
+	        document.getElementById("processing_" + node).style.display = "none";
+	        document.getElementById("error_" + node).style.display = "";
+	        document.getElementById("exception_" + node).style.display = "none";
+	        document.getElementById("warning_" + node).style.display = "none";
+	      } else if (newStatus == "Exception") {
+	        document.getElementById("icon_" + node).className = "CheckList_Icon_Exception";
+	        document.getElementById("processing_" + node).innerHTML = " ";
+	        document.getElementById("processing_" + node).style.display = "none";
+	        document.getElementById("error_" + node).style.display = "none";
+	        document.getElementById("exception_" + node).style.display = "";
+	        document.getElementById("warning_" + node).style.display = "none";
+	      } else if (newStatus == "Warning") {
+	        document.getElementById("icon_" + node).className = "CheckList_Icon_Warning";
+	        document.getElementById("processing_" + node).innerHTML = " ";
+	        document.getElementById("processing_" + node).style.display = "none";
+	        document.getElementById("error_" + node).style.display = "none";
+	        document.getElementById("exception_" + node).style.display = "none";
+	        document.getElementById("warning_" + node).style.display = "";
+	      } else if (newStatus == "Pending") {
+	        document.getElementById("icon_" + node).className = "CheckList_Icon_Pending";
+	        document.getElementById("processing_" + node).innerHTML = " ";
+	        document.getElementById("processing_" + node).style.display = "none";
+	        document.getElementById("error_" + node).style.display = "none";
+	        document.getElementById("exception_" + node).style.display = "none";
+	        document.getElementById("warning_" + node).style.display = "none";
+	      } else if (newStatus == "Processing") {
+	        document.getElementById("icon_" + node).className = "CheckList_Icon_Processing";
+	        if (text) {
+	          document.getElementById("processing_" + node).innerHTML = text;
+	        } else {
+	          document.getElementById("processing_" + node).innerHTML = " ";
+	        }
+	        document.getElementById("processing_" + node).style.display = "";
+	        document.getElementById("error_" + node).style.display = "none";
+	        document.getElementById("exception_" + node).style.display = "none";
+	        document.getElementById("warning_" + node).style.display = "none";
+	      }
+    }
+
+    function progList_setTextToTextArea(text) {
+      document.getElementById('warningsAndErrors').innerHTML = text;
+    }
+
+    function progList_addTextToTextArea(text) {
+      document.getElementById('warningsAndErrors').innerHTML += text+"<br>";
+    }
+
+    function resetAllStates(){
+        progList_changeStatus('1', 'Pending');
+        progList_changeStatus('1.1', 'Pending');
+        progList_changeStatus('1.2', 'Pending');
+        progList_changeStatus('1.3', 'Pending');
+        progList_changeStatus('1.4', 'Pending');
+        progList_changeStatus('1.5', 'Pending');
+        progList_changeStatus('2.1', 'Pending');
+        progList_changeStatus('3.1', 'Pending');
+        progList_changeStatus('4', 'Pending');
+        progList_changeStatus('4.1', 'Pending');
+        progList_changeStatus('4.2', 'Pending');
+        progList_changeStatus('4.3', 'Pending');
+        progList_changeStatus('4.4', 'Pending');
+        progList_changeStatus('5', 'Pending');
+    }
+
+  </script>
+    <script language="JavaScript" type="text/javascript">
+
     function onLoadDo() {
       this.windowTables = new Array(
         new windowTableId('client', 'buttonOK')
@@ -81,7 +395,7 @@
 
       setWindowElementFocus('firstElement');
       displayLogicElement('confirmation',true);
-      displayLogicElement('log',false);
+      displayLogicElement('rebuildTable',false);
       displayLogicElement('restartOptions',false);
     }
 
@@ -97,72 +411,20 @@
 
     var processing = false;
 
-    function getError1(paramXMLParticular, XMLHttpRequestObj) {
-     var strText = "";
-      if (getReadyStateHandler(XMLHttpRequestObj)) {
-        try {
-          if (XMLHttpRequestObj.responseText) {
-            strText = XMLHttpRequestObj.responseText;
-            if (strText != "") setMessage(strText);
-            else alert("OK");
-          }
-        } catch (e) {
-        }
-      }
-      return true;
-    }
-    
-    function getError() {
-      var frm = document.frmMain;
-      var paramXMLReq = null;
-      return submitXmlHttpRequest(getError1, frm, "GETERR", "ApplyModules.html", false, null, paramXMLReq);
-    }
-    
-    function finalize() {
-      processing = false;
-      top.opener.setProcessingMode('window', false);
-      displayLogicElement('restartOptions',true);
-      //document.getElementById('buttonOK').setAttribute('onclick','window.opener.submitCommandForm("DEFAULT", false, null, "ModuleManagement.html", "_self", null, true);closeThisPage();return false;');
-      
-      setTimeout("getError()",100);
-    }
-    
-    function endProcess(paramXMLParticular, XMLHttpRequestObj) {
-      var strText = "";
-      var id = "";
-      var imageId = "";
-      try {
-        if (XMLHttpRequestObj != null && XMLHttpRequestObj.responseText) {
-          strText = XMLHttpRequestObj.responseText
-          addText(strText);
-        }
-      } catch (e) {}
-      if (getReadyStateHandler(XMLHttpRequestObj)) finalize();
-      return true;
-    }
-    
-    function startProcessing() {
-      processing = true;
-      top.opener.setProcessingMode('window', true, false);
-      var frm = document.frmMain;
-      //displayLogicElement('buttonOK',false);
-      //displayLogicElement('buttonCancel',false);
-      displayLogicElement('confirmation',false);
-      displayLogicElement('log',true);
-      var paramXMLReq = null;
-      return submitXmlHttpRequest(endProcess, frm, "STARTAPPLY", "ApplyModules.html", false, null, paramXMLReq);
-    }
-  </script>
+</script>
 </head>
-<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"  onload="onLoadDo();" onunload="onUnloadDo();" id="paramMessage">
+<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="onLoadDo();" onunload="onUnloadDo();" id="paramMessage">
   <form id="form" method="post" action="ApplyModules.html" name="frmMain" target="hiddenFrame">
     <input type="hidden" name="Command"></input>
     <input type="hidden" name="IsPopUpCall" value="1"></input>
     <input type="hidden" name="inpLastFieldChanged"></input>
     <input type="hidden" name="inpSelected" id="paramSelected" value=""></input>
+    <input type="hidden" name="reqStatus" id="reqStatus" value=""></input>
+    <input type="hidden" name="logfile" id="logfile" value="xx"></input>
     <div class="Popup_ContentPane_CircleLogo">
+
       <div class="Popup_WindowLogo">
-        <img class="Popup_WindowLogo_Icon Popup_WindowLogo_Icon_process" src="../../../../../web/images/blank.gif" border=0/></img>
+        <img class="Popup_WindowLogo_Icon Popup_WindowLogo_Icon_process" src="../web/images/blank.gif" border="0/"></img>
       </div>
     </div>
 
@@ -171,14 +433,16 @@
       <tr>
         <td>
           <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_NavBar">
+
             <tr class="Popup_NavBar_bg"><td></td>
               <td class="Popup_NavBar_separator_cell"></td>
               <td class="Popup_NavBar_bg_logo_left"></td>
-              <td class="Popup_NavBar_bg_logo" width="1" onclick="openNewBrowser('http://www.openbravo.com', 'Openbravo');return false;"><img src="../../../../../web/images/blank.gif" alt="Openbravo" title="Openbravo" border="0" id="openbravoLogo" class="Popup_NavBar_logo" /></td>
+              <td class="Popup_NavBar_bg_logo" width="1" onclick="openNewBrowser('http://www.openbravo.com', 'Openbravo');return false;"><img src="../web/images/blank.gif" alt="Openbravo" title="Openbravo" border="0" id="openbravoLogo" class="Popup_NavBar_logo"></img></td>
               <td class="Popup_NavBar_bg_logo_right"></td>
               <td class="Popup_NavBar_Popup_title_cell"><span>Rebuild the System</span></td>
               <td class="Popup_NavBar_separator_cell"></td>
             </tr>
+
           </table>
         </td>
       </tr>
@@ -188,33 +452,24 @@
           <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_SeparatorBar">
             <tr>
               <td class="Popup_SeparatorBar_bg"></td>
+
             </tr>
           </table>
         </td>
       </tr>
       <tr>
         <td>
-          <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_InfoBar">
-            <tr>
-              <td class="Popup_InfoBar_Icon_cell"><img src="../../../../../web/images/blank.gif" border="0" class="Popup_InfoBar_Icon_info" /></td>
-              <td class="Popup_InfoBar_text_table">
-                <table>
-                  <tr>
-                    <td class="Popup_InfoBar_text" id="helpDiscard"> <div id="processHelp">&nbsp;</div></td>
-                  </tr>
-                </table>
-              </td>
-            </tr>
-          </table>
+          
         </td>
       </tr>
       <tr>
         <td>
           <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client">
-            <!-- MessageBox -->
-            <table cellpadding="0" cellspacing="0" id="messageBoxID" class="MessageBoxyy">
+            
+            <table cellpadding="0" cellspacing="0" id="messageBoxID" class="MessageBoxHIDDEN">
               <tbody>
                 <tr class="MessageBox_TopMargin">
+
                   <td class="MessageBox_LeftMargin"></td>
                   <td></td>
                   <td class="MessageBox_RightMargin"></td>
@@ -224,6 +479,7 @@
                   <td>
 
                     <table cellpadding="0" cellspacing="0" style="width: 100%;">
+
                       <tbody>
                         <tr>
                           <td class="MessageBox_LeftTrans">
@@ -233,6 +489,7 @@
                                 <td class="MessageBox_TopLeft"></td>
                               </tr>
                               <tr>
+
                                 <td class="MessageBox_Left"></td>
                               </tr>
                               </tbody>
@@ -242,6 +499,7 @@
 
                             <table class="MessageBox_Top">
                               <tbody>
+
                                 <tr>
                                   <td>
                                     <span>
@@ -251,19 +509,17 @@
                                             <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_TextTitle" id="messageBoxIDTitle"></div>
+                                                <div class="MessageBox_TextDescription" id="messageBoxIDMessage"></div>
                                                 <div class="MessageBox_TextSeparator"></div>
                                               </span>
                                             </td>
                                           </tr>
                                         </tbody>
+
                                       </table>
                                     </span>
                                   </td>
@@ -273,6 +529,7 @@
 
                           </td>
                           <td class="MessageBox_RightTrans">
+
                             <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
                               <tbody>
                               <tr>
@@ -282,6 +539,7 @@
                                 <td class="MessageBox_Right"></td>
                               </tr>
                               </tbody>
+
                             </table>
                           </td>
                         </tr>
@@ -291,6 +549,7 @@
                           <td class="MessageBox_BottomTrans MessageBox_bg">
                           </td>
                           <td rowspan="2" class="MessageBox_BottomRight">
+
                           </td>
                         </tr>
                         <tr>
@@ -309,9 +568,10 @@
                   <td class="MessageBox_RightMargin"></td>
                 </tr>
               </tbody>
+
             </table>
-            <!-- MessageBox END -->
-
+            
+            
             <table style="width: 550px !important;" cellspacing="0" cellpadding="0" border ="0" class="Login_Home_TableEdition" id="confirmation">
               <tr><td style="height: 20px;"></td></tr>
               <tr>
@@ -374,25 +634,23 @@
                <td></td>
              </tr>
             </table>
+            
+            <table class="Popup_Client_TablePopup" cellpadding="0" cellspacing="0" style="margin-top: 15px;" id="rebuildTable">
+              <tr>
+                <td class="TablePopup_OneCell_width"></td>
+                <td class="TablePopup_OneCell_width"></td>
+                <td class="TablePopup_OneCell_width"></td>
+                <td class="TablePopup_OneCell_width"></td>
+              </tr>
 
-            <table cellspacing="0" cellpadding="0" class="Popup_Client_TablePopup" id="logAr>
-              <tr>
-                <td class="TableEdition_OneCell_width"></td>
-                <td class="TableEdition_OneCell_width"></td>
-                <td class="TableEdition_OneCell_width"></td>
-                <td class="TableEdition_OneCell_width"></td>
-              </tr>
-   
-              <tr>
-                <tr><td height="15"></td></tr>
-                <td colspan="2">
-                  <div style="overflow: auto; width: 700px; height: 300px; background-color: white; font-family: monospace; font-size: 9pt; border: #505050 1px solid; padding-left: 10px" id="log"></div>
-                </td>
-                <td/>
-              </tr>
-              
-            </table>
-            <table class="Popup_Client_TablePopup" cellpadding="0" cellspacing="0" id="restartOptions" style="margin-top: 5px;">
+              <tr><td colspan="4">
+                <div style="overflow: auto; width: 600px;">
+                  <span id="rebuildMessage" class="CheckList_RebuildSystemWindow_title">Estimated total time for rebuild: 3-7 minutes. Elapsed time: <span id="localChrono">00:00</span>.</br> Do not close this window.</span>
+                 </div>
+              </td></tr>
+
+    
+    <tr><td><table class="Popup_Client_TablePopup" cellpadding="0" cellspacing="0" id="restartOptions" style="margin-top: 5px;">
               
               <tr><td colspan="2">
                 <div style="overflow: auto; width: 600px;">
@@ -401,13 +659,13 @@
               </td></tr>
               <tr><td height="10"></td></tr>
               <tr>
-                <td colspan="4"><span class="Radio_container_NOT_focused"><input name="option" required="true" value="restart" type="radio" checked></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Restart servlet container now <a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#restart">learn more</a></span></td>
+                <td colspan="4"><span class="Radio_container_NOT_focused"><input name="option" required="true" value="restart" type="radio" checked></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Restart servlet container now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#restart">learn more</a></span></td>
               </tr>
               <tr>
-                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="reload" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Reload the Openbravo application now <a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#reload">learn more</a></span></td>
+                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="reload" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Reload the Openbravo application now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#reload">learn more</a></span></td>
               </tr>
               <tr>
-                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="doNothing" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Don't do anything now. I will reload the Openbravo application manually later <a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#nothing">learn more</a></span></td>
+                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="doNothing" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Don't do anything now. I will reload the Openbravo application manually later &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#nothing">learn more</a></span></td>
               </tr>
 
               <tr><td height="20"></td></tr>
@@ -440,68 +698,253 @@
                 </td>
                 <td></td>
               </tr>
-            </table>
-            <!-- 
-              <tr><td style="height: 15px;"></td></tr>
+            </table></td></tr>
+              <tr><td colspan="4">
+
+
+                <div class="TextArea_FourCells_width" id="CheckList">
+                  <div style="padding: 15 5 15 5;" id="CheckListContainer">
+
+                    <div class="CheckList_Row" id="node_1">
+                      <div id="padding_1" class="CheckList_Padding_0"></div>
+                      <div id="icon_1" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                       <div class="CheckList_Text_Title" id="title_1">Database update</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_1" style="display: none;"> </div>
+                      <div class="CheckList_Text_Message_Error" id="error_1" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_1" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_1" style="display: none;">WARNING</div>
+                    </div>
+                    
+                    <div class="CheckList_Row" id="node_1.1">
+                      <div id="padding_1.1" class="CheckList_Padding_1"></div>
+                      <div id="icon_1.1" class="CheckList_Icon_Processing"></div>
+                      <div class="CheckList_Text_Container">
+                       <div class="CheckList_Text_Title" id="title_1.1">DAL initialization</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_1.1" style="display: none;"> </div>
+                      <div class="CheckList_Text_Message_Error" id="error_1.1" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_1.1" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_1.1" style="display: none;">WARNING</div>
+                    </div>
+                    
+                    <div class="CheckList_Row" id="node_1.2">
+                      <div id="padding_1.2" class="CheckList_Padding_1"></div>
+                      <div id="icon_1.2" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                       <div class="CheckList_Text_Title" id="title_1.2">Database model load</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_1.2" style="display: none;"> </div>
+                      <div class="CheckList_Text_Message_Error" id="error_1.2" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_1.2" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_1.2" style="display: none;">WARNING</div>
+                    </div>
+                    
+                    <div class="CheckList_Row" id="node_1.3">
+                      <div id="padding_1.3" class="CheckList_Padding_1"></div>
+                      <div id="icon_1.3" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                       <div class="CheckList_Text_Title" id="title_1.3">Generation of change list</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_1.3" style="display: none;"> </div>
+                      <div class="CheckList_Text_Message_Error" id="error_1.3" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_1.3" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_1.3" style="display: none;">WARNING</div>
+                    </div>
+                    
+                    <div class="CheckList_Row" id="node_1.4">
+                      <div id="padding_1.4" class="CheckList_Padding_1"></div>
+                      <div id="icon_1.4" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                       <div class="CheckList_Text_Title" id="title_1.4">Database structure update</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_1.4" style="display: none;"> </div>
+                      <div class="CheckList_Text_Message_Error" id="error_1.4" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_1.4" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_1.4" style="display: none;">WARNING</div>
+                    </div>
+                    
+                    <div class="CheckList_Row" id="node_1.5">
+                      <div id="padding_1.5" class="CheckList_Padding_1"></div>
+                      <div id="icon_1.5" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                       <div class="CheckList_Text_Title" id="title_1.5">Database data update</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_1.5" style="display: none;"> </div>
+                      <div class="CheckList_Text_Message_Error" id="error_1.5" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_1.5" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_1.5" style="display: none;">WARNING</div>
+                    </div>
+                    
+                    <div class="CheckList_Row" id="node_2.1">
+                      <div id="padding_2.1" class="CheckList_Padding_0"></div>
+                      <div id="icon_2.1" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                        <div class="CheckList_Text_Title" id="title_2.1">Entity generation</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_2.1" style="display: none;"> </div>
+                      <div class="CheckList_Text_Message_Error" id="error_2.1" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_2.1" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_2.1" style="display: none;">WARNING</div>
+                    </div>
+
+                    <div class="CheckList_Row" id="node_3.1">
+                      <div id="padding_3.1" class="CheckList_Padding_0"></div>
+                      <div id="icon_3.1" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                        <div class="CheckList_Text_Title" id="title_3.1">Reference data and translation info loading</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_3.1" style="display: none;"> </div>
+                      <div class="CheckList_Text_Message_Error" id="error_3.1" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_3.1" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_3.1" style="display: none;">WARNING</div>
+                    </div>
+
+                    <div class="CheckList_Row" id="node_4">
+                      <div id="padding_4" class="CheckList_Padding_0"></div>
+                      <div id="icon_4" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                        <div class="CheckList_Text_Title" id="title_4">Source compilation</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_4" style="display: none;"></div>
+                      <div class="CheckList_Text_Message_Error" id="error_4" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_4" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_4" style="display: none;">WARNING</div>
+                    </div>
+
+                    <div class="CheckList_Row" id="node_4.1">
+                      <div id="padding_4.1" class="CheckList_Padding_1"></div>
+                      <div id="icon_4.1" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                        <div class="CheckList_Text_Title" id="title_4.1">WAD generation</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_4.1" style="display: none;"></div>
+                      <div class="CheckList_Text_Message_Error" id="error_4.1" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_4.1" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_4.1" style="display: none;">WARNING</div>
+                    </div>
+
+                    <div class="CheckList_Row" id="node_4.2">
+                      <div id="padding_4.2" class="CheckList_Padding_1"></div>
+                      <div id="icon_4.2" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                        <div class="CheckList_Text_Title" id="title_4.2">xsql class generation</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_4.2" style="display: none;"></div>
+                      <div class="CheckList_Text_Message_Error" id="error_4.2" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_4.2" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_4.2" style="display: none;">WARNING</div>
+                    </div>
+
+                    <div class="CheckList_Row" id="node_4.3">
+                      <div id="padding_4.3" class="CheckList_Padding_1"></div>
+                      <div id="icon_4.3" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                        <div class="CheckList_Text_Title" id="title_4.3">Java compilation</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_4.3" style="display: none;"></div>
+                      <div class="CheckList_Text_Message_Error" id="error_4.3" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_4.3" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_4.3" style="display: none;">WARNING</div>
+                    </div>
+
+                    <div class="CheckList_Row" id="node_4.4">
+                      <div id="padding_4.4" class="CheckList_Padding_1"></div>
+                      <div id="icon_4.4" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                        <div class="CheckList_Text_Title" id="title_4.4">WebContent folder generation</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_4.4" style="display: none;"></div>
+                      <div class="CheckList_Text_Message_Error" id="error_4.4" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_4.4" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_4.4" style="display: none;">WARNING</div>
+                    </div>
+
+                    <div class="CheckList_Row" id="node_4.5">
+                      <div id="padding_4.5" class="CheckList_Padding_1"></div>
+                      <div id="icon_4.5" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                        <div class="CheckList_Text_Title" id="title_4.5">Deploying files to server</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_4.5" style="display: none;"></div>
+                      <div class="CheckList_Text_Message_Error" id="error_4.5" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_4.5" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_4.5" style="display: none;">WARNING</div>
+                    </div>
+
+                    <div class="CheckList_Row" id="node_5.1">
+                      <div id="padding_5.1" class="CheckList_Padding_0"></div>
+                      <div id="icon_5.1" class="CheckList_Icon_Pending"></div>
+                      <div class="CheckList_Text_Container">
+                        <div class="CheckList_Text_Title" id="title_5.1">Rebuild successful, context needs to be restarted</div>
+                      </div>
+                      <div class="CheckList_Text_Separator"></div>
+                      <div class="CheckList_Text_Message_Processing" id="processing_5.1" style="display: none;"> </div>
+                      <div class="CheckList_Text_Message_Error" id="error_5.1" style="display: none;">ERROR</div>
+                      <div class="CheckList_Text_Message_Exception" id="exception_5.1" style="display: none;">EXCEPTION</div>
+                      <div class="CheckList_Text_Message_Warning" id="warning_5.1" style="display: none;">WARNING</div>
+                    </div>
+
+
+              </td></tr>
+
+              <tr><td colspan="4">
+                <div style="overflow: auto; width: 600px;">
+                  <span class="CheckList_RebuildSystemWindow_title">Warnings and errors:</span>
+                </div>
+              </td></tr>
+
               <tr>
-                <td></td>
-                <td class="Button_RightAlign_ContentCell">
+                <tr><td height="10"></td></tr>
+                <td colspan="4">
+                  <div class="CheckList_RebuildSystemWindow_textarea" id="warningsAndErrors">
+                </td>
+              </tr>
+
+
+              <tr><td height="10"></td></tr>
+              <tr>
+                <td colspan="4">
                   <div>
-                    <button type="button" 
-                      id="buttonOK" 
-                      class="ButtonLink" 
-                      onclick="startProcessing();return false;" 
-                      onfocus="buttonEvent('onfocus', this); window.status='Accept'; return true;" 
-                      onblur="buttonEvent('onblur', this);" 
-                      onkeyup="buttonEvent('onkeyup', this);" 
-                      onkeydown="buttonEvent('onkeydown', this);" 
-                      onkeypress="buttonEvent('onkeypress', this);" 
-                      onmouseup="buttonEvent('onmouseup', this);" 
-                      onmousedown="buttonEvent('onmousedown', this);" 
-                      onmouseover="buttonEvent('onmouseover', this); window.status='Accept'; return true;" 
-                      onmouseout="buttonEvent('onmouseout', this);">
+                    <button type="button" id="buttonLog" class="ButtonLink" onclick="openServletNewWindow('DEFAULT', false, '../utility/ShowFile?filePath=xx', 'Show Log', null, false, 600, 900,null,null,false);" onfocus="buttonEvent('onfocus', this); window.status='Show log'; return true;" onblur="buttonEvent('onblur', this);" onkeyup="buttonEvent('onkeyup', this);" onkeydown="buttonEvent('onkeydown', this);" onkeypress="buttonEvent('onkeypress', this);" onmouseup="buttonEvent('onmouseup', this);" onmousedown="buttonEvent('onmousedown', this);" onmouseover="buttonEvent('onmouseover', this); window.status='Show log'; return true;" onmouseout="buttonEvent('onmouseout', this);">
                       <table class="Button">
                         <tr>
-                          <td class="Button_left"><img class="Button_Icon Button_Icon_ok" alt="Accept" title="Accept" src="../../../../../web/images/blank.gif" border="0" /></td>
-                          <td class="Button_text Button_width">OK</td>
+                          <td class="Button_left"><img class="Button_Icon" alt="Show log" title="Show log" src="../web/images/blank.gif" border="0"></img></td>
+                          <td class="Button_text">Show log</td>
                           <td class="Button_right"></td>
                         </tr>
+
                       </table>
                     </button>
                   </div>
                 </td>
-                <td class="Button_LeftAlign_ContentCell" id="displayLogicCancel">
-                  <button type="button" 
-                    id="buttonCancel" 
-                    class="ButtonLink" 
-                    onclick="closeThisPage();return false;" 
-                    onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
-                    onblur="buttonEvent('onblur', this);" 
-                    onkeyup="buttonEvent('onkeyup', this);" 
-                    onkeydown="buttonEvent('onkeydown', this);" 
-                    onkeypress="buttonEvent('onkeypress', this);" 
-                    onmouseup="buttonEvent('onmouseup', this);" 
-                    onmousedown="buttonEvent('onmousedown', this);" 
-                    onmouseover="buttonEvent('onmouseover', this); window.status='Cancel'; return true;" 
-                    onmouseout="buttonEvent('onmouseout', this);">
-                    <table class="Button">
-                      <tr>
-                        <td class="Button_left"><img class="Button_Icon Button_Icon_cancel" alt="Cancel" title="Cancel" src="../../../../../web/images/blank.gif" border="0" /></td>
-                        <td class="Button_text Button_width">Cancel</td>
-                        <td class="Button_right"></td>
-                      </tr>
-                    </table>
-                  </button>
-                </td>
                 <td></td>
               </tr>
-
-            </table>
-            -->
+              
           </div>
         </td>
+
       </tr>
     </table>
+    
+    
   </form>
-</body>
-</html>
+
+
+</body></html>
+              
--- a/src/org/openbravo/erpCommon/ad_process/ApplyModules.java	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_process/ApplyModules.java	Tue Nov 24 18:48:35 2009 +0100
@@ -70,6 +70,8 @@
 
     if (vars.commandIn("DEFAULT")) {
       printPage(request, response, vars);
+    } else if (vars.commandIn("TOMCAT")) {
+      printPageTomcat(request, response, vars);
     } else if (vars.commandIn("STARTAPPLY")) {
       startApply(response, vars);
     } else if (vars.commandIn("UPDATESTATUS")) {
@@ -113,7 +115,7 @@
 
     String fileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
     final XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
-        "org/openbravo/erpCommon/ad_process/ApplyModulesNew").createXmlDocument();
+        "org/openbravo/erpCommon/ad_process/ApplyModules").createXmlDocument();
     xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
     xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\r\n");
     xmlDocument.setParameter("theme", vars.getTheme());
@@ -137,6 +139,39 @@
   }
 
   /**
+   * Prints a page that only allows the user to restart or reload Tomcat
+   * 
+   * @param response
+   * @param vars
+   * @throws IOException
+   * @throws ServletException
+   */
+  private void printPageTomcat(HttpServletRequest request, HttpServletResponse response,
+      VariablesSecureApp vars) throws IOException, ServletException {
+
+    final XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+        "org/openbravo/erpCommon/ad_process/RestartTomcat").createXmlDocument();
+    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
+    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\r\n");
+    xmlDocument.setParameter("theme", vars.getTheme());
+    // xmlDocument.setParameter("help", ApplyModulesData.getHelp(this, vars.getLanguage()));
+
+    final OBError myMessage = vars.getMessage("ApplyModules");
+    vars.removeMessage("ApplyModules");
+    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");
+    final PrintWriter out = response.getWriter();
+
+    out.println(xmlDocument.print());
+    out.close();
+  }
+
+  /**
    * Reloads the application context to after building the application to apply modules.
    * 
    * @param response
@@ -370,7 +405,11 @@
 
       // We first shutdown the background process, so that it doesn't interfere
       // with the rebuild process
-      OBScheduler.getInstance().getScheduler().shutdown(true);
+      try {
+        OBScheduler.getInstance().getScheduler().shutdown(true);
+      } catch (Exception e) {
+        // We will not log an exception if the scheduler complains. The user shouldn't notice this
+      }
 
       // We also cancel sessions opened for users different from the current one
       updateSession = getPreparedStatement("UPDATE AD_SESSION SET SESSION_ACTIVE='N' WHERE CREATEDBY<>?");
@@ -479,7 +518,9 @@
       if (rs.next()) {
         error.setType("Error");
         error.setTitle(Utility.messageBD(myPool, "Error", vars.getLanguage()));
-        error.setMessage(Utility.messageBD(myPool, "BuildError", vars.getLanguage()));
+        error
+            .setMessage(Utility.messageBD(myPool, "BuildError", vars.getLanguage())
+                + "<a href=\"http://wiki.openbravo.com/wiki/UpgradeTips\" target=\"_blank\">this link</a>.");
 
       } else {
         ps2 = getPreparedStatement("SELECT MESSAGE FROM AD_ERROR_LOG WHERE ERROR_LEVEL='WARN'");
@@ -488,7 +529,10 @@
         if (rs2.next()) {
           error.setType("Warning");
           error.setTitle(Utility.messageBD(myPool, "Warning", vars.getLanguage()));
-          error.setMessage(Utility.messageBD(myPool, "BuildWarning", vars.getLanguage()));
+          error
+              .setMessage(Utility.messageBD(myPool, "BuildWarning", vars.getLanguage())
+                  + "<a href=\"http://wiki.openbravo.com/wiki/UpgradeTips\" target=\"_blank\">this link</a>."
+                  + Utility.messageBD(myPool, "BuildWarning2", vars.getLanguage()));
 
         } else {
           error.setType("Success");
--- a/src/org/openbravo/erpCommon/ad_process/ApplyModules.xml	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_process/ApplyModules.xml	Tue Nov 24 18:48:35 2009 +0100
@@ -26,4 +26,6 @@
   <PARAMETER id="paramDirectory" name="directory" default=""/>
   <PARAMETER id="paramCSS" name="theme" attribute="href" replace="Default"/>
   <PARAMETER id="processHelp" name="help" replaceCharacters="htmlHelp" default=""/>
+  <PARAMETER id="buttonLog" name="buttonLog" attribute="onclick" replace="xx"/>
+  <PARAMETER id="logfile" name="logfile" attribute="value" replace="xx"/>
 </REPORT>
--- a/src/org/openbravo/erpCommon/ad_process/ApplyModulesNew.html	Tue Nov 24 10:27:25 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,943 +0,0 @@
-<!--
- *************************************************************************
- * The contents of this file are subject to the Openbravo  Public  License
- * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
- * Version 1.1  with a permitted attribution clause; you may not  use this
- * file except in compliance with the License. You  may  obtain  a copy of
- * the License at http://www.openbravo.com/legal/license.html 
- * Software distributed under the License  is  distributed  on  an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific  language  governing  rights  and  limitations
- * under the License. 
- * The Original Code is Openbravo ERP. 
- * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2009 Openbravo SL 
- * All Rights Reserved. 
- * Contributor(s):  ______________________________________.
- ************************************************************************
--->
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <title>Rebuild the System</title>
-  <link rel="shortcut icon" href="../../../../../web/images/favicon.ico" type="image/x-icon" />
-  <link rel="stylesheet" type="text/css" href="../../../../../web/skins/Default/Openbravo_ERP_250.css" id="paramCSS"></link>
-  <script language="JavaScript" src="../../../../../web/js/shortcuts.js" type="text/javascript"></script>
-  <script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script>
-  <script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
-  <script language="JavaScript" src="../../../../../web/js/dojoConfig.js" type="text/javascript"></script>
-  <script language="JavaScript" src="../../../../../web/js/dojo/dojo.js" type="text/javascript"></script>
-  <script language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></script>
-  <script language="JavaScript" src="../../../../../web/js/default/MessageBox.js" type="text/javascript"></script>
-  <script language="JavaScript" type="text/javascript" id="paramLanguage"></script>
-  <script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
-  <script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
-  <script language="JavaScript" type="text/javascript" id="paramDirectory"></script>
-  <script language="JavaScript" type="text/javascript">
-    function closeThisPage() {
-      window.close();
-      return true;
-    }
-  </script>
-  <script language="JavaScript" type="text/javascript">
-    var lc_isChronoEnabled = true;
-    var current_state=0;
-    var possible_states=[11,12,13,14,15,21,31,41,42,43,44,45,50,60];
-    var error_status=['','','','','','','','','','','','','',''];
-    var numofwarns=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
-    var numoferrs=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
-    var warnings=[];
-    var errors=[];
-    var start=false;
-    var mainTimeout;
-
-    
-    function restart() {
-        if (document.frmMain.option[0].checked) {
-          window.opener.submitCommandForm('RESTART', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
-          closeThisPage();
-          return false;
-        } else if (document.frmMain.option[1].checked) {
-          window.opener.submitCommandForm('RELOAD', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
-          closeThisPage();
-          return false;
-        } else if (document.frmMain.option[2].checked) {
-          closeThisPage();
-        }
-      } 
-
-    function getError1(paramXMLParticular, XMLHttpRequestObj) {
-        var strText = "";
-        if (getReadyStateHandler(XMLHttpRequestObj,null,false)) {
-          try {
-            if (XMLHttpRequestObj.responseText) strText = XMLHttpRequestObj.responseText;
-          } catch (e) {
-            initialize_MessageBox('messageBoxID');
-            setValues_MessageBox('messageBoxID','ERROR','ERROR',e);
-          }
-          if (strText == "") {
-            showJSMessage(22);
-          } else {
-            //Expecting msg in JSON format
-            var msg = eval("("+strText+")");;
-            initialize_MessageBox('messageBoxID');
-            setValues_MessageBox('messageBoxID',msg.OBError.type, msg.OBError.title, msg.OBError.message);
-            if(msg.OBError.type!="Error"){
-                displayLogicElement('restartOptions',true);
-            }
-            document.getElementById("rebuildMessage").style.display = "none";
-          }
-        }
-        return true;
-    }
-      
-    
-    function getError() {
-      var frm = document.frmMain;
-      var paramXMLReq = null;
-      return submitXmlHttpRequest(getError1, frm, "GETERR", "ApplyModules.html", false, null, paramXMLReq);
-    }
-    
-    function finalize() {
-      processing = false;
-      top.opener.setProcessingMode('window', false);
-      //document.getElementById('buttonOK').setAttribute('onclick','window.opener.submitCommandForm("DEFAULT", false, null, "ModuleManagement.html", "_self", null, true);closeThisPage();return false;');
-      
-      setTimeout("getError()",100);
-    }
-    
-    function endProcess(paramXMLParticular, XMLHttpRequestObj) {
-        var strText = "";
-        var id = "";
-        var imageId = "";
-        if (getReadyStateHandler(XMLHttpRequestObj)) finalize();
-        return true;
-    }
-    
-    function startProcessing() {
-      startLocalChrono('localChrono');
-      processing = true;
-      top.opener.setProcessingMode('window', true, false);
-      var frm = document.frmMain;
-      //displayLogicElement('buttonOK',false);
-      //displayLogicElement('buttonCancel',false);
-      displayLogicElement('confirmation',false);
-      displayLogicElement('rebuildTable',true);
-      var paramXMLReq = null;
-      return submitXmlHttpRequest(endProcess, frm, "STARTAPPLY", "ApplyModules.html", false, null, paramXMLReq);
-    }
-    
-    function stopLocalChrono() {
-      lc_isChronoEnabled = false;
-    }
-
-    function startLocalChrono(destiny) {
-      var referenceDate = new Date();
-      referenceDate = referenceDate.getTime();
-      LocalChrono(destiny, referenceDate);
-    }
-
-    function getStatusIndex(state){
-      for(i=0;i<possible_states.length;i++){
-          if(possible_states[i]==state){
-              return i;
-          }
-      }
-    }
-
-    function askForErrorStatus(paramXMLParticular, XMLHttpRequestObj) {
-    	var strText = "";
-        if (getReadyStateHandler(XMLHttpRequestObj,null,false)) {
-          try {
-            if (XMLHttpRequestObj.responseText) strText = XMLHttpRequestObj.responseText;
-          } catch (e) {
-          }
-
-          var msg = eval("("+strText+")");
-          
-          var state=msg.Response.state;
-          var errorStatus=msg.Response.statusofstate;
-          var stateindex=getStatusIndex(state);
-          progList_changeStatus(correspondingNode(state), errorStatus);
-          error_status[stateindex]=errorStatus;
-          insertWarnsAndErrors(msg.Response);
-        }
-    }
-
-    function correspondingNode(state_index){
-        state_index=parseFloat(state_index)/10;
-        return state_index.toString();
-    }
-
-    
-    function insertWarnsAndErrors(response){
-        if(start==true){
-	        if(response.statusofstate=="Warning"){
-	            var warns=response.warnings.string;
-	            if(warns!=null){
-	                if(!(warns instanceof Array)){
-	                    warns=[warns];
-	                }
-	                if(numofwarns[getStatusIndex(response.state)]<warns.length){
-	                    for(i=numofwarns[getStatusIndex(response.state)];i<warns.length;i++){
-	                    	    var old=document.getElementById("warning_"+correspondingNode(response.state)).title;
-	                    	    if(old===""){
-		                    	    old="Warnings: ";
-	                    	    }else{
-		                    	    old+=",";
-	                    	    }
-	                    	    document.getElementById("warning_"+correspondingNode(response.state)).title=old+warns[i];
-	                            warnings.push(warns[i]);
-	                            progList_addTextToTextArea('<i>Warning: </i>'+warns[i]);
-	                    }
-	                    numofwarns[getStatusIndex(response.state)]=warns.length;
-	                }
-	            }
-	        }
-	        if(response.statusofstate=="Error"){
-	            var errs=response.errors.string;
-	            if(errs!=null){
-	                if(!(errs instanceof Array)){
-	                    errs=[errs];
-	                }
-	                if(numoferrs[getStatusIndex(response.state)]<errs.length){
-	                    for(i=numoferrs[getStatusIndex(response.state)];i<errs.length;i++){
-	                            warnings.push(errs[i]);
-	                            progList_addTextToTextArea('<b>Error: </b>'+errs[i]);
-	                    }
-	                    numoferrs[getStatusIndex(response.state)]=errs.length;
-	                }
-	            }
-	        }
-        }
-    }
-    
-    function update(paramXMLParticular, XMLHttpRequestObj) {
-    	var strText = "";
-        if (getReadyStateHandler(XMLHttpRequestObj,null,false)) {
-          try {
-            if (XMLHttpRequestObj.responseText) strText = XMLHttpRequestObj.responseText;
-          } catch (e) {
-          }
-
-          var msg = eval("("+strText+")");
-          
-          var state=msg.Response.state;
-          if(state=="11" || start==true){
-             if(state=="60"){
-                 clearTimeout(mainTimeout);
-             }
-             start=true;
-	         var errorStatus=msg.Response.statusofstate;
-	         var stateindex=getStatusIndex(state);
-	         if(stateindex>current_state){
-	           for(i=current_state;i<stateindex;i++){
-	               //We need to ask for warning/error state for the intermediate status
-	               document.getElementById("reqStatus").value=possible_states[i];
-	               submitXmlHttpRequest(askForErrorStatus, frmMain, "REQUESTERRORSTATE", "ApplyModules.html", false, null, null);
-	           }
-	         }
-	         
-	         error_status[getStatusIndex(state)]=errorStatus;
-	         progList_changeStatus(correspondingNode(state), errorStatus, msg.Response.lastmessage.substring(0,50));
-
-	         insertWarnsAndErrors(msg.Response);
-	         
-	         current_state=stateindex;
-	         var ind11=getStatusIndex(11);
-	         if(error_status[ind11]=='Success' && error_status[ind11+1]=='Success' && error_status[ind11+2]=='Success' && error_status[ind11+3]=='Success' && error_status[ind11+4]=='Success'){
-	             progList_changeStatus('1', 'Success');
-	         }else if(error_status[ind11]=='Error' || error_status[ind11+1]=='Error'|| error_status[ind11+2]=='Error'|| error_status[ind11+3]=='Error'|| error_status[ind11+4]=='Error'){
-	             progList_changeStatus('1', 'Error');
-	         }else if(error_status[ind11]=='Warning' || error_status[ind11+1]=='Warning'|| error_status[ind11+2]=='Warning'|| error_status[ind11+3]=='Warning'|| error_status[ind11+4]=='Warning'){
-	             progList_changeStatus('1', 'Warning');
-	         }
-
-	         var ind41=getStatusIndex(41);
-             if(error_status[ind41]=='Success' && error_status[ind41+1]=='Success' && error_status[ind41+2]=='Success' && error_status[ind41+3]=='Success' && error_status[ind41+4]=='Success'){
-	             progList_changeStatus('4', 'Success');
-	         }else if(error_status[ind41]=='Error' || error_status[ind41+1]=='Error'|| error_status[ind41+2]=='Error'|| error_status[ind41+3]=='Error'|| error_status[ind41+4]=='Error'){
-	             progList_changeStatus('4', 'Error');
-	         }else if(error_status[ind41]=='Warning' || error_status[ind41+1]=='Warning'|| error_status[ind41+2]=='Warning'|| error_status[ind41+3]=='Warning'|| error_status[ind41+4]=='Warning'){
-	             progList_changeStatus('4', 'Warning');
-	         }
-	      
-          }
-          
-        }
-    }
-
-    function LocalChrono(destiny, referenceDate) {
-      var actualDate = new Date();
-      actualDate = actualDate.getTime();
-
-      var difDate = actualDate - referenceDate;
-      difDate = difDate / 1000;
-      difDate = Math.floor(difDate);
-
-      var seconds = difDate%60;
-      var minutes = Math.floor(difDate/60);
-
-      var seconds_string = seconds.toString();
-      var minutes_string = minutes.toString();
-
-      if (seconds_string.length == 1) {
-        seconds_string = "0" + seconds_string;
-      }
-      if (minutes_string.length == 1) {
-        minutes_string = "0" + minutes_string;
-      }
-      var output = minutes_string + ":" + seconds_string;
-      document.getElementById(destiny).innerHTML=output;
-
-
-      submitXmlHttpRequest(update, frmMain, "UPDATESTATUS", "ApplyModules.html", false, null, null);
-      
-
-      if (lc_isChronoEnabled) {
-        mainTimeout=setTimeout(function() {LocalChrono(destiny, referenceDate);},1000);
-      }
-    }
-
-    function progList_changeStatus(node, newStatus, text) {
-	      node=node.toString();
-	      if (newStatus == "Success") {
-	        document.getElementById("icon_" + node).className = "CheckList_Icon_Success";
-	        document.getElementById("processing_" + node).innerHTML = " ";
-	        document.getElementById("processing_" + node).style.display = "none";
-	        document.getElementById("error_" + node).style.display = "none";
-	        document.getElementById("exception_" + node).style.display = "none";
-	        document.getElementById("warning_" + node).style.display = "none";
-	      } else if (newStatus == "Error") {
-	        document.getElementById("icon_" + node).className = "CheckList_Icon_Error";
-	        document.getElementById("processing_" + node).innerHTML = " ";
-	        document.getElementById("processing_" + node).style.display = "none";
-	        document.getElementById("error_" + node).style.display = "";
-	        document.getElementById("exception_" + node).style.display = "none";
-	        document.getElementById("warning_" + node).style.display = "none";
-	      } else if (newStatus == "Exception") {
-	        document.getElementById("icon_" + node).className = "CheckList_Icon_Exception";
-	        document.getElementById("processing_" + node).innerHTML = " ";
-	        document.getElementById("processing_" + node).style.display = "none";
-	        document.getElementById("error_" + node).style.display = "none";
-	        document.getElementById("exception_" + node).style.display = "";
-	        document.getElementById("warning_" + node).style.display = "none";
-	      } else if (newStatus == "Warning") {
-	        document.getElementById("icon_" + node).className = "CheckList_Icon_Warning";
-	        document.getElementById("processing_" + node).innerHTML = " ";
-	        document.getElementById("processing_" + node).style.display = "none";
-	        document.getElementById("error_" + node).style.display = "none";
-	        document.getElementById("exception_" + node).style.display = "none";
-	        document.getElementById("warning_" + node).style.display = "";
-	      } else if (newStatus == "Pending") {
-	        document.getElementById("icon_" + node).className = "CheckList_Icon_Pending";
-	        document.getElementById("processing_" + node).innerHTML = " ";
-	        document.getElementById("processing_" + node).style.display = "none";
-	        document.getElementById("error_" + node).style.display = "none";
-	        document.getElementById("exception_" + node).style.display = "none";
-	        document.getElementById("warning_" + node).style.display = "none";
-	      } else if (newStatus == "Processing") {
-	        document.getElementById("icon_" + node).className = "CheckList_Icon_Processing";
-	        if (text) {
-	          document.getElementById("processing_" + node).innerHTML = text;
-	        } else {
-	          document.getElementById("processing_" + node).innerHTML = " ";
-	        }
-	        document.getElementById("processing_" + node).style.display = "";
-	        document.getElementById("error_" + node).style.display = "none";
-	        document.getElementById("exception_" + node).style.display = "none";
-	        document.getElementById("warning_" + node).style.display = "none";
-	      }
-    }
-
-    function progList_setTextToTextArea(text) {
-      document.getElementById('warningsAndErrors').innerHTML = text;
-    }
-
-    function progList_addTextToTextArea(text) {
-      document.getElementById('warningsAndErrors').innerHTML += text+"<br>";
-    }
-
-    function resetAllStates(){
-        progList_changeStatus('1', 'Pending');
-        progList_changeStatus('1.1', 'Pending');
-        progList_changeStatus('1.2', 'Pending');
-        progList_changeStatus('1.3', 'Pending');
-        progList_changeStatus('1.4', 'Pending');
-        progList_changeStatus('1.5', 'Pending');
-        progList_changeStatus('2.1', 'Pending');
-        progList_changeStatus('3.1', 'Pending');
-        progList_changeStatus('4', 'Pending');
-        progList_changeStatus('4.1', 'Pending');
-        progList_changeStatus('4.2', 'Pending');
-        progList_changeStatus('4.3', 'Pending');
-        progList_changeStatus('4.4', 'Pending');
-        progList_changeStatus('5', 'Pending');
-    }
-
-  </script>
-    <script language="JavaScript" type="text/javascript">
-
-    function onLoadDo() {
-      this.windowTables = new Array(
-        new windowTableId('client', 'buttonOK')
-      );
-      setWindowTableParentElement();
-      enableShortcuts('popup');
-      setBrowserAutoComplete(false);
-
-      setWindowElementFocus('firstElement');
-      displayLogicElement('confirmation',true);
-      displayLogicElement('rebuildTable',false);
-      displayLogicElement('restartOptions',false);
-    }
-
-    function onResizeDo() {
-    }
-    
-    function onUnloadDo() {
-      try {
-        top.opener.setProcessingMode('window', false);
-      }
-      catch (e) {}
-    }
-
-    var processing = false;
-
-</script>
-</head>
-<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="onLoadDo();" onunload="onUnloadDo();" id="paramMessage">
-  <form id="form" method="post" action="ApplyModules.html" name="frmMain" target="hiddenFrame">
-    <input type="hidden" name="Command"></input>
-    <input type="hidden" name="IsPopUpCall" value="1"></input>
-    <input type="hidden" name="inpLastFieldChanged"></input>
-    <input type="hidden" name="inpSelected" id="paramSelected" value=""></input>
-    <input type="hidden" name="reqStatus" id="reqStatus" value=""></input>
-    <input type="hidden" name="logfile" id="logfile" value="xx"></input>
-    <div class="Popup_ContentPane_CircleLogo">
-
-      <div class="Popup_WindowLogo">
-        <img class="Popup_WindowLogo_Icon Popup_WindowLogo_Icon_process" src="../web/images/blank.gif" border="0/"></img>
-      </div>
-    </div>
-
-    <table cellspacing="0" cellpadding="0" width="100%">
-
-      <tr>
-        <td>
-          <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_NavBar">
-
-            <tr class="Popup_NavBar_bg"><td></td>
-              <td class="Popup_NavBar_separator_cell"></td>
-              <td class="Popup_NavBar_bg_logo_left"></td>
-              <td class="Popup_NavBar_bg_logo" width="1" onclick="openNewBrowser('http://www.openbravo.com', 'Openbravo');return false;"><img src="../web/images/blank.gif" alt="Openbravo" title="Openbravo" border="0" id="openbravoLogo" class="Popup_NavBar_logo"></img></td>
-              <td class="Popup_NavBar_bg_logo_right"></td>
-              <td class="Popup_NavBar_Popup_title_cell"><span>Rebuild the System</span></td>
-              <td class="Popup_NavBar_separator_cell"></td>
-            </tr>
-
-          </table>
-        </td>
-      </tr>
-
-      <tr>
-        <td>
-          <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_SeparatorBar">
-            <tr>
-              <td class="Popup_SeparatorBar_bg"></td>
-
-            </tr>
-          </table>
-        </td>
-      </tr>
-      <tr>
-        <td>
-          
-        </td>
-      </tr>
-      <tr>
-        <td>
-          <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client">
-            
-            <table cellpadding="0" cellspacing="0" id="messageBoxID" class="MessageBoxHIDDEN">
-              <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 class="MessageBox_LeftTrans">
-                            <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
-                              <tbody>
-                              <tr>
-                                <td class="MessageBox_TopLeft"></td>
-                              </tr>
-                              <tr>
-
-                                <td class="MessageBox_Left"></td>
-                              </tr>
-                              </tbody>
-                            </table>
-                          </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"></div>
-                                                <div class="MessageBox_TextDescription" id="messageBoxIDMessage"></div>
-                                                <div class="MessageBox_TextSeparator"></div>
-                                              </span>
-                                            </td>
-                                          </tr>
-                                        </tbody>
-
-                                      </table>
-                                    </span>
-                                  </td>
-                                </tr>
-                              </tbody>
-                            </table>
-
-                          </td>
-                          <td class="MessageBox_RightTrans">
-
-                            <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
-                              <tbody>
-                              <tr>
-                                <td class="MessageBox_TopRight"></td>
-                              </tr>
-                              <tr>
-                                <td class="MessageBox_Right"></td>
-                              </tr>
-                              </tbody>
-
-                            </table>
-                          </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>
-            
-            
-            <table style="width: 550px !important;" cellspacing="0" cellpadding="0" border ="0" class="Login_Home_TableEdition" id="confirmation">
-              <tr><td style="height: 20px;"></td></tr>
-              <tr>
-                <td colspan="2">
-                  <div style="overflow: auto;">
-                    <span class="PlainText_normal" style="font-size: 10pt; padding-left: 165px">Do you want to rebuild the system now?</span>
-                  </div>
-                </td>
-              </tr>
-              <tr>
-                <td style="height: 20px;"></td></tr>
-                <td class="Button_RightAlign_ContentCell">
-                  <div>
-                    <button type="button" 
-                      id="buttonOK" 
-                      class="ButtonLink" 
-                      onclick="startProcessing();return false;" 
-                      onfocus="buttonEvent('onfocus', this); window.status='Accept'; return true;" 
-                      onblur="buttonEvent('onblur', this);" 
-                      onkeyup="buttonEvent('onkeyup', this);" 
-                      onkeydown="buttonEvent('onkeydown', this);" 
-                      onkeypress="buttonEvent('onkeypress', this);" 
-                      onmouseup="buttonEvent('onmouseup', this);" 
-                      onmousedown="buttonEvent('onmousedown', this);" 
-                      onmouseover="buttonEvent('onmouseover', this); window.status='Accept'; return true;" 
-                      onmouseout="buttonEvent('onmouseout', this);">
-                      <table class="Button">
-                        <tr>
-                          <td class="Button_left"><img class="Button_Icon Button_Icon_ok" alt="Accept" title="Accept" src="../../../../../web/images/blank.gif" border="0" /></td>
-                          <td class="Button_text Button_width">Yes</td>
-                          <td class="Button_right"></td>
-                        </tr>
-                      </table>
-                    </button>
-                 </div>
-               </td>
-               <td class="Button_LeftAlign_ContentCell">
-                <button type="button" 
-                  id="buttonCancel" 
-                  class="ButtonLink" 
-                  onclick="closeThisPage();return false;" 
-                  onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
-                  onblur="buttonEvent('onblur', this);" 
-                  onkeyup="buttonEvent('onkeyup', this);" 
-                  onkeydown="buttonEvent('onkeydown', this);" 
-                  onkeypress="buttonEvent('onkeypress', this);" 
-                  onmouseup="buttonEvent('onmouseup', this);" 
-                  onmousedown="buttonEvent('onmousedown', this);" 
-                  onmouseover="buttonEvent('onmouseover', this); window.status='Cancel'; return true;" 
-                  onmouseout="buttonEvent('onmouseout', this);">
-                  <table class="Button">
-                    <tr>
-                      <td class="Button_left"><img class="Button_Icon Button_Icon_cancel" alt="Cancel" title="Cancel" src="../../../../../web/images/blank.gif" border="0" /></td>
-                      <td class="Button_text Button_width">Cancel</td>
-                      <td class="Button_right"></td>
-                    </tr>
-                  </table>
-                </button>
-               </td>
-               <td></td>
-             </tr>
-            </table>
-            
-            <table class="Popup_Client_TablePopup" cellpadding="0" cellspacing="0" style="margin-top: 15px;" id="rebuildTable">
-              <tr>
-                <td class="TablePopup_OneCell_width"></td>
-                <td class="TablePopup_OneCell_width"></td>
-                <td class="TablePopup_OneCell_width"></td>
-                <td class="TablePopup_OneCell_width"></td>
-              </tr>
-
-              <tr><td colspan="4">
-                <div style="overflow: auto; width: 600px;">
-                  <span id="rebuildMessage" class="CheckList_RebuildSystemWindow_title">Estimated total time for rebuild: 3-7 minutes. Elapsed time: <span id="localChrono">00:00</span>.</br> Do not close this window.</span>
-                 </div>
-              </td></tr>
-
-    
-    <tr><td><table class="Popup_Client_TablePopup" cellpadding="0" cellspacing="0" id="restartOptions" style="margin-top: 5px;">
-              
-              <tr><td colspan="2">
-                <div style="overflow: auto; width: 600px;">
-                  <span class="PlainText_normal">In order for the changes to take effect, you need to restart the servlet container or reload the Openbravo application.</span>
-                </div>
-              </td></tr>
-              <tr><td height="10"></td></tr>
-              <tr>
-                <td colspan="4"><span class="Radio_container_NOT_focused"><input name="option" required="true" value="restart" type="radio" checked></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Restart servlet container now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#restart">learn more</a></span></td>
-              </tr>
-              <tr>
-                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="reload" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Reload the Openbravo application now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#reload">learn more</a></span></td>
-              </tr>
-              <tr>
-                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="doNothing" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Don't do anything now. I will reload the Openbravo application manually later &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#nothing">learn more</a></span></td>
-              </tr>
-
-              <tr><td height="20"></td></tr>
-              <tr>
-                <td></td>
-                <td>
-                  <div>
-                    <button type="button" 
-                      id="buttonContinue" 
-                      class="ButtonLink" 
-                      onclick="restart();return false;" 
-                      onfocus="buttonEvent('onfocus', this); window.status='Continue'; return true;" 
-                      onblur="buttonEvent('onblur', this);" 
-                      onkeyup="buttonEvent('onkeyup', this);" 
-                      onkeydown="buttonEvent('onkeydown', this);" 
-                      onkeypress="buttonEvent('onkeypress', this);" 
-                      onmouseup="buttonEvent('onmouseup', this);" 
-                      onmousedown="buttonEvent('onmousedown', this);" 
-                      onmouseover="buttonEvent('onmouseover', this); window.status='Continue'; return true;" 
-                      onmouseout="buttonEvent('onmouseout', this);">
-                      <table class="Button">
-                        <tr>
-                          <td class="Button_left"><img class="Button_Icon Button_Icon_ok" alt="Continue" title="Continue" src="../../../../../web/images/blank.gif" border="0" /></td>
-                          <td class="Button_text Button_width">Continue</td>
-                          <td class="Button_right"></td>
-                        </tr>
-                      </table>
-                    </button>
-                  </div>
-                </td>
-                <td></td>
-              </tr>
-            </table></td></tr>
-              <tr><td colspan="4">
-
-
-                <div class="TextArea_FourCells_width" id="CheckList">
-                  <div style="padding: 15 5 15 5;" id="CheckListContainer">
-
-                    <div class="CheckList_Row" id="node_1">
-                      <div id="padding_1" class="CheckList_Padding_0"></div>
-                      <div id="icon_1" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                       <div class="CheckList_Text_Title" id="title_1">Database update</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_1" style="display: none;"> </div>
-                      <div class="CheckList_Text_Message_Error" id="error_1" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_1" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_1" style="display: none;">WARNING</div>
-                    </div>
-                    
-                    <div class="CheckList_Row" id="node_1.1">
-                      <div id="padding_1.1" class="CheckList_Padding_1"></div>
-                      <div id="icon_1.1" class="CheckList_Icon_Processing"></div>
-                      <div class="CheckList_Text_Container">
-                       <div class="CheckList_Text_Title" id="title_1.1">DAL initialization</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_1.1" style="display: none;"> </div>
-                      <div class="CheckList_Text_Message_Error" id="error_1.1" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_1.1" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_1.1" style="display: none;">WARNING</div>
-                    </div>
-                    
-                    <div class="CheckList_Row" id="node_1.2">
-                      <div id="padding_1.2" class="CheckList_Padding_1"></div>
-                      <div id="icon_1.2" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                       <div class="CheckList_Text_Title" id="title_1.2">Database model load</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_1.2" style="display: none;"> </div>
-                      <div class="CheckList_Text_Message_Error" id="error_1.2" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_1.2" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_1.2" style="display: none;">WARNING</div>
-                    </div>
-                    
-                    <div class="CheckList_Row" id="node_1.3">
-                      <div id="padding_1.3" class="CheckList_Padding_1"></div>
-                      <div id="icon_1.3" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                       <div class="CheckList_Text_Title" id="title_1.3">Generation of change list</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_1.3" style="display: none;"> </div>
-                      <div class="CheckList_Text_Message_Error" id="error_1.3" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_1.3" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_1.3" style="display: none;">WARNING</div>
-                    </div>
-                    
-                    <div class="CheckList_Row" id="node_1.4">
-                      <div id="padding_1.4" class="CheckList_Padding_1"></div>
-                      <div id="icon_1.4" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                       <div class="CheckList_Text_Title" id="title_1.4">Database structure update</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_1.4" style="display: none;"> </div>
-                      <div class="CheckList_Text_Message_Error" id="error_1.4" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_1.4" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_1.4" style="display: none;">WARNING</div>
-                    </div>
-                    
-                    <div class="CheckList_Row" id="node_1.5">
-                      <div id="padding_1.5" class="CheckList_Padding_1"></div>
-                      <div id="icon_1.5" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                       <div class="CheckList_Text_Title" id="title_1.5">Database data update</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_1.5" style="display: none;"> </div>
-                      <div class="CheckList_Text_Message_Error" id="error_1.5" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_1.5" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_1.5" style="display: none;">WARNING</div>
-                    </div>
-                    
-                    <div class="CheckList_Row" id="node_2.1">
-                      <div id="padding_2.1" class="CheckList_Padding_0"></div>
-                      <div id="icon_2.1" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                        <div class="CheckList_Text_Title" id="title_2.1">Entity generation</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_2.1" style="display: none;"> </div>
-                      <div class="CheckList_Text_Message_Error" id="error_2.1" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_2.1" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_2.1" style="display: none;">WARNING</div>
-                    </div>
-
-                    <div class="CheckList_Row" id="node_3.1">
-                      <div id="padding_3.1" class="CheckList_Padding_0"></div>
-                      <div id="icon_3.1" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                        <div class="CheckList_Text_Title" id="title_3.1">Reference data and translation info loading</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_3.1" style="display: none;"> </div>
-                      <div class="CheckList_Text_Message_Error" id="error_3.1" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_3.1" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_3.1" style="display: none;">WARNING</div>
-                    </div>
-
-                    <div class="CheckList_Row" id="node_4">
-                      <div id="padding_4" class="CheckList_Padding_0"></div>
-                      <div id="icon_4" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                        <div class="CheckList_Text_Title" id="title_4">Source compilation</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_4" style="display: none;"></div>
-                      <div class="CheckList_Text_Message_Error" id="error_4" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_4" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_4" style="display: none;">WARNING</div>
-                    </div>
-
-                    <div class="CheckList_Row" id="node_4.1">
-                      <div id="padding_4.1" class="CheckList_Padding_1"></div>
-                      <div id="icon_4.1" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                        <div class="CheckList_Text_Title" id="title_4.1">WAD generation</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_4.1" style="display: none;"></div>
-                      <div class="CheckList_Text_Message_Error" id="error_4.1" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_4.1" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_4.1" style="display: none;">WARNING</div>
-                    </div>
-
-                    <div class="CheckList_Row" id="node_4.2">
-                      <div id="padding_4.2" class="CheckList_Padding_1"></div>
-                      <div id="icon_4.2" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                        <div class="CheckList_Text_Title" id="title_4.2">xsql class generation</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_4.2" style="display: none;"></div>
-                      <div class="CheckList_Text_Message_Error" id="error_4.2" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_4.2" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_4.2" style="display: none;">WARNING</div>
-                    </div>
-
-                    <div class="CheckList_Row" id="node_4.3">
-                      <div id="padding_4.3" class="CheckList_Padding_1"></div>
-                      <div id="icon_4.3" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                        <div class="CheckList_Text_Title" id="title_4.3">Java compilation</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_4.3" style="display: none;"></div>
-                      <div class="CheckList_Text_Message_Error" id="error_4.3" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_4.3" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_4.3" style="display: none;">WARNING</div>
-                    </div>
-
-                    <div class="CheckList_Row" id="node_4.4">
-                      <div id="padding_4.4" class="CheckList_Padding_1"></div>
-                      <div id="icon_4.4" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                        <div class="CheckList_Text_Title" id="title_4.4">WebContent folder generation</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_4.4" style="display: none;"></div>
-                      <div class="CheckList_Text_Message_Error" id="error_4.4" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_4.4" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_4.4" style="display: none;">WARNING</div>
-                    </div>
-
-                    <div class="CheckList_Row" id="node_4.5">
-                      <div id="padding_4.5" class="CheckList_Padding_1"></div>
-                      <div id="icon_4.5" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                        <div class="CheckList_Text_Title" id="title_4.5">Deploying files to server</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_4.5" style="display: none;"></div>
-                      <div class="CheckList_Text_Message_Error" id="error_4.5" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_4.5" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_4.5" style="display: none;">WARNING</div>
-                    </div>
-
-                    <div class="CheckList_Row" id="node_5">
-                      <div id="padding_5" class="CheckList_Padding_0"></div>
-                      <div id="icon_5" class="CheckList_Icon_Pending"></div>
-                      <div class="CheckList_Text_Container">
-                        <div class="CheckList_Text_Title" id="title_5">Rebuild successful, context needs to be restarted</div>
-                      </div>
-                      <div class="CheckList_Text_Separator"></div>
-                      <div class="CheckList_Text_Message_Processing" id="processing_5" style="display: none;"> </div>
-                      <div class="CheckList_Text_Message_Error" id="error_5" style="display: none;">ERROR</div>
-                      <div class="CheckList_Text_Message_Exception" id="exception_5" style="display: none;">EXCEPTION</div>
-                      <div class="CheckList_Text_Message_Warning" id="warning_5" style="display: none;">WARNING</div>
-                    </div>
-
-
-              </td></tr>
-
-              <tr><td colspan="4">
-                <div style="overflow: auto; width: 600px;">
-                  <span class="CheckList_RebuildSystemWindow_title">Warnings and errors:</span>
-                </div>
-              </td></tr>
-
-              <tr>
-                <tr><td height="10"></td></tr>
-                <td colspan="4">
-                  <div class="CheckList_RebuildSystemWindow_textarea" id="warningsAndErrors">
-                </td>
-              </tr>
-
-
-              <tr><td height="10"></td></tr>
-              <tr>
-                <td colspan="4">
-                  <div>
-                    <button type="button" id="buttonLog" class="ButtonLink" onclick="openNewBrowser('../utility/ShowFile?filePath=xx', 'Openbravo');return false;" onfocus="buttonEvent('onfocus', this); window.status='Show log'; return true;" onblur="buttonEvent('onblur', this);" onkeyup="buttonEvent('onkeyup', this);" onkeydown="buttonEvent('onkeydown', this);" onkeypress="buttonEvent('onkeypress', this);" onmouseup="buttonEvent('onmouseup', this);" onmousedown="buttonEvent('onmousedown', this);" onmouseover="buttonEvent('onmouseover', this); window.status='Show log'; return true;" onmouseout="buttonEvent('onmouseout', this);">
-                      <table class="Button">
-                        <tr>
-                          <td class="Button_left"><img class="Button_Icon" alt="Show log" title="Show log" src="../web/images/blank.gif" border="0"></img></td>
-                          <td class="Button_text">Show log</td>
-                          <td class="Button_right"></td>
-                        </tr>
-
-                      </table>
-                    </button>
-                  </div>
-                </td>
-                <td></td>
-              </tr>
-              
-          </div>
-        </td>
-
-      </tr>
-    </table>
-    
-    
-  </form>
-
-
-</body></html>
-              
\ No newline at end of file
--- a/src/org/openbravo/erpCommon/ad_process/ApplyModulesNew.xml	Tue Nov 24 10:27:25 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- *************************************************************************
- * The contents of this file are subject to the Openbravo  Public  License
- * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
- * Version 1.1  with a permitted attribution clause; you may not  use this
- * file except in compliance with the License. You  may  obtain  a copy of
- * the License at http://www.openbravo.com/legal/license.html 
- * Software distributed under the License  is  distributed  on  an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific  language  governing  rights  and  limitations
- * under the License. 
- * The Original Code is Openbravo ERP. 
- * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2008 Openbravo SL 
- * All Rights Reserved. 
- * Contributor(s):  ______________________________________.
- ************************************************************************
--->
-<REPORT>
-  <template file="ApplyModulesNew.html"/>
-  <PARAMETER id="paramLanguage" name="language" default=""/>
-  <PARAMETER id="messageBoxID" name="messageType" attribute="class" replace="yy" default="HIDDEN"/>
-  <PARAMETER id="messageBoxIDTitle" name="messageTitle" default=""/>
-  <PARAMETER id="messageBoxIDMessage" name="messageMessage" default=""/>
-  <PARAMETER id="paramDirectory" name="directory" default=""/>
-  <PARAMETER id="paramCSS" name="theme" attribute="href" replace="Default"/>
-  <PARAMETER id="processHelp" name="help" replaceCharacters="htmlHelp" default=""/>
-  <PARAMETER id="buttonLog" name="buttonLog" attribute="onclick" replace="xx"/>
-  <PARAMETER id="logfile" name="logfile" attribute="value" replace="xx"/>
-</REPORT>
--- a/src/org/openbravo/erpCommon/ad_process/ApplyModules_data.xsql	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_process/ApplyModules_data.xsql	Tue Nov 24 18:48:35 2009 +0100
@@ -26,7 +26,7 @@
          SELECT JAVAPACKAGE AS NAME
            FROM AD_MODULE M
           WHERE ISACTIVE='Y'
-            AND (STATUS='I' OR STATUS='U')  
+            AND (STATUS='I' OR STATUS='U' OR STATUS='P')  
             AND NOT EXISTS (SELECT 1 
                               FROM AD_MODULE_INSTALL
                              WHERE AD_MODULE_ID = M.AD_MODULE_ID)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_process/RestartTomcat.html	Tue Nov 24 18:48:35 2009 +0100
@@ -0,0 +1,181 @@
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SL 
+ * All portions are Copyright (C) 2008-2009 Openbravo SL 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <title>Rebuild the System</title>
+  <link rel="shortcut icon" href="../../../../../web/images/favicon.ico" type="image/x-icon" />
+  <link rel="stylesheet" type="text/css" href="../../../../../web/skins/Default/Openbravo_ERP_250.css" id="paramCSS"></link>
+  <script language="JavaScript" src="../../../../../web/js/shortcuts.js" type="text/javascript"></script>
+  <script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script>
+  <script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
+  <script language="JavaScript" src="../../../../../web/js/dojoConfig.js" type="text/javascript"></script>
+  <script language="JavaScript" src="../../../../../web/js/dojo/dojo.js" type="text/javascript"></script>
+  <script language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></script>
+  <script language="JavaScript" src="../utility/DynamicJS.js" type="text/javascript"></script>
+  <script language="JavaScript" src="../../../../../web/js/default/MessageBox.js" type="text/javascript"></script>
+  <script language="JavaScript" type="text/javascript" id="paramLanguage">defaultLang = "en_US";</script>
+  <script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
+  <script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
+  <script type="text/javascript">
+    dojo.hostenv.writeIncludes(); //makes debugging in Venkman possible
+  </script>
+  <script language="JavaScript" type="text/javascript" id="paramDirectory">
+    var baseDirectory="../../../../../web/";
+  </script>
+  <script language="JavaScript" type="text/javascript">
+    function closeThisPage() {
+      window.close();
+      return true;
+    }
+  </script>
+
+  <script language="JavaScript" type="text/javascript">
+    function restart() {
+      if (document.frmMain.option[0].checked) {
+        window.opener.submitCommandForm('RESTART', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
+        closeThisPage();
+        return false;
+      } else if (document.frmMain.option[1].checked) {
+        window.opener.submitCommandForm('RELOAD', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
+        closeThisPage();
+        return false;
+      } else if (document.frmMain.option[2].checked) {
+        closeThisPage();
+      }
+    } 
+  
+    function setMessage(text){
+      messageResponse(text);
+    }
+    
+  
+    function onLoadDo() {
+      this.windowTables = new Array(
+        new windowTableId('client', 'buttonOK')
+      );
+      setWindowTableParentElement();
+      enableShortcuts('popup');
+      setBrowserAutoComplete(false);
+
+      displayLogicElement('restartOptions',true);
+    }
+
+    function onResizeDo() {
+    }
+    
+    function onUnloadDo() {
+      try {
+        top.opener.setProcessingMode('window', false);
+      }
+      catch (e) {}
+    }
+    
+  </script>
+</head>
+<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"  onload="onLoadDo();" onunload="onUnloadDo();" id="paramMessage">
+  <form id="form" method="post" action="ApplyModules.html" name="frmMain" target="hiddenFrame">
+    <input type="hidden" name="Command"></input>
+    <input type="hidden" name="IsPopUpCall" value="1"></input>
+    <input type="hidden" name="inpLastFieldChanged"></input>
+    <input type="hidden" name="inpSelected" id="paramSelected" value=""></input>
+    <div class="Popup_ContentPane_CircleLogo">
+      <div class="Popup_WindowLogo">
+        <img class="Popup_WindowLogo_Icon Popup_WindowLogo_Icon_process" src="../../../../../web/images/blank.gif" border=0/></img>
+      </div>
+    </div>
+
+    <table cellspacing="0" cellpadding="0" width="100%">
+
+      <tr>
+        <td>
+          <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_NavBar">
+            <tr class="Popup_NavBar_bg"><td></td>
+              <td class="Popup_NavBar_separator_cell"></td>
+              <td class="Popup_NavBar_bg_logo_left"></td>
+              <td class="Popup_NavBar_bg_logo" width="1" onclick="openNewBrowser('http://www.openbravo.com', 'Openbravo');return false;"><img src="../../../../../web/images/blank.gif" alt="Openbravo" title="Openbravo" border="0" id="openbravoLogo" class="Popup_NavBar_logo" /></td>
+              <td class="Popup_NavBar_bg_logo_right"></td>
+              <td class="Popup_NavBar_Popup_title_cell"><span>Restart Tomcat</span></td>
+              <td class="Popup_NavBar_separator_cell"></td>
+            </tr>
+          </table>
+        </td>
+      </tr>
+
+      <tr>
+        <td>
+          <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client">
+            
+
+            <table class="Popup_Client_TablePopup" cellpadding="0" cellspacing="0" id="restartOptions" style="margin-top: 5px;">
+              
+              <tr><td colspan="2">
+                <div style="overflow: auto; width: 600px;">
+                  <span class="PlainText_normal">In order for the changes to take effect, you need to restart the servlet container or reload the Openbravo application.</span>
+                </div>
+              </td></tr>
+              <tr><td height="10"></td></tr>
+              <tr>
+                <td colspan="4"><span class="Radio_container_NOT_focused"><input name="option" required="true" value="restart" type="radio" checked></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Restart servlet container now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#restart">learn more</a></span></td>
+              </tr>
+              <tr>
+                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="reload" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Reload the Openbravo application now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#reload">learn more</a></span></td>
+              </tr>
+              <tr>
+                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="doNothing" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Don't do anything now. I will reload the Openbravo application manually later &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#nothing">learn more</a></span></td>
+              </tr>
+
+              <tr><td height="20"></td></tr>
+              <tr>
+                <td></td>
+                <td>
+                  <div>
+                    <button type="button" 
+                      id="buttonContinue" 
+                      class="ButtonLink" 
+                      onclick="restart();return false;" 
+                      onfocus="buttonEvent('onfocus', this); window.status='Continue'; return true;" 
+                      onblur="buttonEvent('onblur', this);" 
+                      onkeyup="buttonEvent('onkeyup', this);" 
+                      onkeydown="buttonEvent('onkeydown', this);" 
+                      onkeypress="buttonEvent('onkeypress', this);" 
+                      onmouseup="buttonEvent('onmouseup', this);" 
+                      onmousedown="buttonEvent('onmousedown', this);" 
+                      onmouseover="buttonEvent('onmouseover', this); window.status='Continue'; return true;" 
+                      onmouseout="buttonEvent('onmouseout', this);">
+                      <table class="Button">
+                        <tr>
+                          <td class="Button_left"><img class="Button_Icon Button_Icon_ok" alt="Continue" title="Continue" src="../../../../../web/images/blank.gif" border="0" /></td>
+                          <td class="Button_text Button_width">Continue</td>
+                          <td class="Button_right"></td>
+                        </tr>
+                      </table>
+                    </button>
+                  </div>
+                </td>
+                <td></td>
+              </tr>
+            </table>
+          </div>
+        </td>
+      </tr>
+    </table>
+  </form>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_process/RestartTomcat.xml	Tue Nov 24 18:48:35 2009 +0100
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SL 
+ * All portions are Copyright (C) 2008 Openbravo SL 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+<REPORT>
+  <template file="RestartTomcat.html"/>
+  <PARAMETER id="paramLanguage" name="language" default=""/>
+  <PARAMETER id="messageBoxID" name="messageType" attribute="class" replace="yy" default="HIDDEN"/>
+  <PARAMETER id="messageBoxIDTitle" name="messageTitle" default=""/>
+  <PARAMETER id="messageBoxIDMessage" name="messageMessage" default=""/>
+  <PARAMETER id="paramDirectory" name="directory" default=""/>
+  <PARAMETER id="paramCSS" name="theme" attribute="href" replace="Default"/>
+  <PARAMETER id="processHelp" name="help" replaceCharacters="htmlHelp" default=""/>
+</REPORT>
--- a/src/org/openbravo/erpCommon/modules/ApplyModule.java	Tue Nov 24 10:27:25 2009 +0100
+++ b/src/org/openbravo/erpCommon/modules/ApplyModule.java	Tue Nov 24 18:48:35 2009 +0100
@@ -182,9 +182,9 @@
       }
 
       // ************ Set applied as installed and delete uninstalled ************
-      log4j.info("Set modules as installed");
-      ApplyModuleData.setInstalled(pool);
-      ApplyModuleData.deleteUninstalled(pool);
+      // log4j.info("Set modules as installed");
+      // ApplyModuleData.setInstalled(pool);
+      // ApplyModuleData.deleteUninstalled(pool);
     } catch (final OBException e) {
       throw e;
     } catch (final Exception e) {