[newupgrade] New window
authorAntonio Moreno <antonio.moreno@openbravo.com>
Thu, 12 Nov 2009 10:19:42 +0100
changeset 5597 9fa1f7044ea9
parent 5596 5c76f4704f10
child 5598 5bcfbeeccb12
[newupgrade] New window
build.xml
src-db/database/lib/dbsourcemanager.jar
src-db/database/lib/log4j.properties
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_MODULE.xml
src-db/database/sourcedata/AD_TABLE.xml
src-diagnostics/check-ob-perms.sh
src/build.xml
src/log4j.lcf
src/org/openbravo/erpCommon/ad_process/ApplyModules.java
src/org/openbravo/erpCommon/utility/AntExecutor.java
web/skins/Default/Common/CheckList/dots.gif
web/skins/Default/Common/CheckList/iconError.png
web/skins/Default/Common/CheckList/iconOk.png
web/skins/Default/Common/CheckList/iconPending.png
web/skins/Default/Common/CheckList/iconProcessing.gif
web/skins/Default/Common/CheckList/iconWarning.png
--- a/build.xml	Wed Nov 04 15:16:11 2009 +0100
+++ b/build.xml	Thu Nov 12 10:19:42 2009 +0100
@@ -309,6 +309,7 @@
     <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">
@@ -550,10 +551,18 @@
     <antcall target="db.apply.modules.sampledata" />
   </target>
 
+  <target name="update.generate.entities.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='RB21' ;
+                     DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
+        </sql>
+  </target>
   <target name="update.database" depends="init,code.rev">
     <antcall target="database.lib" />
     <antcall target="core.lib" />
     <ant dir="${base.db}" target="update.database.java" inheritAll="true" inheritRefs="true" />
+    <antcall target="update.generate.entities.status" inheritall="true" inheritrefs="true"/>
     <antcall target="generate.entities.quick" />
     <antcall target="db.apply.modules" />
   </target>
@@ -633,7 +642,8 @@
   <target name="apply.modules">
     <echo>Applying ${module} modules...</echo>
     <antcall target="update.database.mod" />
-    
+
+    <antcall target="update.generate.entities.status" inheritall="true" inheritrefs="true"/>
     <antcall target="generate.entities" />
     
     <antcall inheritall="true" inheritrefs="true" target="apply.module" />
@@ -663,6 +673,11 @@
   </target>
 
   <target name="apply.module">
+    <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='RB31' ;
+                 DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
+    </sql>
     <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask" fork="true" maxmemory="${build.maxmemory}">
       <arg line="'${base.src}'" />
       <classpath refid="project.class.path" />
Binary file src-db/database/lib/dbsourcemanager.jar has changed
--- a/src-db/database/lib/log4j.properties	Wed Nov 04 15:16:11 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-# Set root category priority to DEBUG and its only appender to A1.
-log4j.rootCategory=WARN, A1
-  
-# A1 is set to be a ConsoleAppender. 
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-  
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c - %m%n
-
-log4j.category.org.openbravo.translate.Translate=WARN
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Wed Nov 04 15:16:11 2009 +0100
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Thu Nov 12 10:19:42 2009 +0100
@@ -246834,6 +246834,7 @@
 <!--082F9742ADAF4BEF83228C4EAE5D4A8B-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--082F9742ADAF4BEF83228C4EAE5D4A8B-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--082F9742ADAF4BEF83228C4EAE5D4A8B-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--082F9742ADAF4BEF83228C4EAE5D4A8B-->  <AD_ELEMENT_ID><![CDATA[9D376EF8B99B40C88E4D2D2A172DE6A8]]></AD_ELEMENT_ID>
 <!--082F9742ADAF4BEF83228C4EAE5D4A8B-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--082F9742ADAF4BEF83228C4EAE5D4A8B-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--082F9742ADAF4BEF83228C4EAE5D4A8B-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -246881,7 +246882,9 @@
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--10CAC0D710AB4E14B4129E739B032BCC-->  <NAME><![CDATA[Createdby]]></NAME>
+<!--10CAC0D710AB4E14B4129E739B032BCC-->  <NAME><![CDATA[Created By]]></NAME>
+<!--10CAC0D710AB4E14B4129E739B032BCC-->  <DESCRIPTION><![CDATA[User who created this records]]></DESCRIPTION>
+<!--10CAC0D710AB4E14B4129E739B032BCC-->  <HELP><![CDATA[The Created By field indicates the user who created this record.]]></HELP>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <COLUMNNAME><![CDATA[Createdby]]></COLUMNNAME>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <AD_TABLE_ID><![CDATA[0DF2FECF5F054A1791A89A86709BC6C6]]></AD_TABLE_ID>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <AD_REFERENCE_ID><![CDATA[30]]></AD_REFERENCE_ID>
@@ -246895,6 +246898,7 @@
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--10CAC0D710AB4E14B4129E739B032BCC-->  <AD_ELEMENT_ID><![CDATA[246]]></AD_ELEMENT_ID>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--10CAC0D710AB4E14B4129E739B032BCC-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -246942,7 +246946,9 @@
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <NAME><![CDATA[AD_Org_ID]]></NAME>
+<!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <NAME><![CDATA[Organization]]></NAME>
+<!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
+<!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <COLUMNNAME><![CDATA[AD_Org_ID]]></COLUMNNAME>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <AD_TABLE_ID><![CDATA[0DF2FECF5F054A1791A89A86709BC6C6]]></AD_TABLE_ID>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
@@ -246958,6 +246964,7 @@
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <AD_ELEMENT_ID><![CDATA[113]]></AD_ELEMENT_ID>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--1661CC42DE8D4219B1EA46458C1C3E7F-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -247989,6 +247996,8 @@
 <!--27F6459357914767A29EABC06226D6D5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--27F6459357914767A29EABC06226D6D5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--27F6459357914767A29EABC06226D6D5-->  <NAME><![CDATA[Updated]]></NAME>
