diff --git a/migration/i2.0/oracle/201312260552_IDEMPIERE-1644.sql b/migration/i2.0/oracle/201312260552_IDEMPIERE-1644.sql
index 696522af5b..9966f6303d 100644
--- a/migration/i2.0/oracle/201312260552_IDEMPIERE-1644.sql
+++ b/migration/i2.0/oracle/201312260552_IDEMPIERE-1644.sql
@@ -8,7 +8,7 @@ UPDATE AD_Column SET FieldLength=60,Updated=TO_DATE('2013-12-26 12:22:23','YYYY-
-- Dec 26, 2013 12:22:34 PM MYT
-- IDEMPIERE-1644 Length 22 for AD_PrintFormatItem.FormatPattern is too short
-ALTER TABLE AD_PrintFormatItem MODIFY FormatPattern VARCHAR2(60) DEFAULT NULL
+ALTER TABLE AD_PrintFormatItem MODIFY FormatPattern NVARCHAR2(60) DEFAULT NULL
;
SELECT register_migration_script('201312260552_IDEMPIERE-1644.sql') FROM dual
diff --git a/org.adempiere.base-feature/sign.database.build.launch b/org.adempiere.base-feature/sign.database.build.launch
new file mode 100644
index 0000000000..5aa4fff7d8
--- /dev/null
+++ b/org.adempiere.base-feature/sign.database.build.launch
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/org.adempiere.base/plugin.xml b/org.adempiere.base/plugin.xml
index 1101e74954..b5cd9343e1 100644
--- a/org.adempiere.base/plugin.xml
+++ b/org.adempiere.base/plugin.xml
@@ -103,4 +103,17 @@
priority="0">
+
+
+
+
+
+
diff --git a/org.adempiere.base/src/org/adempiere/base/SignDatabaseBuildApplication.java b/org.adempiere.base/src/org/adempiere/base/SignDatabaseBuildApplication.java
new file mode 100644
index 0000000000..ac04322bb3
--- /dev/null
+++ b/org.adempiere.base/src/org/adempiere/base/SignDatabaseBuildApplication.java
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.base;
+
+import java.sql.PreparedStatement;
+import java.util.logging.Level;
+
+import org.compiere.Adempiere;
+import org.compiere.util.CLogMgt;
+import org.compiere.util.CLogger;
+import org.compiere.util.DB;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+
+/**
+ * Sign Database Build
+ * [ 1851190 ] Running outdated client can cause data corruption
+ *
+ * @author Carlos Ruiz
+ */
+public class SignDatabaseBuildApplication implements IApplication {
+
+ private static CLogger s_log = CLogger.getCLogger (SignDatabaseBuildApplication.class);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ */
+ @Override
+ public Object start(IApplicationContext context) throws Exception {
+ Adempiere.startupEnvironment(false);
+ CLogMgt.setLevel(Level.FINE);
+ s_log.info("Sign Database Build");
+ s_log.info("-------------------");
+
+ if (! DB.isConnected()) {
+ s_log.info("No DB Connection");
+ System.exit(1);
+ }
+
+ String version = Adempiere.getVersion();
+ s_log.info("Version = " + version);
+ System.out.println("Version = " + version);
+
+ PreparedStatement updateStmt = null;
+ try {
+
+ String upd = "UPDATE AD_System SET LastBuildInfo = ?";
+ updateStmt = DB.prepareStatement(upd, null);
+ updateStmt.setString(1,version);
+ s_log.info(upd);
+ System.out.println(upd); // Also show the update to the console
+ updateStmt.executeUpdate();
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ } finally {
+ DB.close(updateStmt);
+ }
+ return IApplication.EXIT_OK;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.app.IApplication#stop()
+ */
+ @Override
+ public void stop() {
+ }
+
+}
diff --git a/org.adempiere.base/src/org/compiere/Adempiere.java b/org.adempiere.base/src/org/compiere/Adempiere.java
index e3c2560269..0dca4521e3 100644
--- a/org.adempiere.base/src/org/compiere/Adempiere.java
+++ b/org.adempiere.base/src/org/compiere/Adempiere.java
@@ -160,6 +160,13 @@ public final class Adempiere
return bundle.getVersion().toString();
}
}
+ else
+ {
+ Bundle bundle = Platform.getBundle("org.adempiere.base");
+ if (bundle != null) {
+ return bundle.getVersion().toString();
+ }
+ }
return "Unknown";
} // getVersion
@@ -586,10 +593,20 @@ public final class Adempiere
log.severe ("No Database");
return false;
}
+
+ // Check Build
+ if (!DB.isBuildOK(Env.getCtx()))
+ {
+ if (isClient)
+ System.exit(1);
+ log = null;
+ return false;
+ }
+
MSystem system = MSystem.get(Env.getCtx()); // Initializes Base Context too
if (system == null)
return false;
-
+
// Initialize main cached Singletons
ModelValidationEngine.get();
try
@@ -633,7 +650,7 @@ public final class Adempiere
{
log.warning("Not started: " + className + " - " + e.getMessage());
}
-
+
if (!isClient)
DB.updateMail();
diff --git a/org.adempiere.base/src/org/compiere/util/DB.java b/org.adempiere.base/src/org/compiere/util/DB.java
index d798ae5c1a..f3078b7920 100644
--- a/org.adempiere.base/src/org/compiere/util/DB.java
+++ b/org.adempiere.base/src/org/compiere/util/DB.java
@@ -606,7 +606,7 @@ public final class DB
public static boolean isBuildOK (Properties ctx)
{
// Check Build
- String buildClient = Adempiere.getImplementationVersion();
+ String buildClient = Adempiere.getVersion();
String buildDatabase = "";
boolean failOnBuild = false;
String sql = "SELECT LastBuildInfo, IsFailOnBuildDiffer FROM AD_System";
@@ -650,10 +650,18 @@ public final class DB
log.warning(msg);
return true;
}
- JOptionPane.showMessageDialog (null,
- msg,
- title, JOptionPane.ERROR_MESSAGE);
- Env.exitEnv(1);
+
+ if (Ini.isClient())
+ {
+ JOptionPane.showMessageDialog (null,
+ msg,
+ title, JOptionPane.ERROR_MESSAGE);
+ Env.exitEnv(1);
+ }
+ else
+ {
+ log.log(Level.SEVERE, msg);
+ }
return false;
} // isDatabaseOK
diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReportViewElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReportViewElementHandler.java
index e35852f168..a503cd06f5 100644
--- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReportViewElementHandler.java
+++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ReportViewElementHandler.java
@@ -136,8 +136,8 @@ public class ReportViewElementHandler extends AbstractElementHandler {
document.endElement("", "", X_AD_ReportView.Table_Name);
}
- sql = "SELECT AD_PrintFormat_ID FROM AD_PrintFormat WHERE AD_ReportView_ID= "
- + AD_ReportView_ID;
+ sql = "SELECT AD_PrintFormat_ID FROM AD_PrintFormat WHERE AD_ReportView_ID="
+ + AD_ReportView_ID + " AND AD_Client_ID=" + Env.getAD_Client_ID(ctx.ctx);
pstmt = null;
rs = null;
try {
diff --git a/org.adempiere.server-feature/build.properties b/org.adempiere.server-feature/build.properties
index d7df7d1ac0..06ab63fa23 100644
--- a/org.adempiere.server-feature/build.properties
+++ b/org.adempiere.server-feature/build.properties
@@ -4,28 +4,28 @@ root.folder.data=data
root.folder.setup=setup
#linux 64 bits
-root.linux.gtk.x86_64=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
+root.linux.gtk.x86_64=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.linux.gtk.x86_64.folder.utils=utils.unix
root.linux.gtk.x86_64.permissions.755=*.sh,**/*.sh
#linux
-root.linux.gtk.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
+root.linux.gtk.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.linux.gtk.x86.folder.utils=utils.unix
root.linux.gtk.x86.permissions.755=*.sh,**/*.sh
#mac
-root.macosx.cocoa.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
+root.macosx.cocoa.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.macosx.cocoa.x86.folder.utils=utils.unix
root.macosx.cocoa.x86.permissions.755=*.sh,**/*.sh
#mac 64
-root.macosx.cocoa.x86_64=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
+root.macosx.cocoa.x86_64=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.macosx.cocoa.x86_64.folder.utils=utils.unix
root.macosx.cocoa.x86_64.permissions.755=*.sh,**/*.sh
#windows
-root.win32.win32.x86=file:setup.bat,file:console-setup.bat,file:idempiere-server.bat,file:setup-alt.bat,file:console-setup-alt.bat
+root.win32.win32.x86=file:setup.bat,file:console-setup.bat,file:idempiere-server.bat,file:setup-alt.bat,file:console-setup-alt.bat,file:sign-database-build.bat
root.win32.win32.x86.folder.utils=utils.windows
#windows 64
-root.win32.win32.x86_64=file:setup.bat,file:console-setup.bat,file:idempiere-server.bat,file:setup-alt.bat,file:console-setup-alt.bat
+root.win32.win32.x86_64=file:setup.bat,file:console-setup.bat,file:idempiere-server.bat,file:setup-alt.bat,file:console-setup-alt.bat,file:sign-database-build.bat
root.win32.win32.x86_64.folder.utils=utils.windows
#solaris
-root.solaris.gtk.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
+root.solaris.gtk.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.solaris.gtk.x86.folder.utils=utils.unix
root.solaris.gtk.x86.permissions.755=*.sh,**/*.sh
diff --git a/org.adempiere.server-feature/sign-database-build.bat b/org.adempiere.server-feature/sign-database-build.bat
new file mode 100644
index 0000000000..73cbf35211
--- /dev/null
+++ b/org.adempiere.server-feature/sign-database-build.bat
@@ -0,0 +1,19 @@
+@Title Sign Database Build
+@Echo off
+
+
+@REM Sign Database Build
+idempiere --launcher.ini setup.ini -application org.adempiere.base.SignDatabaseBuildApplication
+
+@Echo ErrorLevel = %ERRORLEVEL%
+@IF NOT ERRORLEVEL = 1 GOTO NEXT
+@Echo ***************************************
+@Echo Check the error message above.
+@Echo ***************************************
+@Pause
+@Exit
+
+@Echo .
+@Echo For problems, check log file in base directory
+@Rem Wait 10 second
+@PING 1.1.1.1 -n 1 -w 10000 > NUL
diff --git a/org.adempiere.server-feature/sign-database-build.sh b/org.adempiere.server-feature/sign-database-build.sh
new file mode 100644
index 0000000000..4576ad7e24
--- /dev/null
+++ b/org.adempiere.server-feature/sign-database-build.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+echo Sign Database Build
+
+# Sign Database Build
+./idempiere --launcher.ini setup.ini -application org.adempiere.base.SignDatabaseBuildApplication
+
+echo .
+echo For problems, check log file in base directory
diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java
index 59030de8a1..f34b624254 100644
--- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java
+++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java
@@ -287,13 +287,6 @@ public final class AMenu extends CFrame
if (!login.isConnected() || !login.isOKpressed())
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
// UI