From 911d7e4f3eae3c0bac52f4cbebf62f14373c2cd9 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 13 Feb 2008 06:24:51 +0000 Subject: [PATCH] Implement security mechanism for [ 1851190 ] Running outdated client can cause data corruption --- .../adempiere/process/SignDatabaseBuild.java | 71 +++++++++++++++++ base/src/org/compiere/model/I_AD_System.java | 18 +++++ base/src/org/compiere/model/X_AD_System.java | 45 ++++++++++- base/src/org/compiere/util/DB.java | 58 ++++++++++++++ client/src/org/compiere/apps/AMenu.java | 5 ++ install/Adempiere/RUN_SignDatabaseBuild.bat | 25 ++++++ install/Adempiere/RUN_SignDatabaseBuild.sh | 21 +++++ install/Adempiere/RUN_setup.bat | 10 ++- install/Adempiere/RUN_setup.sh | 4 +- install/Adempiere/RUN_silentsetup.bat | 10 ++- install/Adempiere/RUN_silentsetup.sh | 2 + migration/331b-trunk/097_1851190.sql | 76 +++++++++++++++++++ .../331b-trunk/postgresql/097_1851190.sql | 76 +++++++++++++++++++ serverRoot/src/web/adempiere.jnlp | 9 ++- utils/RUN_DBRestore.bat | 2 + utils/RUN_DBRestore.sh | 2 + utils/RUN_ImportAdempiere.bat | 2 + utils/RUN_ImportAdempiere.sh | 2 + 18 files changed, 428 insertions(+), 10 deletions(-) create mode 100644 base/src/org/adempiere/process/SignDatabaseBuild.java create mode 100644 install/Adempiere/RUN_SignDatabaseBuild.bat create mode 100644 install/Adempiere/RUN_SignDatabaseBuild.sh create mode 100644 migration/331b-trunk/097_1851190.sql create mode 100644 migration/331b-trunk/postgresql/097_1851190.sql diff --git a/base/src/org/adempiere/process/SignDatabaseBuild.java b/base/src/org/adempiere/process/SignDatabaseBuild.java new file mode 100644 index 0000000000..69ea0e78ed --- /dev/null +++ b/base/src/org/adempiere/process/SignDatabaseBuild.java @@ -0,0 +1,71 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.adempiere.process; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.Adempiere; +import org.compiere.model.MClient; +import org.compiere.model.MSequence; +import org.compiere.process.SvrProcess; +import org.compiere.util.CLogMgt; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Trx; + +/** + * Sign Database Build + * [ 1851190 ] Running outdated client can cause data corruption + * + * @author Carlos Ruiz + */ +public class SignDatabaseBuild +{ + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (SignDatabaseBuild.class); + + public static void main(String[] args) throws Exception + { + Adempiere.startupEnvironment(false); + CLogMgt.setLevel(Level.FINE); + s_log.info("Sign Database Build"); + s_log.info("-------------------"); + + PreparedStatement updateStmt = null; + try { + updateStmt = DB.prepareStatement( + "UPDATE AD_System " + + "SET LastBuildInfo = ? " + + "WHERE AD_System_ID = 0", + null); + updateStmt.setString(1, Adempiere.getImplementationVersion()); + System.out.println(updateStmt); + updateStmt.executeUpdate(); + + } catch (Exception ex) { + throw ex; + } finally { + DB.close(updateStmt); + } + + } + +} // SignDatabaseBuild \ No newline at end of file diff --git a/base/src/org/compiere/model/I_AD_System.java b/base/src/org/compiere/model/I_AD_System.java index 15effb8ff8..46a48369aa 100644 --- a/base/src/org/compiere/model/I_AD_System.java +++ b/base/src/org/compiere/model/I_AD_System.java @@ -200,6 +200,15 @@ public interface I_AD_System */ public boolean isAutoErrorReport(); + /** Column name IsFailOnBuildDiffer */ + public static final String COLUMNNAME_IsFailOnBuildDiffer = "IsFailOnBuildDiffer"; + + /** Set Fail if Build Differ */ + public void setIsFailOnBuildDiffer (boolean IsFailOnBuildDiffer); + + /** Get Fail if Build Differ */ + public boolean isFailOnBuildDiffer(); + /** Column name IsFailOnMissingModelValidator */ public static final String COLUMNNAME_IsFailOnMissingModelValidator = "IsFailOnMissingModelValidator"; @@ -248,6 +257,15 @@ public interface I_AD_System */ public String getLDAPHost(); + /** Column name LastBuildInfo */ + public static final String COLUMNNAME_LastBuildInfo = "LastBuildInfo"; + + /** Set Last Build Info */ + public void setLastBuildInfo (String LastBuildInfo); + + /** Get Last Build Info */ + public String getLastBuildInfo(); + /** Column name Name */ public static final String COLUMNNAME_Name = "Name"; diff --git a/base/src/org/compiere/model/X_AD_System.java b/base/src/org/compiere/model/X_AD_System.java index 638ad707df..8f054d9775 100644 --- a/base/src/org/compiere/model/X_AD_System.java +++ b/base/src/org/compiere/model/X_AD_System.java @@ -47,6 +47,8 @@ public class X_AD_System extends PO implements I_AD_System, I_Persistent setIsAllowStatistics (false); setIsAutoErrorReport (true); // Y + setIsFailOnBuildDiffer (false); +// N setIsFailOnMissingModelValidator (true); // Y setName (null); @@ -338,6 +340,27 @@ public class X_AD_System extends PO implements I_AD_System, I_Persistent return false; } + /** Set Fail if Build Differ. + @param IsFailOnBuildDiffer Fail if Build Differ */ + public void setIsFailOnBuildDiffer (boolean IsFailOnBuildDiffer) + { + set_Value (COLUMNNAME_IsFailOnBuildDiffer, Boolean.valueOf(IsFailOnBuildDiffer)); + } + + /** Get Fail if Build Differ. + @return Fail if Build Differ */ + public boolean isFailOnBuildDiffer () + { + Object oo = get_Value(COLUMNNAME_IsFailOnBuildDiffer); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Fail on Missing Model Validator. @param IsFailOnMissingModelValidator Fail on Missing Model Validator */ public void setIsFailOnMissingModelValidator (boolean IsFailOnMissingModelValidator) @@ -429,6 +452,26 @@ public class X_AD_System extends PO implements I_AD_System, I_Persistent return (String)get_Value(COLUMNNAME_LDAPHost); } + /** Set Last Build Info. + @param LastBuildInfo Last Build Info */ + public void setLastBuildInfo (String LastBuildInfo) + { + + if (LastBuildInfo != null && LastBuildInfo.length() > 255) + { + log.warning("Length > 255 - truncated"); + LastBuildInfo = LastBuildInfo.substring(0, 255); + } + set_Value (COLUMNNAME_LastBuildInfo, LastBuildInfo); + } + + /** Get Last Build Info. + @return Last Build Info */ + public String getLastBuildInfo () + { + return (String)get_Value(COLUMNNAME_LastBuildInfo); + } + /** Set Name. @param Name Alphanumeric identifier of the entity @@ -577,7 +620,7 @@ public class X_AD_System extends PO implements I_AD_System, I_Persistent */ public void setRecord_ID (int Record_ID) { - if (Record_ID <= 0) + if (Record_ID < 0) set_Value (COLUMNNAME_Record_ID, null); else set_Value (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID)); diff --git a/base/src/org/compiere/util/DB.java b/base/src/org/compiere/util/DB.java index 10fd3f995d..aab7d9ba5a 100644 --- a/base/src/org/compiere/util/DB.java +++ b/base/src/org/compiere/util/DB.java @@ -577,6 +577,64 @@ public final class DB } // isDatabaseOK + /************************************************************************** + * Check Build Version of Database against running client + * @param ctx context + * @return true if Database version (date) is the same + */ + public static boolean isBuildOK (Properties ctx) + { +// Check Build + String buildClient = Adempiere.getImplementationVersion(); + String buildDatabase = ""; + boolean failOnBuild = false; + String sql = "SELECT LastBuildInfo, IsFailOnBuildDiffer FROM AD_System"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = prepareStatement(sql, null); + rs = pstmt.executeQuery(); + if (rs.next()) { + buildDatabase = rs.getString(1); + failOnBuild = rs.getString(2).equals("Y"); + } + } + catch (SQLException e) + { + log.log(Level.SEVERE, "Problem with AD_System Table - Run system.sql script - " + e.toString()); + return false; + } + finally + { + close(rs); + close(pstmt); + rs= null; + pstmt = null; + } + log.info("Build DB=" + buildDatabase); + log.info("Build Cl=" + buildClient); + // Identical DB version + if (buildClient.equals(buildDatabase)) + return true; + + String AD_Message = "BuildVersionError"; + String title = org.compiere.Adempiere.getName() + " " + Msg.getMsg(ctx, AD_Message, true); + // The program assumes build version {0}, but database has build Version {1}. + String msg = Msg.getMsg(ctx, AD_Message); // complete message + msg = MessageFormat.format(msg, new Object[] {buildClient, buildDatabase}); + if (! failOnBuild) { + log.warning(msg); + return true; + } + JOptionPane.showMessageDialog (null, + msg, + title, JOptionPane.ERROR_MESSAGE); + Env.exitEnv(1); + return false; + } // isDatabaseOK + + /************************************************************************** * Close Target */ diff --git a/client/src/org/compiere/apps/AMenu.java b/client/src/org/compiere/apps/AMenu.java index 1aaec7243b..436a37342e 100644 --- a/client/src/org/compiere/apps/AMenu.java +++ b/client/src/org/compiere/apps/AMenu.java @@ -229,6 +229,7 @@ public final class AMenu extends CFrame * Show Login Screen - if not successful - exit */ log.finer("Login"); + ALogin login = new ALogin(splash); if (!login.initLogin()) // no automatic login { @@ -245,6 +246,10 @@ public final class AMenu extends CFrame AEnv.exit(1); } + // Check Build + if (!DB.isBuildOK(m_ctx)) + AEnv.exit(1); + // Check DB (AppsServer Version checked in Login) DB.isDatabaseOK(m_ctx); } // initSystem diff --git a/install/Adempiere/RUN_SignDatabaseBuild.bat b/install/Adempiere/RUN_SignDatabaseBuild.bat new file mode 100644 index 0000000000..532e47f58d --- /dev/null +++ b/install/Adempiere/RUN_SignDatabaseBuild.bat @@ -0,0 +1,25 @@ +@Title Install Adempiere Server +@Rem $Header: /cvsroot/adempiere/install/Adempiere/RUN_setup.bat,v 1.19 2005/09/08 21:54:12 jjanke Exp $ +@Echo off + + +@if not "%JAVA_HOME%" == "" goto JAVA_HOME_OK +@Set JAVA=java +@Echo JAVA_HOME is not set. +@Echo You may not be able to start the required Setup window !! +@Echo Set JAVA_HOME to the directory of your local 1.5 JDK. +@Echo If you experience problems, run utils/WinEnv.js +@Echo Example: cscript utils\WinEnv.js C:\Adempiere "C:\Program Files\Java\jdk1.5.0_04" +goto START + +:JAVA_HOME_OK +@Set JAVA=%JAVA_HOME%\bin\java + + +:START +@Echo ======================================= +@Echo Sign Database Build +@Echo ======================================= +@SET CP=lib\CInstall.jar;lib\Adempiere.jar;lib\CCTools.jar;lib\oracle.jar;lib\fyracle.jar;lib\derby.jar;lib\jboss.jar;lib\postgresql.jar; + +@"%JAVA%" -classpath %CP% -DADEMPIERE_HOME=%ADEMPIERE_HOME% org.adempiere.process.SignDatabaseBuild \ No newline at end of file diff --git a/install/Adempiere/RUN_SignDatabaseBuild.sh b/install/Adempiere/RUN_SignDatabaseBuild.sh new file mode 100644 index 0000000000..6db928b621 --- /dev/null +++ b/install/Adempiere/RUN_SignDatabaseBuild.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +echo Install Adempiere Server +# $Header: /cvsroot/adempiere/install/Adempiere/RUN_setup.sh,v 1.19 2005/09/08 21:54:12 jjanke Exp $ + +if [ $JAVA_HOME ]; then + JAVA=$JAVA_HOME/bin/java +else + JAVA=java + echo JAVA_HOME is not set. + echo You may not be able to start the Setup + echo Set JAVA_HOME to the directory of your local JDK. +fi + + +echo =================================== +echo Sign Database Build +echo =================================== +CP=lib/CInstall.jar:lib/Adempiere.jar:lib/CCTools.jar:lib/oracle.jar:lib/derby.jar:lib/fyracle.jar:lib/jboss.jar:lib/postgresql.jar: + +$JAVA -classpath $CP -DADEMPIERE_HOME=$ADEMPIERE_HOME org.adempiere.process.SignDatabaseBuild \ No newline at end of file diff --git a/install/Adempiere/RUN_setup.bat b/install/Adempiere/RUN_setup.bat index c872b29ed4..1a8674f74b 100644 --- a/install/Adempiere/RUN_setup.bat +++ b/install/Adempiere/RUN_setup.bat @@ -32,9 +32,9 @@ goto START @Echo ErrorLevel = %ERRORLEVEL% @IF NOT ERRORLEVEL = 1 GOTO NEXT @Echo *************************************** -@Echo Check the error messabe above. +@Echo Check the error message above. @Echo *************************************** -@Echo Maske sure that the environment is set correctly! +@Echo Make sure that the environment is set correctly! @Echo Set environment variable JAVA_HOME manually @Echo or use WinEnv.js in the util directory @Echo *************************************** @@ -43,6 +43,12 @@ goto START :NEXT + +@Rem =================================== +@Rem Sign Database Build +@Rem =================================== +@"%JAVA%" -classpath %CP% -DADEMPIERE_HOME=%ADEMPIERE_HOME% org.adempiere.process.SignDatabaseBuild + @Rem =================================== @Rem Setup Adempiere Environment @Rem =================================== diff --git a/install/Adempiere/RUN_setup.sh b/install/Adempiere/RUN_setup.sh index 8044217150..ab41a04acf 100644 --- a/install/Adempiere/RUN_setup.sh +++ b/install/Adempiere/RUN_setup.sh @@ -28,6 +28,8 @@ ARGS=CONFIG $JAVA -classpath $CP -DADEMPIERE_HOME=$ADEMPIERE_HOME org.compiere.install.Setup $ARGS +# Sign database build +$JAVA -classpath $CP -DADEMPIERE_HOME=$ADEMPIERE_HOME org.adempiere.process.SignDatabaseBuild #echo =================================== #echo Setup Adempiere Server Environment @@ -49,4 +51,4 @@ find . -name '*.sh' -exec chmod a+x '{}' \; #%JAVA% -classpath lib/Adempiere.jar:lib/AdempiereCLib.jar org.compiere.install.ConnectTest localhost echo . -echo For problems, check log file in base directory +echo For problems, check log file in base directory \ No newline at end of file diff --git a/install/Adempiere/RUN_silentsetup.bat b/install/Adempiere/RUN_silentsetup.bat index 8cac8857f3..6ccaad663a 100644 --- a/install/Adempiere/RUN_silentsetup.bat +++ b/install/Adempiere/RUN_silentsetup.bat @@ -32,9 +32,9 @@ goto START @Echo ErrorLevel = %ERRORLEVEL% @IF NOT ERRORLEVEL = 1 GOTO NEXT @Echo *************************************** -@Echo Check the error messabe above. +@Echo Check the error message above. @Echo *************************************** -@Echo Maske sure that the environment is set correctly! +@Echo Make sure that the environment is set correctly! @Echo Set environment variable JAVA_HOME manually @Echo or use WinEnv.js in the util directory @Echo *************************************** @@ -44,6 +44,12 @@ goto START :NEXT + +@Rem =================================== +@Rem Sign Database Build +@Rem =================================== +@"%JAVA%" -classpath %CP% -DADEMPIERE_HOME=%ADEMPIERE_HOME% org.adempiere.process.SignDatabaseBuild + @Rem =================================== @Rem Setup Adempiere Environment @Rem =================================== diff --git a/install/Adempiere/RUN_silentsetup.sh b/install/Adempiere/RUN_silentsetup.sh index 6ff44691e8..0bf4e94c7d 100644 --- a/install/Adempiere/RUN_silentsetup.sh +++ b/install/Adempiere/RUN_silentsetup.sh @@ -25,6 +25,8 @@ ARGS=CONFIG $JAVA -classpath $CP -DADEMPIERE_HOME=$ADEMPIERE_HOME org.compiere.install.SilentSetup $ARGS +# Sign database build +$JAVA -classpath $CP -DADEMPIERE_HOME=$ADEMPIERE_HOME org.adempiere.process.SignDatabaseBuild echo =================================== echo Make .sh executable & set Env diff --git a/migration/331b-trunk/097_1851190.sql b/migration/331b-trunk/097_1851190.sql new file mode 100644 index 0000000000..16c21d0ce6 --- /dev/null +++ b/migration/331b-trunk/097_1851190.sql @@ -0,0 +1,76 @@ +-- Feb 12, 2008 11:33:32 PM COT +-- 1851190 - Running outdated client can cause data corruption +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53346,0,'LastBuildInfo',TO_DATE('2008-02-12 23:33:30','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Last Build Info','Last Build Info',TO_DATE('2008-02-12 23:33:30','YYYY-MM-DD HH24:MI:SS'),100) +; + +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53346 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,54353,53346,0,10,531,'LastBuildInfo',TO_DATE('2008-02-12 23:34:02','YYYY-MM-DD HH24:MI:SS'),100,'D',255,'Y','N','N','N','N','N','N','N','N','N','Y','Last Build Info',0,TO_DATE('2008-02-12 23:34:02','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=54353 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53347,0,'IsFailOnBuildDiffer',TO_DATE('2008-02-12 23:34:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Fail if Build Differ','Fail if Build Differ',TO_DATE('2008-02-12 23:34:52','YYYY-MM-DD HH24:MI:SS'),100) +; + +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53347 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,54354,53347,0,20,531,'IsFailOnBuildDiffer',TO_DATE('2008-02-12 23:35:26','YYYY-MM-DD HH24:MI:SS'),100,'N','D',1,'Y','N','N','N','N','Y','N','N','N','N','Y','Fail if Build Differ',0,TO_DATE('2008-02-12 23:35:26','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=54354 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +ALTER TABLE AD_System ADD LastBuildInfo NVARCHAR2(255) +; + +UPDATE AD_Field SET Name='Fail if Build Differ', Description=NULL, Help=NULL WHERE AD_Column_ID=54354 AND IsCentrallyMaintained='Y' +; + +ALTER TABLE AD_System ADD IsFailOnBuildDiffer CHAR(1) DEFAULT 'N' CHECK (IsFailOnBuildDiffer IN ('Y','N')) NOT NULL +; + +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,54354,54398,0,440,TO_DATE('2008-02-13 00:07:59','YYYY-MM-DD HH24:MI:SS'),100,1,'D','Y','Y','Y','N','N','N','N','N','Fail if Build Differ',TO_DATE('2008-02-13 00:07:59','YYYY-MM-DD HH24:MI:SS'),100) +; + +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=54398 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,54353,54399,0,440,TO_DATE('2008-02-13 00:08:02','YYYY-MM-DD HH24:MI:SS'),100,255,'D','Y','Y','Y','N','N','N','N','N','Last Build Info',TO_DATE('2008-02-13 00:08:02','YYYY-MM-DD HH24:MI:SS'),100) +; + +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=54399 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +UPDATE AD_Field SET SeqNo=260,Updated=TO_DATE('2008-02-13 00:08:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54399 +; + +UPDATE AD_Field SET SeqNo=270,Updated=TO_DATE('2008-02-13 00:08:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54398 +; + +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=54236 +; + +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=54399 +; + +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=54398 +; + +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=12870 +; + +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=12871 +; + +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,53025,0,TO_DATE('2008-02-13 00:10:26','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Build Version Error','The program assumes build version {0}, but database has build version {1}. +This is likely to cause hard to fix errors. +Please contact administrator.','E',TO_DATE('2008-02-13 00:10:26','YYYY-MM-DD HH24:MI:SS'),100,'BuildVersionError') +; + +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53025 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + diff --git a/migration/331b-trunk/postgresql/097_1851190.sql b/migration/331b-trunk/postgresql/097_1851190.sql new file mode 100644 index 0000000000..55b769295e --- /dev/null +++ b/migration/331b-trunk/postgresql/097_1851190.sql @@ -0,0 +1,76 @@ +-- Feb 12, 2008 11:33:32 PM COT +-- 1851190 - Running outdated client can cause data corruption +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53346,0,'LastBuildInfo',TO_TIMESTAMP('2008-02-12 23:33:30','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Last Build Info','Last Build Info',TO_TIMESTAMP('2008-02-12 23:33:30','YYYY-MM-DD HH24:MI:SS'),100) +; + +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53346 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,54353,53346,0,10,531,'LastBuildInfo',TO_TIMESTAMP('2008-02-12 23:34:02','YYYY-MM-DD HH24:MI:SS'),100,'D',255,'Y','N','N','N','N','N','N','N','N','N','Y','Last Build Info',0,TO_TIMESTAMP('2008-02-12 23:34:02','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=54353 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53347,0,'IsFailOnBuildDiffer',TO_TIMESTAMP('2008-02-12 23:34:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Fail if Build Differ','Fail if Build Differ',TO_TIMESTAMP('2008-02-12 23:34:52','YYYY-MM-DD HH24:MI:SS'),100) +; + +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53347 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,54354,53347,0,20,531,'IsFailOnBuildDiffer',TO_TIMESTAMP('2008-02-12 23:35:26','YYYY-MM-DD HH24:MI:SS'),100,'N','D',1,'Y','N','N','N','N','Y','N','N','N','N','Y','Fail if Build Differ',0,TO_TIMESTAMP('2008-02-12 23:35:26','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=54354 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +ALTER TABLE AD_System ADD COLUMN LastBuildInfo VARCHAR(255) +; + +UPDATE AD_Field SET Name='Fail if Build Differ', Description=NULL, Help=NULL WHERE AD_Column_ID=54354 AND IsCentrallyMaintained='Y' +; + +ALTER TABLE AD_System ADD COLUMN IsFailOnBuildDiffer CHAR(1) DEFAULT 'N' CHECK (IsFailOnBuildDiffer IN ('Y','N')) NOT NULL +; + +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,54354,54398,0,440,TO_TIMESTAMP('2008-02-13 00:07:59','YYYY-MM-DD HH24:MI:SS'),100,1,'D','Y','Y','Y','N','N','N','N','N','Fail if Build Differ',TO_TIMESTAMP('2008-02-13 00:07:59','YYYY-MM-DD HH24:MI:SS'),100) +; + +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=54398 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,54353,54399,0,440,TO_TIMESTAMP('2008-02-13 00:08:02','YYYY-MM-DD HH24:MI:SS'),100,255,'D','Y','Y','Y','N','N','N','N','N','Last Build Info',TO_TIMESTAMP('2008-02-13 00:08:02','YYYY-MM-DD HH24:MI:SS'),100) +; + +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=54399 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +UPDATE AD_Field SET SeqNo=260,Updated=TO_TIMESTAMP('2008-02-13 00:08:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54399 +; + +UPDATE AD_Field SET SeqNo=270,Updated=TO_TIMESTAMP('2008-02-13 00:08:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54398 +; + +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=54236 +; + +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=54399 +; + +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=54398 +; + +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=12870 +; + +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=12871 +; + +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,53025,0,TO_TIMESTAMP('2008-02-13 00:10:26','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Build Version Error','The program assumes build version {0}, but database has build version {1}. +This is likely to cause hard to fix errors. +Please contact administrator.','E',TO_TIMESTAMP('2008-02-13 00:10:26','YYYY-MM-DD HH24:MI:SS'),100,'BuildVersionError') +; + +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53025 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + diff --git a/serverRoot/src/web/adempiere.jnlp b/serverRoot/src/web/adempiere.jnlp index 0b58d9af81..76505fdae2 100644 --- a/serverRoot/src/web/adempiere.jnlp +++ b/serverRoot/src/web/adempiere.jnlp @@ -1,10 +1,12 @@ + codebase = "$$context/adempiereHome" + href = "$$context/adempiere.jnlp"> Adempiere Client 3.3.1b $$context ADempiere, Inc. + Adempiere ERP+CRM ($$context) - Smart Business Solution for Distribution and Service - globally Adempiere ERP+CRM ($$context) Adempiere ERP+CRM @@ -14,11 +16,10 @@ - + - @@ -27,4 +28,4 @@ - \ No newline at end of file + diff --git a/utils/RUN_DBRestore.bat b/utils/RUN_DBRestore.bat index 3fa7b44094..382677c6fc 100644 --- a/utils/RUN_DBRestore.bat +++ b/utils/RUN_DBRestore.bat @@ -13,4 +13,6 @@ @Rem globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres (ignored in oracle) @call %ADEMPIERE_DB_PATH%\DBRestore system/%ADEMPIERE_DB_SYSTEM% %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD% %ADEMPIERE_DB_SYSTEM% +@call %ADEMPIERE_HOME%\RUN_SignDatabaseBuild + @pause diff --git a/utils/RUN_DBRestore.sh b/utils/RUN_DBRestore.sh index dfd3a623e8..ab8eae535c 100644 --- a/utils/RUN_DBRestore.sh +++ b/utils/RUN_DBRestore.sh @@ -15,3 +15,5 @@ read in # Parameter: # globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres(ignored in oracle) sh $ADEMPIERE_DB_PATH/DBRestore.sh system/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD $ADEMPIERE_DB_SYSTEM + +sh $ADEMPIERE_HOME/RUN_SignDatabaseBuild.sh \ No newline at end of file diff --git a/utils/RUN_ImportAdempiere.bat b/utils/RUN_ImportAdempiere.bat index 4c57fe016f..702c6fb90e 100644 --- a/utils/RUN_ImportAdempiere.bat +++ b/utils/RUN_ImportAdempiere.bat @@ -13,4 +13,6 @@ @Rem globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres (ignored in oracle) @call %ADEMPIERE_DB_PATH%\ImportAdempiere system/%ADEMPIERE_DB_SYSTEM% %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD% %ADEMPIERE_DB_SYSTEM% +@call %ADEMPIERE_HOME%\RUN_SignDatabaseBuild + @pause diff --git a/utils/RUN_ImportAdempiere.sh b/utils/RUN_ImportAdempiere.sh index b3fe2178ec..3506f88f9f 100644 --- a/utils/RUN_ImportAdempiere.sh +++ b/utils/RUN_ImportAdempiere.sh @@ -25,3 +25,5 @@ read in # Parameter: # globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres(ignored in oracle) sh $ADEMPIERE_DB_PATH/ImportAdempiere.sh $SYSUSER/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD $ADEMPIERE_DB_SYSTEM + +sh $ADEMPIERE_HOME/RUN_SignDatabaseBuild.sh \ No newline at end of file