+<!--27F6459357914767A29EABC06226D6D5-->  <DESCRIPTION><![CDATA[x not implemented]]></DESCRIPTION>
+<!--27F6459357914767A29EABC06226D6D5-->  <HELP><![CDATA[The Updated field indicates the date that this record was updated.]]></HELP>
 <!--27F6459357914767A29EABC06226D6D5-->  <COLUMNNAME><![CDATA[Updated]]></COLUMNNAME>
 <!--27F6459357914767A29EABC06226D6D5-->  <AD_TABLE_ID><![CDATA[0DF2FECF5F054A1791A89A86709BC6C6]]></AD_TABLE_ID>
 <!--27F6459357914767A29EABC06226D6D5-->  <AD_REFERENCE_ID><![CDATA[16]]></AD_REFERENCE_ID>
@@ -248003,6 +248012,7 @@
 <!--27F6459357914767A29EABC06226D6D5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--27F6459357914767A29EABC06226D6D5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--27F6459357914767A29EABC06226D6D5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--27F6459357914767A29EABC06226D6D5-->  <AD_ELEMENT_ID><![CDATA[607]]></AD_ELEMENT_ID>
 <!--27F6459357914767A29EABC06226D6D5-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--27F6459357914767A29EABC06226D6D5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--27F6459357914767A29EABC06226D6D5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -248031,6 +248041,7 @@
 <!--2A28CB29D17040299CD76911DE64EC58-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--2A28CB29D17040299CD76911DE64EC58-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--2A28CB29D17040299CD76911DE64EC58-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--2A28CB29D17040299CD76911DE64EC58-->  <AD_ELEMENT_ID><![CDATA[8CF76E08562A480D96D45C04F42D095E]]></AD_ELEMENT_ID>
 <!--2A28CB29D17040299CD76911DE64EC58-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--2A28CB29D17040299CD76911DE64EC58-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--2A28CB29D17040299CD76911DE64EC58-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -261639,6 +261650,7 @@
 <!--5E168828581F4A39847C969F9D3646A1-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--5E168828581F4A39847C969F9D3646A1-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--5E168828581F4A39847C969F9D3646A1-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--5E168828581F4A39847C969F9D3646A1-->  <AD_ELEMENT_ID><![CDATA[BEADA4ABFE544524B69FEC20E82F2D95]]></AD_ELEMENT_ID>
 <!--5E168828581F4A39847C969F9D3646A1-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--5E168828581F4A39847C969F9D3646A1-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--5E168828581F4A39847C969F9D3646A1-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -261699,6 +261711,7 @@
 <!--5E61B952F67C41A8829B222A7C6D7947-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--5E61B952F67C41A8829B222A7C6D7947-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--5E61B952F67C41A8829B222A7C6D7947-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--5E61B952F67C41A8829B222A7C6D7947-->  <AD_ELEMENT_ID><![CDATA[BEADA4ABFE544524B69FEC20E82F2D95]]></AD_ELEMENT_ID>
 <!--5E61B952F67C41A8829B222A7C6D7947-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--5E61B952F67C41A8829B222A7C6D7947-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--5E61B952F67C41A8829B222A7C6D7947-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -267325,7 +267338,9 @@
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <NAME><![CDATA[AD_Client_ID]]></NAME>
+<!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <NAME><![CDATA[Client]]></NAME>
+<!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <DESCRIPTION><![CDATA[Client for this installation.]]></DESCRIPTION>
+<!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <HELP><![CDATA[A Client is a company or a legal entity. You cannot share data between Clients.]]></HELP>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <COLUMNNAME><![CDATA[AD_Client_ID]]></COLUMNNAME>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <AD_TABLE_ID><![CDATA[0DF2FECF5F054A1791A89A86709BC6C6]]></AD_TABLE_ID>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
@@ -267341,6 +267356,7 @@
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <AD_ELEMENT_ID><![CDATA[102]]></AD_ELEMENT_ID>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--7E5CC370CF414A1FA0D6671EBAA3EFFE-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -267968,6 +267984,7 @@
 <!--92B93A90825248C4A2A58E97165D4066-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--92B93A90825248C4A2A58E97165D4066-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--92B93A90825248C4A2A58E97165D4066-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--92B93A90825248C4A2A58E97165D4066-->  <AD_ELEMENT_ID><![CDATA[2E25DF9EA05D415B851BDB301BA12D0A]]></AD_ELEMENT_ID>
 <!--92B93A90825248C4A2A58E97165D4066-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--92B93A90825248C4A2A58E97165D4066-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--92B93A90825248C4A2A58E97165D4066-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -268398,7 +268415,9 @@
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <NAME><![CDATA[Updatedby]]></NAME>
+<!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <NAME><![CDATA[Updated By]]></NAME>
+<!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <DESCRIPTION><![CDATA[User who updated this records]]></DESCRIPTION>
+<!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <HELP><![CDATA[The Updated By field indicates the user who updated this record.]]></HELP>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <COLUMNNAME><![CDATA[Updatedby]]></COLUMNNAME>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <AD_TABLE_ID><![CDATA[0DF2FECF5F054A1791A89A86709BC6C6]]></AD_TABLE_ID>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <AD_REFERENCE_ID><![CDATA[30]]></AD_REFERENCE_ID>
@@ -268412,6 +268431,7 @@
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <AD_ELEMENT_ID><![CDATA[608]]></AD_ELEMENT_ID>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--9C56850497CE409C9C48FBB4C2A0F7C1-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -268956,7 +268976,9 @@
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--AA819DBCA81E4B359652391ACB6350A2-->  <NAME><![CDATA[Created]]></NAME>
+<!--AA819DBCA81E4B359652391ACB6350A2-->  <NAME><![CDATA[Creation Date]]></NAME>
+<!--AA819DBCA81E4B359652391ACB6350A2-->  <DESCRIPTION><![CDATA[The date that this record is completed.]]></DESCRIPTION>
+<!--AA819DBCA81E4B359652391ACB6350A2-->  <HELP><![CDATA[The Created field indicates the date that this record was created.]]></HELP>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <COLUMNNAME><![CDATA[Created]]></COLUMNNAME>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <AD_TABLE_ID><![CDATA[0DF2FECF5F054A1791A89A86709BC6C6]]></AD_TABLE_ID>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <AD_REFERENCE_ID><![CDATA[16]]></AD_REFERENCE_ID>
@@ -268971,6 +268993,7 @@
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--AA819DBCA81E4B359652391ACB6350A2-->  <AD_ELEMENT_ID><![CDATA[245]]></AD_ELEMENT_ID>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--AA819DBCA81E4B359652391ACB6350A2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
@@ -269451,7 +269474,11 @@
 <!--F5B615345408497B947554B7D37599D3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--F5B615345408497B947554B7D37599D3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--F5B615345408497B947554B7D37599D3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--F5B615345408497B947554B7D37599D3-->  <NAME><![CDATA[Isactive]]></NAME>
+<!--F5B615345408497B947554B7D37599D3-->  <NAME><![CDATA[Active]]></NAME>
+<!--F5B615345408497B947554B7D37599D3-->  <DESCRIPTION><![CDATA[A flag indicating whether this record is available for use or de-activated.]]></DESCRIPTION>
+<!--F5B615345408497B947554B7D37599D3-->  <HELP><![CDATA[There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reporting. There are two reasons for de-activating and not deleting records: 
+(1) The system requires the record for auditing purposes.
+(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are existing invoices for it. By de-activating the Business Partner you prevent it from being used in future transactions.]]></HELP>
 <!--F5B615345408497B947554B7D37599D3-->  <COLUMNNAME><![CDATA[Isactive]]></COLUMNNAME>
 <!--F5B615345408497B947554B7D37599D3-->  <AD_TABLE_ID><![CDATA[0DF2FECF5F054A1791A89A86709BC6C6]]></AD_TABLE_ID>
 <!--F5B615345408497B947554B7D37599D3-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
@@ -269466,6 +269493,7 @@
 <!--F5B615345408497B947554B7D37599D3-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--F5B615345408497B947554B7D37599D3-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--F5B615345408497B947554B7D37599D3-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--F5B615345408497B947554B7D37599D3-->  <AD_ELEMENT_ID><![CDATA[348]]></AD_ELEMENT_ID>
 <!--F5B615345408497B947554B7D37599D3-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--F5B615345408497B947554B7D37599D3-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--F5B615345408497B947554B7D37599D3-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Nov 04 15:16:11 2009 +0100
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Thu Nov 12 10:19:42 2009 +0100
@@ -21976,6 +21976,17 @@
 <!--17485BBD94A447C2A0C823181EF0F066-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--17485BBD94A447C2A0C823181EF0F066--></AD_ELEMENT>
 
+<!--2E25DF9EA05D415B851BDB301BA12D0A--><AD_ELEMENT>
+<!--2E25DF9EA05D415B851BDB301BA12D0A-->  <AD_ELEMENT_ID><![CDATA[2E25DF9EA05D415B851BDB301BA12D0A]]></AD_ELEMENT_ID>
+<!--2E25DF9EA05D415B851BDB301BA12D0A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--2E25DF9EA05D415B851BDB301BA12D0A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--2E25DF9EA05D415B851BDB301BA12D0A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--2E25DF9EA05D415B851BDB301BA12D0A-->  <COLUMNNAME><![CDATA[AD_Error_Log_ID]]></COLUMNNAME>
+<!--2E25DF9EA05D415B851BDB301BA12D0A-->  <NAME><![CDATA[AD_Error_Log_ID]]></NAME>
+<!--2E25DF9EA05D415B851BDB301BA12D0A-->  <PRINTNAME><![CDATA[AD_Error_Log_ID]]></PRINTNAME>
+<!--2E25DF9EA05D415B851BDB301BA12D0A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--2E25DF9EA05D415B851BDB301BA12D0A--></AD_ELEMENT>
+
 <!--35C50FAEA42311DDA55D001B388C05F0--><AD_ELEMENT>
 <!--35C50FAEA42311DDA55D001B388C05F0-->  <AD_ELEMENT_ID><![CDATA[35C50FAEA42311DDA55D001B388C05F0]]></AD_ELEMENT_ID>
 <!--35C50FAEA42311DDA55D001B388C05F0-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -24882,6 +24893,17 @@
 <!--8112CD30505211DE8286001CC0B8EF99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--8112CD30505211DE8286001CC0B8EF99--></AD_ELEMENT>
 
+<!--8CF76E08562A480D96D45C04F42D095E--><AD_ELEMENT>
+<!--8CF76E08562A480D96D45C04F42D095E-->  <AD_ELEMENT_ID><![CDATA[8CF76E08562A480D96D45C04F42D095E]]></AD_ELEMENT_ID>
+<!--8CF76E08562A480D96D45C04F42D095E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8CF76E08562A480D96D45C04F42D095E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8CF76E08562A480D96D45C04F42D095E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8CF76E08562A480D96D45C04F42D095E-->  <COLUMNNAME><![CDATA[Message]]></COLUMNNAME>
+<!--8CF76E08562A480D96D45C04F42D095E-->  <NAME><![CDATA[Message]]></NAME>
+<!--8CF76E08562A480D96D45C04F42D095E-->  <PRINTNAME><![CDATA[Message]]></PRINTNAME>
+<!--8CF76E08562A480D96D45C04F42D095E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8CF76E08562A480D96D45C04F42D095E--></AD_ELEMENT>
+
 <!--8F16AEFC996311DD812A001D09C4A2FE--><AD_ELEMENT>
 <!--8F16AEFC996311DD812A001D09C4A2FE-->  <AD_ELEMENT_ID><![CDATA[8F16AEFC996311DD812A001D09C4A2FE]]></AD_ELEMENT_ID>
 <!--8F16AEFC996311DD812A001D09C4A2FE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -24907,6 +24929,17 @@
 <!--9910D5BD35894A8FBBB365FB9239B711-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--9910D5BD35894A8FBBB365FB9239B711--></AD_ELEMENT>
 
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8--><AD_ELEMENT>
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8-->  <AD_ELEMENT_ID><![CDATA[9D376EF8B99B40C88E4D2D2A172DE6A8]]></AD_ELEMENT_ID>
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8-->  <COLUMNNAME><![CDATA[Error_Level]]></COLUMNNAME>
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8-->  <NAME><![CDATA[Error_Level]]></NAME>
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8-->  <PRINTNAME><![CDATA[Error_Level]]></PRINTNAME>
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9D376EF8B99B40C88E4D2D2A172DE6A8--></AD_ELEMENT>
+
 <!--A73AEF8F123F4B46A9265790ABF61737--><AD_ELEMENT>
 <!--A73AEF8F123F4B46A9265790ABF61737-->  <AD_ELEMENT_ID><![CDATA[A73AEF8F123F4B46A9265790ABF61737]]></AD_ELEMENT_ID>
 <!--A73AEF8F123F4B46A9265790ABF61737-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -25026,6 +25059,17 @@
 <!--B7E8DC4F085C46F3842E1AF96300D78B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--B7E8DC4F085C46F3842E1AF96300D78B--></AD_ELEMENT>
 
+<!--BEADA4ABFE544524B69FEC20E82F2D95--><AD_ELEMENT>
+<!--BEADA4ABFE544524B69FEC20E82F2D95-->  <AD_ELEMENT_ID><![CDATA[BEADA4ABFE544524B69FEC20E82F2D95]]></AD_ELEMENT_ID>
+<!--BEADA4ABFE544524B69FEC20E82F2D95-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--BEADA4ABFE544524B69FEC20E82F2D95-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--BEADA4ABFE544524B69FEC20E82F2D95-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--BEADA4ABFE544524B69FEC20E82F2D95-->  <COLUMNNAME><![CDATA[System_Status]]></COLUMNNAME>
+<!--BEADA4ABFE544524B69FEC20E82F2D95-->  <NAME><![CDATA[System_Status]]></NAME>
+<!--BEADA4ABFE544524B69FEC20E82F2D95-->  <PRINTNAME><![CDATA[System_Status]]></PRINTNAME>
+<!--BEADA4ABFE544524B69FEC20E82F2D95-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--BEADA4ABFE544524B69FEC20E82F2D95--></AD_ELEMENT>
+
 <!--D498E8A6CB6711DDBAC06BA41F5FDE11--><AD_ELEMENT>
 <!--D498E8A6CB6711DDBAC06BA41F5FDE11-->  <AD_ELEMENT_ID><![CDATA[D498E8A6CB6711DDBAC06BA41F5FDE11]]></AD_ELEMENT_ID>
 <!--D498E8A6CB6711DDBAC06BA41F5FDE11-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MODULE.xml	Wed Nov 04 15:16:11 2009 +0100
+++ b/src-db/database/sourcedata/AD_MODULE.xml	Thu Nov 12 10:19:42 2009 +0100
@@ -11,7 +11,7 @@
 <!--0-->  <HELP><![CDATA[Core module is the base one, all developments in core are included as part of the standard Openbravo ERP.]]></HELP>
 <!--0-->  <URL><![CDATA[www.openbravo.com]]></URL>
 <!--0-->  <TYPE><![CDATA[M]]></TYPE>
-<!--0-->  <LICENSE><![CDATA[Licensed under the Openbravo Public License version 1.0.
+<!--0-->  <LICENSE><![CDATA[Licensed under the Openbravo Public License version 1.0.
 You may obtain a copy of the License at http://www.openbravo.com/legal/license.html or in the legal folder of the Openbravo ERP core distribution.]]></LICENSE>
 <!--0-->  <JAVAPACKAGE><![CDATA[org.openbravo]]></JAVAPACKAGE>
 <!--0-->  <LICENSETYPE><![CDATA[OBPL]]></LICENSETYPE>
--- a/src-db/database/sourcedata/AD_TABLE.xml	Wed Nov 04 15:16:11 2009 +0100
+++ b/src-db/database/sourcedata/AD_TABLE.xml	Thu Nov 12 10:19:42 2009 +0100
@@ -9879,7 +9879,7 @@
 <!--0DF2FECF5F054A1791A89A86709BC6C6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--0DF2FECF5F054A1791A89A86709BC6C6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--0DF2FECF5F054A1791A89A86709BC6C6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--0DF2FECF5F054A1791A89A86709BC6C6-->  <NAME><![CDATA[AD_Error_Log]]></NAME>
+<!--0DF2FECF5F054A1791A89A86709BC6C6-->  <NAME><![CDATA[ADErrorLog]]></NAME>
 <!--0DF2FECF5F054A1791A89A86709BC6C6-->  <DESCRIPTION><![CDATA[Table that contains information related the warnings and errors that arised in the last build]]></DESCRIPTION>
 <!--0DF2FECF5F054A1791A89A86709BC6C6-->  <TABLENAME><![CDATA[AD_error_log]]></TABLENAME>
 <!--0DF2FECF5F054A1791A89A86709BC6C6-->  <CLASSNAME><![CDATA[ErrorLog]]></CLASSNAME>
@@ -9892,7 +9892,7 @@
 <!--0DF2FECF5F054A1791A89A86709BC6C6-->  <ISCHANGELOG><![CDATA[N]]></ISCHANGELOG>
 <!--0DF2FECF5F054A1791A89A86709BC6C6-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--0DF2FECF5F054A1791A89A86709BC6C6-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
-<!--0DF2FECF5F054A1791A89A86709BC6C6-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1C84B84E040007F01006125]]></AD_PACKAGE_ID>
+<!--0DF2FECF5F054A1791A89A86709BC6C6-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1CE4B84E040007F01006125]]></AD_PACKAGE_ID>
 <!--0DF2FECF5F054A1791A89A86709BC6C6--></AD_TABLE>
 
 <!--1F17CA14C9D04D1D99DB72BE2E4C585C--><AD_TABLE>
--- a/src/build.xml	Wed Nov 04 15:16:11 2009 +0100
+++ b/src/build.xml	Thu Nov 12 10:19:42 2009 +0100
@@ -799,7 +799,6 @@
       </zipfileset>
       <classes dir="${build}" />
     </war>
-	<antcall target="update.finalcompile.status" inheritall="true" inheritrefs="true"/>
   </target>
 
   <target name="generate-wsdd">
--- a/src/log4j.lcf	Wed Nov 04 15:16:11 2009 +0100
+++ b/src/log4j.lcf	Thu Nov 12 10:19:42 2009 +0100
@@ -17,13 +17,16 @@
 
 # File is used by ApplyModule and other ant tasks
 
-log4j.rootCategory=INFO, A1, O1
+log4j.rootCategory=INFO, A1, O1, O2
 
 # Additional Appender used for apply modules or other cases
 log4j.appender.O1=org.openbravo.utils.OBLogAppender
 log4j.appender.O1.layout=org.apache.log4j.PatternLayout
 log4j.appender.O1.layout.ConversionPattern=%-4r [%t] %-5p %c - %m%n
 
+# Additional Appender used for Improved Upgrade Process
+log4j.appender.O2=org.openbravo.utils.OBRebuildAppender
+
 # A1 is set to be a ConsoleAppender. 
 log4j.appender.A1=org.apache.log4j.ConsoleAppender
   
@@ -36,12 +39,12 @@
 log4j.category.org.openbravo.wad=INFO
 #log4j.category.org.openbravo.translate=INFO
 
-log4j.category.org=WARN
+#log4j.category.org=WARN
 
 #****************************************************
 #Part added for hibernate
 #****************************************************
-log4j.logger.org.hibernate=error
+log4j.logger.org.hibernate=WARN
 
 ### log HQL query parser activity 
 #log4j.logger.org.hibernate.hql.ast.AST=error
--- a/src/org/openbravo/erpCommon/ad_process/ApplyModules.java	Wed Nov 04 15:16:11 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_process/ApplyModules.java	Thu Nov 12 10:19:42 2009 +0100
@@ -20,19 +20,25 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.io.PrintStream;
 import java.io.PrintWriter;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.Properties;
 import java.util.Vector;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.log4j.PropertyConfigurator;
 import org.openbravo.base.provider.OBProvider;
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.utility.AntExecutor;
 import org.openbravo.erpCommon.utility.OBError;
@@ -43,6 +49,9 @@
 import org.openbravo.service.system.RestartTomcat;
 import org.openbravo.xmlEngine.XmlDocument;
 
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
+
 /**
  * Servlet for the Apply Modules method.
  * 
@@ -62,6 +71,10 @@
       printPage(request, response, vars);
     } else if (vars.commandIn("STARTAPPLY")) {
       startApply(response, vars);
+    } else if (vars.commandIn("UPDATESTATUS")) {
+      update(response, vars);
+    } else if (vars.commandIn("REQUESTERRORSTATE")) {
+      requesterrorstate(response, vars);
     } else if (vars.commandIn("UPDATELOG")) {
       updateLog(response, vars);
     } else if (vars.commandIn("GETERR")) {
@@ -98,7 +111,7 @@
     }
 
     final XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
-        "org/openbravo/erpCommon/ad_process/ApplyModules").createXmlDocument();
+        "org/openbravo/erpCommon/ad_process/ApplyModulesNew").createXmlDocument();
     xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
     xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\r\n");
     xmlDocument.setParameter("theme", vars.getTheme());
@@ -175,6 +188,118 @@
     RestartTomcat.restart();
   }
 
+  private ApplyModulesResponse fillResponse(String state) {
+    ApplyModulesResponse pet = new ApplyModulesResponse();
+    pet.setState(Integer.parseInt(state.replace("RB", "")));
+    PreparedStatement ps = null;
+    PreparedStatement ps2 = null;
+    PreparedStatement ps3 = null;
+    try {
+      ps = getPreparedStatement("SELECT MESSAGE FROM AD_ERROR_LOG WHERE ERROR_LEVEL='WARN' AND SYSTEM_STATUS LIKE ?");
+      ps.setString(1, "%" + state);
+      ps.executeQuery();
+      ResultSet rs = ps.getResultSet();
+      ArrayList<String> warnings = new ArrayList<String>();
+      while (rs.next()) {
+        warnings.add(rs.getString(1));
+      }
+      String[] warns = new String[warnings.size()];
+      for (int i = 0; i < warnings.size(); i++)
+        warns[i] = warnings.get(i);
+      pet.setWarnings(warnings.toArray(new String[0]));
+
+      ps2 = getPreparedStatement("SELECT MESSAGE FROM AD_ERROR_LOG WHERE ERROR_LEVEL='ERROR' AND SYSTEM_STATUS LIKE ?");
+      ps2.setString(1, "%" + state);
+      ps2.executeQuery();
+      ResultSet rs2 = ps2.getResultSet();
+      ArrayList<String> errors = new ArrayList<String>();
+      while (rs2.next()) {
+        errors.add(rs2.getString(1));
+      }
+      String[] errs = new String[errors.size()];
+      for (int i = 0; i < errors.size(); i++)
+        errs[i] = errors.get(i);
+      pet.setErrors(errs);
+
+      ps3 = getPreparedStatement("SELECT MESSAGE FROM AD_ERROR_LOG ORDER BY CREATED DESC");
+      ps3.executeQuery();
+      ResultSet rs3 = ps3.getResultSet();
+      if (rs3.next()) {
+        pet.setLastmessage(rs3.getString(1));
+      }
+
+    } catch (Exception e) {
+      log4j.error("Error while building Response object", e);
+    } finally {
+      try {
+        releasePreparedStatement(ps3);
+        releasePreparedStatement(ps2);
+        releasePreparedStatement(ps);
+      } catch (SQLException e2) {
+        e2.printStackTrace();
+      }
+    }
+    return pet;
+  }
+
+  private void update(HttpServletResponse response, VariablesSecureApp vars) {
+    PreparedStatement ps = null;
+    try {
+      ps = getPreparedStatement("SELECT SYSTEM_STATUS FROM AD_SYSTEM_INFO");
+      ps.executeQuery();
+      ResultSet rs = ps.getResultSet();
+      rs.next();
+      String state = rs.getString(1);
+      ApplyModulesResponse pet = fillResponse(state);
+      if (pet.getErrors().length > 0)
+        pet.setStatusofstate("Error");
+      else if (pet.getWarnings().length > 0)
+        pet.setStatusofstate("Warning");
+      else
+        pet.setStatusofstate("Processing");
+      response.setContentType("text/plain; charset=UTF-8");
+      final PrintWriter out = response.getWriter();
+      String strResult;
+      XStream xs = new XStream(new JettisonMappedXmlDriver());
+      xs.alias("Response", ApplyModulesResponse.class);
+      strResult = xs.toXML(pet);
+      out.print(strResult);
+      out.close();
+    } catch (Exception e) {
+      log4j.error("Error while updating the system status in the rebuild window.", e);
+    } finally {
+      if (ps != null)
+        try {
+          releasePreparedStatement(ps);
+        } catch (SQLException e) {
+          log4j.error(e);
+        }
+    }
+  }
+
+  private void requesterrorstate(HttpServletResponse response, VariablesSecureApp vars) {
+    String state = vars.getStringParameter("reqStatus");
+    ApplyModulesResponse pet = fillResponse(state);
+    if (pet.getErrors().length > 0)
+      pet.setStatusofstate("Error");
+    else if (pet.getWarnings().length > 0)
+      pet.setStatusofstate("Warning");
+    else
+      pet.setStatusofstate("Success");
+    response.setContentType("text/plain; charset=UTF-8");
+    try {
+      final PrintWriter out = response.getWriter();
+      String strResult;
+      XStream xs = new XStream(new JettisonMappedXmlDriver());
+      xs.alias("Response", ApplyModulesResponse.class);
+      strResult = xs.toXML(pet);
+      out.print(strResult);
+      out.close();
+    } catch (IOException e) {
+      log4j.error("Error while updating the system status in the rebuild window.", e);
+    }
+  }
+
   /**
    * Method to be called via AJAX. Creates a new AntExecutor object, saves it in session and
    * executes the apply modules task on it.
@@ -187,20 +312,47 @@
   private void startApply(HttpServletResponse response, VariablesSecureApp vars)
       throws IOException, ServletException {
     // final PrintStream oldOut=System.out;
+    boolean admin = OBContext.getOBContext().setInAdministratorMode(true);
+    PreparedStatement ps = null;
+    PreparedStatement ps2 = null;
+    PreparedStatement ps3 = null;
+    AntExecutor ant = null;
     try {
-      final AntExecutor ant = new AntExecutor(vars.getSessionValue("#sourcePath"));
+      ps = getPreparedStatement("DELETE FROM AD_ERROR_LOG");
+      ps.executeUpdate();
+      ps2 = getPreparedStatement("UPDATE AD_SYSTEM_INFO SET SYSTEM_STATUS='RB11'");
+      ps2.executeUpdate();
+
+      Properties props = new Properties();
+      props.setProperty("log4j.appender.DB", "org.openbravo.utils.OBRebuildAppender");
+      props.setProperty("log4j.appender.DB.Basedir", vars.getSessionValue("#sourcePath"));
+      props.setProperty("log4j.rootCategory", "INFO,R,DB");
+      PropertyConfigurator.configure(props);
+
+      ant = new AntExecutor(vars.getSessionValue("#sourcePath"));
       String fileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + "-apply.log";
       // final OBPrintStream obps=new OBPrintStream(new
       // PrintStream(response.getOutputStream()));
       // System.setOut(obps);
 
       // ant.setOBPrintStreamLog(response.getWriter());
-      final PrintStream out = new PrintStream(response.getOutputStream());
-      ant.setOBPrintStreamLog(new PrintStream(out));
 
-      fileName = ant.setLogFile(fileName);
+      final XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+          "org/openbravo/erpCommon/ad_process/ApplyModulesNew").createXmlDocument();
+
+      response.setContentType("text/html; charset=UTF-8");
+      final PrintWriter out = response.getWriter();
+
+      out.println(xmlDocument.print());
+
+      out.flush();
+      ant.setLogFile(fileName);
+      // final PrintStream out = new PrintStream(response.getOutputStream());
+      // ant.setOBPrintStreamLog(new PrintWriter(out));
+
+      // fileName = ant.setLogFile(fileName);
       // obps.setLogFile(new File(fileName+".db"));
-      ant.setLogFileInOBPrintStream(new File(fileName));
+      // ant.setLogFileInOBPrintStream(new File(fileName));
       vars.setSessionObject("ApplyModules|Log", ant);
 
       // do not execute tranlsation process (all entries should be already in the module)
@@ -228,22 +380,24 @@
         ant.setProperty("module", unnappliedModules);
       }
       response.setContentType("text/plain; charset=UTF-8");
-      out.print("Shutting down scheduler (background processes) ...");
       // We first shutdown the background process, so that it doesn't interfere
       // with the rebuild process
       OBScheduler.getInstance().getScheduler().shutdown(true);
-      out.println(" done.\n");
       ant.runTask(tasks);
 
-      ant.setFinished(true);
+      // ant.setFinished(true);
 
-      if (ant.hasErrorOccured()) {
-        createModuleLog(false, ant.getErr());
-      } else {
-        createModuleLog(true, null);
+      /*
+       * if (ant.hasErrorOccured()) { createModuleLog(false, ant.getErr()); } else {
+       * createModuleLog(true, null); }
+       */
+      PreparedStatement psErr = getPreparedStatement("SELECT MESSAGE FROM AD_ERROR_LOG WHERE ERROR_LEVEL='ERROR'");
+      psErr.executeQuery();
+      ResultSet rsErr = psErr.getResultSet();
+      if (!rsErr.next()) {
+        ps3 = getPreparedStatement("UPDATE AD_SYSTEM_INFO SET SYSTEM_STATUS='RB60'");
+        ps3.executeUpdate();
       }
-
-      out.println("finished");
       out.close();
     } catch (final Exception e) {
       e.printStackTrace();
@@ -253,7 +407,18 @@
       createModuleLog(false, e.getMessage());
       OBDal.getInstance().commitAndClose();
     } finally {
-      // System.setOut(oldOut);
+      try {
+        Properties props = new Properties();
+        props.setProperty("log4j.rootCategory", "INFO,R");
+        PropertyConfigurator.configure(props);
+        ant.closeLogFile();
+        releasePreparedStatement(ps);
+        releasePreparedStatement(ps2);
+        releasePreparedStatement(ps3);
+      } catch (SQLException e) {
+        log4j.error(e);
+      }
+      OBContext.getOBContext().setInAdministratorMode(admin);
     }
   }
 
@@ -316,39 +481,46 @@
    */
   private void getError(HttpServletResponse response, VariablesSecureApp vars) throws IOException,
       ServletException {
-    if (log4j.isDebugEnabled())
-      log4j.debug("Output: print page errors");
-    final XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
-        "org/openbravo/erpCommon/businessUtility/MessageJS").createXmlDocument();
-    String type = "Hidden";
-    String title = "";
-    String description = "";
-    final String strLanguage = vars.getLanguage();
+    OBError error = new OBError();
+    PreparedStatement ps;
+    PreparedStatement ps2;
+    try {
+      ps = getPreparedStatement("SELECT MESSAGE FROM AD_ERROR_LOG WHERE ERROR_LEVEL='ERROR'");
+      ps.executeQuery();
+      ResultSet rs = ps.getResultSet();
+      if (rs.next()) {
+        error.setType("Error");
+        error.setTitle("Error");
+        error
+            .setMessage("An error has occurred in the build. For a list of actions to take, go to <a href=\"http://wiki.openbravo.com/wiki/Projects/Improved_Upgrade_Process\" target=\"_blank\">this link</a>.");
 
-    try {
-      final AntExecutor ant = (AntExecutor) vars.getSessionObject("ApplyModules|Log");
-      if (ant != null)
-        description = ant.getErr();
-      if (description.startsWith("SuccessRebuild")) {
-        type = "Success";
-        title = Utility.messageBD(this, type, strLanguage);
-        description = "<![CDATA[" + Utility.messageBD(this, description, strLanguage) + "]]>";
       } else {
-        type = "Error";
-        title = Utility.messageBD(this, type, strLanguage);
-        description = "<![CDATA[" + description + "]]>";
+        ps2 = getPreparedStatement("SELECT MESSAGE FROM AD_ERROR_LOG WHERE ERROR_LEVEL='WARN'");
+        ps2.executeQuery();
+        ResultSet rs2 = ps2.getResultSet();
+        if (rs2.next()) {
+          error.setType("Warning");
+          error.setTitle("Warning");
+          error
+              .setMessage("There were warnings on the build. The application will run, but you should check them to see if there were important. Go to <a href=\"http://wiki.openbravo.com/wiki/Projects/Improved_Upgrade_Process\" target=\"_blank\">this link</a> for more information. <b>You must now restart the application container</b> to see the changes.");
+
+        } else {
+          error.setType("Success");
+          error.setTitle("Success");
+          error
+              .setMessage("The build was completed succesfully. <b>You must now restart the application container</b> to see the changes.");
+        }
       }
-      xmlDocument.setParameter("type", type);
-      xmlDocument.setParameter("title", title);
-      xmlDocument.setParameter("description", Utility.formatMessageBDToHtml(description));
-      response.setContentType("text/xml; charset=UTF-8");
-      response.setHeader("Cache-Control", "no-cache");
-      final PrintWriter out = response.getWriter();
-      out.println(xmlDocument.print());
-      out.close();
-    } catch (final Exception e) {
-      description = "";
+    } catch (Exception e) {
+      log4j.error("Error while returning the error to the rebuild window", e);
     }
+
+    XStream xs = new XStream(new JettisonMappedXmlDriver());
+    xs.alias("OBError", OBError.class);
+    String strResult = xs.toXML(error);
+    final PrintWriter out = response.getWriter();
+    out.print(strResult);
+    out.close();
   }
 
   /**
--- a/src/org/openbravo/erpCommon/utility/AntExecutor.java	Wed Nov 04 15:16:11 2009 +0100
+++ b/src/org/openbravo/erpCommon/utility/AntExecutor.java	Thu Nov 12 10:19:42 2009 +0100
@@ -19,7 +19,9 @@
 package org.openbravo.erpCommon.utility;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -30,6 +32,7 @@
 import org.apache.tools.ant.DefaultLogger;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.listener.Log4jListener;
 import org.openbravo.utils.OBLogAppender;
 
 /**
@@ -47,6 +50,8 @@
   private String returnMessage;
   private PrintWriter out;
 
+  private FileOutputStream logFile;
+
   /**
    * Initializes a newly created AntExecutor object assigning it the build.xml file to execute tasks
    * from and the base directory where they will be executed.
@@ -117,19 +122,36 @@
    * @return - The complete file name (including directory)
    * @throws Exception
    */
-  public String setLogFile(String name) throws Exception {
-    final File dir = new File(baseDir + "/log");
-    if (!dir.exists())
-      if (!dir.mkdir())
-        return null;
-    return setLogFile(baseDir + "/log", name);
-  }
-
+  // public String setLogFile(String name) throws Exception {
+  // final File dir = new File(baseDir + "/log");
+  // if (!dir.exists())
+  // if (!dir.mkdir())
+  // return null;
+  // return setLogFile(baseDir + "/log", name);
+  // }
   public void setLogFileInOBPrintStream(File f) {
     log.setLogFile(f);
     err.setLogFile(f);
   }
 
+  public void setLogFile(String filename) {
+    File file = new File(baseDir + "/log", filename);
+    final DefaultLogger logger1 = new DefaultLogger();
+    try {
+      logFile = new FileOutputStream(file);
+      PrintStream ps = new PrintStream(logFile);
+      logger1.setOutputPrintStream(ps);
+      logger1.setErrorPrintStream(ps);
+      logger1.setMessageOutputLevel(Project.MSG_INFO);
+      project.addBuildListener(logger1);
+
+      Log4jListener listener = new Log4jListener();
+      project.addBuildListener(listener);
+    } catch (FileNotFoundException e) {
+      logger.error("Error assigning rebuild log file.", e);
+    }
+  }
+
   /**
    * Sets two OBPrintStream objects to maintain the execution log. One is for standard log and the
    * other one for the errors.
@@ -274,4 +296,13 @@
   public boolean hasErrorOccured() {
     return !getErr().startsWith("SuccessRebuild");
   }
+
+  public void closeLogFile() {
+    try {
+      if (logFile != null) {
+        logFile.close();
+      }
+    } catch (IOException e) {
+    }
+  }
 }