From e6cd8633c3b2eacaf1f257f6598a6b35e5cfb127 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 5 Mar 2015 08:04:18 -0500 Subject: [PATCH 01/15] IDEMPIERE-2489 Attachment Note Cant Save - DBERROR message --- org.adempiere.base/src/org/compiere/model/MAttachment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/model/MAttachment.java b/org.adempiere.base/src/org/compiere/model/MAttachment.java index be9526197e..303730f3ff 100644 --- a/org.adempiere.base/src/org/compiere/model/MAttachment.java +++ b/org.adempiere.base/src/org/compiere/model/MAttachment.java @@ -30,6 +30,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.MimeType; +import org.compiere.util.Util; /** @@ -489,6 +490,8 @@ public class MAttachment extends X_AD_Attachment */ protected boolean beforeSave (boolean newRecord) { + if (Util.isEmpty(getTitle())) + setTitle(NONE); return saveLOBData(); // save in BinaryData } // beforeSave From 2d8fd0cfb2985c4b26d04bc78ea2bc9b004932ea Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 6 Mar 2015 16:50:27 -0500 Subject: [PATCH 02/15] IDEMPIERE-643 Packout handler not found for type MV/ET. / minor - fix wrong message --- .../org/adempiere/pipo2/handler/EntityTypeElementHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/EntityTypeElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/EntityTypeElementHandler.java index 7ed0938684..dd4e896fde 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/EntityTypeElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/EntityTypeElementHandler.java @@ -96,7 +96,7 @@ public class EntityTypeElementHandler extends AbstractElementHandler{ } else { logImportDetail(ctx, impDetail, 0, m_EntityType.getName(), m_EntityType.get_ID(), action); - throw new POSaveFailedException("Failed to save Model Validator " + m_EntityType.getName()); + throw new POSaveFailedException("Failed to save Entity Type " + m_EntityType.getName()); } } From 816445c4887c8ee99e1922ee8fe7d1ae0c615a58 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 6 Mar 2015 22:33:46 +0800 Subject: [PATCH 03/15] IDEMPIERE-2420 issue Form too many keys when has long process. Always suspend resource/request for next schedule/activate call. --- .../zk/atmosphere/AtmosphereServerPush.java | 36 +++---------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/fi/jawsy/jawwa/zk/atmosphere/AtmosphereServerPush.java b/org.adempiere.ui.zk/WEB-INF/src/fi/jawsy/jawwa/zk/atmosphere/AtmosphereServerPush.java index 6380825ee1..10dbdc5302 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/fi/jawsy/jawwa/zk/atmosphere/AtmosphereServerPush.java +++ b/org.adempiere.ui.zk/WEB-INF/src/fi/jawsy/jawwa/zk/atmosphere/AtmosphereServerPush.java @@ -20,11 +20,9 @@ the License. package fi.jawsy.jawwa.zk.atmosphere; import java.io.IOException; -import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import org.atmosphere.cpr.AtmosphereResource; -import org.compiere.Adempiere; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.zkoss.lang.Library; @@ -218,37 +216,13 @@ public class AtmosphereServerPush implements ServerPush { return; } - boolean suspend = !desktopCtrl.scheduledServerPush(); - if (suspend) { - if (!resource.isSuspended()) { - resource.suspend(-1, false); - } - this.resource.set(resource); - - //check again, just in case task is schedule between the resource.suspend and resource.set call - if (desktopCtrl.scheduledServerPush()) { - scheduleCommit(); - } - } + if (!resource.isSuspended()) { + resource.suspend(-1, false); + } + this.resource.set(resource); + } - private void scheduleCommit() { - Adempiere.getThreadPoolExecutor().schedule(new Runnable() { - @Override - public void run() { - DesktopCtrl desktopCtrl = (DesktopCtrl) AtmosphereServerPush.this.desktop.get(); - if (desktopCtrl == null) return; - if (desktopCtrl.scheduledServerPush()) { - try { - commitResponse(); - } catch (IOException e) { - log.error(e.getLocalizedMessage(), e); - } - } - } - }, 100, TimeUnit.MILLISECONDS); - } - private static class ThreadInfo { private final Thread thread; /** # of activate() was called. */ From a974c5134dd5d91ff45570ceed7a86b02a946bcb Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 8 Mar 2015 07:54:21 -0500 Subject: [PATCH 04/15] IDEMPIERE-2506 Implement Org Tree in Role --- org.adempiere.base/src/org/compiere/util/Login.java | 1 - 1 file changed, 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index 9a1d05b072..e994927b0d 100644 --- a/org.adempiere.base/src/org/compiere/util/Login.java +++ b/org.adempiere.base/src/org/compiere/util/Login.java @@ -548,7 +548,6 @@ public class Login +" INNER JOIN AD_Client c on (c.AD_Client_ID=?)" +" WHERE o.IsActive='Y' " +" AND o.AD_Client_ID IN (0, c.AD_Client_ID)" - +" AND o.IsSummary='N'" +" AND (r.IsAccessAllOrgs='Y'" +" OR (r.IsUseUserOrgAccess='N' AND o.AD_Org_ID IN (SELECT AD_Org_ID FROM AD_Role_OrgAccess ra" +" WHERE ra.AD_Role_ID=r.AD_Role_ID AND ra.IsActive='Y')) " From fd8ade77349265b2e31f9c1898499297cd56aac3 Mon Sep 17 00:00:00 2001 From: hieplq Date: Fri, 6 Mar 2015 17:48:56 +0700 Subject: [PATCH 05/15] IDEMPIERE-2499:long task (ZkReportViewerProvider.openViewer) in process make GUI lock --- .../webui/window/ZkReportViewerProvider.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java index 0279335be8..d0e4320d49 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java @@ -16,12 +16,16 @@ *****************************************************************************/ package org.adempiere.webui.window; +import org.adempiere.util.ContextRunnable; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.Window; import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.session.SessionManager; +import org.compiere.Adempiere; import org.compiere.print.ReportEngine; import org.compiere.print.ReportViewerProvider; +import org.zkoss.zk.ui.Execution; +import org.zkoss.zk.ui.Executions; /** * @@ -29,9 +33,9 @@ import org.compiere.print.ReportViewerProvider; * */ public class ZkReportViewerProvider implements ReportViewerProvider { - + public void openViewer(final ReportEngine report) { - Runnable runnable = new Runnable() { + final Runnable runnable = new Runnable() { @Override public void run() { Window viewer = new ZkReportViewer(report, report.getName()); @@ -42,6 +46,21 @@ public class ZkReportViewerProvider implements ReportViewerProvider { SessionManager.getAppDesktop().showWindow(viewer); } }; - AEnv.executeAsyncDesktopTask(runnable); + + // IDEMPIERE-2499 + // detect ui thread by value of Executions.getCurrent(), not office method but work + if (Executions.getCurrent() != null){ + Adempiere.getThreadPoolExecutor().submit(new ContextRunnable(){ + protected void doRun(){ + // load layout, with big report it's heavy job, do in non ui thread to don't lock gui + report.getLayout(); + AEnv.executeAsyncDesktopTask(runnable); + } + }); + }else{ + // load layout in non ui thread before run into ui thread + report.getLayout(); + AEnv.executeAsyncDesktopTask(runnable); + } } } \ No newline at end of file From 7950090c6461c58ba76275030f7f5c2d3588b70e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 8 Mar 2015 10:13:35 -0500 Subject: [PATCH 06/15] IDEMPIERE-2499 minor - remove warning on unused import --- .../src/org/adempiere/webui/window/ZkReportViewerProvider.java | 1 - 1 file changed, 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java index d0e4320d49..dbf363144d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java @@ -24,7 +24,6 @@ import org.adempiere.webui.session.SessionManager; import org.compiere.Adempiere; import org.compiere.print.ReportEngine; import org.compiere.print.ReportViewerProvider; -import org.zkoss.zk.ui.Execution; import org.zkoss.zk.ui.Executions; /** From eb3491f826662c88440209a308b76c6c7bcebe73 Mon Sep 17 00:00:00 2001 From: tsvikruha Date: Sun, 8 Mar 2015 10:39:58 -0500 Subject: [PATCH 07/15] IDEMPIERE-1655 no OSGi interface for a BankStatementMatcher --- .../src/org/adempiere/base/Core.java | 35 +++++++++++++++++++ .../base/IBankStatementMatcherFactory.java | 34 ++++++++++++++++++ .../compiere/model/MBankStatementMatcher.java | 11 ++++-- 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 org.adempiere.base/src/org/adempiere/base/IBankStatementMatcherFactory.java diff --git a/org.adempiere.base/src/org/adempiere/base/Core.java b/org.adempiere.base/src/org/adempiere/base/Core.java index 9ecd4d46a0..093419345b 100644 --- a/org.adempiere.base/src/org/adempiere/base/Core.java +++ b/org.adempiere.base/src/org/adempiere/base/Core.java @@ -30,6 +30,7 @@ import org.adempiere.model.IShipmentProcessor; import org.adempiere.model.ITaxProvider; import org.adempiere.model.MShipperFacade; import org.compiere.impexp.BankStatementLoaderInterface; +import org.compiere.impexp.BankStatementMatcherInterface; import org.compiere.model.MAddressValidation; import org.compiere.model.MBankAccountProcessor; import org.compiere.model.MPaymentProcessor; @@ -210,6 +211,40 @@ public class Core { return myBankStatementLoader; } + /** + * get BankStatementMatcher instance + * + * @param className + * @return instance of the BankStatementMatcherInterface or null + */ + public static BankStatementMatcherInterface getBankStatementMatcher(String className){ + if (className == null || className.length() == 0) { + s_log.log(Level.SEVERE, "No BankStatementMatcherInterface class name"); + return null; + } + + BankStatementMatcherInterface myBankStatementMatcher = null; + + List factoryList = + Service.locator().list(IBankStatementMatcherFactory.class).getServices(); + if (factoryList != null) { + for(IBankStatementMatcherFactory factory : factoryList) { + BankStatementMatcherInterface matcher = factory.newBankStatementMatcherInstance(className); + if (matcher != null) { + myBankStatementMatcher = matcher; + break; + } + } + } + + if (myBankStatementMatcher == null) { + s_log.log(Level.SEVERE, "Not found in service/extension registry and classpath"); + return null; + } + + return myBankStatementMatcher; + } + /** * * @param sf diff --git a/org.adempiere.base/src/org/adempiere/base/IBankStatementMatcherFactory.java b/org.adempiere.base/src/org/adempiere/base/IBankStatementMatcherFactory.java new file mode 100644 index 0000000000..0f1f10c374 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/IBankStatementMatcherFactory.java @@ -0,0 +1,34 @@ +/****************************************************************************** + * 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. * + *****************************************************************************/ +package org.adempiere.base; + +import org.compiere.impexp.BankStatementMatcherInterface; + +/** + * Factory Interface for plugins to connect to the iDempiere core and provide a + * way to match Bank statements + * + * @author tsvikruha, inspired by tbayen IBankStatementLoaderFactory + */ +public interface IBankStatementMatcherFactory { + + /** + * This class will be implemented in OSGi plugins. Every plugin that + * provides this service may or may not provide an BankStatementMatcher + * depending on the given classname. By convention this classname is + * the fully qualified classname of the Loader class you want to use. + * + * @param className + * @return BankStatementMatcher instance + */ + public BankStatementMatcherInterface newBankStatementMatcherInstance(String className); +} diff --git a/org.adempiere.base/src/org/compiere/model/MBankStatementMatcher.java b/org.adempiere.base/src/org/compiere/model/MBankStatementMatcher.java index 72fa4ef0eb..c255442ab8 100644 --- a/org.adempiere.base/src/org/compiere/model/MBankStatementMatcher.java +++ b/org.adempiere.base/src/org/compiere/model/MBankStatementMatcher.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.base.Core; import org.compiere.impexp.BankStatementMatcherInterface; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -134,8 +135,14 @@ public class MBankStatementMatcher extends X_C_BankStatementMatcher try { - Class matcherClass = Class.forName(className); - m_matcher = (BankStatementMatcherInterface)matcherClass.newInstance(); + if (log.isLoggable(Level.INFO)) log.info( "MBankStatementMatch Class Name=" + className); + // load the BankStatementMatcher class via OSGi Service definition from a plugin + m_matcher = Core.getBankStatementMatcher(className); + if(m_matcher==null){ + // if no OSGi plugin is found try the legacy way (in my own classpath) + Class bsrClass = Class.forName(className); + m_matcher = (BankStatementMatcherInterface) bsrClass.newInstance(); + } m_matcherValid = Boolean.TRUE; } catch (Exception e) From bf4765113fc25806c09dc1a18233b774e5862af3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 8 Mar 2015 10:41:56 -0500 Subject: [PATCH 08/15] IDEMPIERE-1655 minor - decrease log level --- org.adempiere.base/src/org/adempiere/base/Core.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/base/Core.java b/org.adempiere.base/src/org/adempiere/base/Core.java index 093419345b..facf9c45b8 100644 --- a/org.adempiere.base/src/org/adempiere/base/Core.java +++ b/org.adempiere.base/src/org/adempiere/base/Core.java @@ -204,7 +204,7 @@ public class Core { } if (myBankStatementLoader == null) { - s_log.log(Level.SEVERE, "Not found in service/extension registry and classpath"); + s_log.log(Level.CONFIG, className + " not found in service/extension registry and classpath"); return null; } @@ -238,7 +238,7 @@ public class Core { } if (myBankStatementMatcher == null) { - s_log.log(Level.SEVERE, "Not found in service/extension registry and classpath"); + s_log.log(Level.CONFIG, className + " not found in service/extension registry and classpath"); return null; } From 5f2c3e87de8439197377fa5b6bfbaa661a2b7fa7 Mon Sep 17 00:00:00 2001 From: anozimada Date: Sun, 8 Mar 2015 11:21:37 -0500 Subject: [PATCH 09/15] IDEMPIERE-2408 Workflow activities count is not filtered by role access --- .../src/org/adempiere/webui/dashboard/DPActivitiesModel.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivitiesModel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivitiesModel.java index e428222eb5..9987174c85 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivitiesModel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivitiesModel.java @@ -97,6 +97,8 @@ public class DPActivitiesModel { + ") AND a.AD_Client_ID=?"; // #5 int AD_User_ID = Env.getAD_User_ID(Env.getCtx()); int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); + MRole role = MRole.get(Env.getCtx(), Env.getAD_Role_ID(Env.getCtx())); + sql = role.addAccessSQL(sql, "a", true, false); PreparedStatement pstmt = null; ResultSet rs = null; try From 9c3473e21b79da7f91d0d9b3cc7ef53504841988 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 8 Mar 2015 11:22:00 -0500 Subject: [PATCH 10/15] IDEMPIERE-2408 - minor - simplify default role discovery --- .../src/org/adempiere/webui/dashboard/DPActivitiesModel.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivitiesModel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivitiesModel.java index 9987174c85..0bc95a3dfb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivitiesModel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivitiesModel.java @@ -97,8 +97,7 @@ public class DPActivitiesModel { + ") AND a.AD_Client_ID=?"; // #5 int AD_User_ID = Env.getAD_User_ID(Env.getCtx()); int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); - MRole role = MRole.get(Env.getCtx(), Env.getAD_Role_ID(Env.getCtx())); - sql = role.addAccessSQL(sql, "a", true, false); + sql = MRole.getDefault().addAccessSQL(sql, "a", true, false); PreparedStatement pstmt = null; ResultSet rs = null; try From a3b50d0306b86b5a5db58e6fd323e3c9b0ebed28 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 8 Mar 2015 12:28:26 -0500 Subject: [PATCH 11/15] IDEMPIERE-2507 Search definition not working for tables without IsSOTrx --- .../adempiere/util/AbstractDocumentSearch.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/util/AbstractDocumentSearch.java b/org.adempiere.base/src/org/adempiere/util/AbstractDocumentSearch.java index 588b0dbf0d..126a137bc0 100644 --- a/org.adempiere.base/src/org/adempiere/util/AbstractDocumentSearch.java +++ b/org.adempiere.base/src/org/adempiere/util/AbstractDocumentSearch.java @@ -38,6 +38,7 @@ import java.util.Properties; import java.util.Vector; import java.util.logging.Level; +import org.compiere.model.I_C_Payment; import org.compiere.model.MColumn; import org.compiere.model.MQuery; import org.compiere.model.MRole; @@ -158,15 +159,20 @@ public abstract class AbstractDocumentSearch { sqlSO.append(Env.parseContext(Env.getCtx(), -1, " AND AD_Client_ID=@#AD_Client_ID@", false, true)); if (msd.getPO_Window_ID() != 0) { - sqlPO = new StringBuilder(sqlSO.toString()).append(" AND IsSOTrx='N'"); - sqlSO.append(" AND IsSOTrx='Y'"); + sqlPO = new StringBuilder(sqlSO.toString()); + String columntrx = "IsSOTrx"; + if (I_C_Payment.Table_Name.equals(table.getTableName())) { + columntrx = "IsReceipt"; + } + sqlPO.append(" AND ").append(columntrx).append("='N'"); + sqlSO.append(" AND ").append(columntrx).append("='Y'"); + pstmtPO = DB.prepareStatement(sqlPO.toString(), null); } pstmtSO = DB.prepareStatement(sqlSO.toString(), null); - pstmtPO = DB.prepareStatement(sqlPO.toString(), null); // search for a Integer if (msd.getDataType().equals(MSearchDefinition.DATATYPE_INTEGER)) { pstmtSO.setInt(1, Integer.valueOf(searchString.replaceAll("\\D", ""))); - if (msd.getPO_Window_ID() != 0) { + if (pstmtPO != null) { pstmtPO.setInt(1, Integer.valueOf(searchString.replaceAll("\\D", ""))); } // search for a String @@ -175,7 +181,7 @@ public abstract class AbstractDocumentSearch { pstmtSO.setString(1, searchString); else pstmtSO.setString(1, searchString+"%"); - if (msd.getPO_Window_ID() != 0) { + if (pstmtPO != null) { if (searchString.endsWith("%")) pstmtPO.setString(1, searchString); else From 4f6a95d29496a33cdf6fff3d98971379c1c27688 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 11 Mar 2015 09:01:35 -0500 Subject: [PATCH 12/15] IDEMPIERE-2509 ResetLockedAccount messages are hardcoded --- .../oracle/201503111036_IDEMPIERE-2509.sql | 26 +++++++++++++++++++ .../201503111036_IDEMPIERE-2509.sql | 23 ++++++++++++++++ .../adempiere/process/ResetLockedAccount.java | 13 +++++----- 3 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 migration/i2.1/oracle/201503111036_IDEMPIERE-2509.sql create mode 100644 migration/i2.1/postgresql/201503111036_IDEMPIERE-2509.sql diff --git a/migration/i2.1/oracle/201503111036_IDEMPIERE-2509.sql b/migration/i2.1/oracle/201503111036_IDEMPIERE-2509.sql new file mode 100644 index 0000000000..d5cf65299a --- /dev/null +++ b/migration/i2.1/oracle/201503111036_IDEMPIERE-2509.sql @@ -0,0 +1,26 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 11, 2015 10:13:08 AM CET +-- IDEMPIERE-2509 ResetLockedAccount messages are hardcoded +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200331,'2483519c-32fb-496d-86d0-55b59ec42939',0,TO_DATE('2015-03-11 10:13:07','YYYY-MM-DD HH24:MI:SS'),100,'U','Y','User {0} is not locked','I',TO_DATE('2015-03-11 10:13:07','YYYY-MM-DD HH24:MI:SS'),100,'UserIsNotLocked') +; + +-- Mar 11, 2015 10:13:29 AM CET +UPDATE AD_Message SET EntityType='D',Updated=TO_DATE('2015-03-11 10:13:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200331 +; + +-- Mar 11, 2015 10:13:41 AM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200332,'04e54944-1af1-4d0c-89a6-0240201e529e',0,TO_DATE('2015-03-11 10:13:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Could not unlock user account','I',TO_DATE('2015-03-11 10:13:41','YYYY-MM-DD HH24:MI:SS'),100,'CouldNotUnlockAccount') +; + +-- Mar 11, 2015 10:14:11 AM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200333,'a84c1b33-f127-4b3b-a526-a2fd35efafa7',0,TO_DATE('2015-03-11 10:14:11','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','The user {0} has been unlocked','I',TO_DATE('2015-03-11 10:14:11','YYYY-MM-DD HH24:MI:SS'),100,'UserUnlocked') +; + +-- Mar 11, 2015 10:14:23 AM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200334,'9857d80f-65fd-465b-98ec-398644fd93cf',0,TO_DATE('2015-03-11 10:14:22','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','locked account has been reset','I',TO_DATE('2015-03-11 10:14:22','YYYY-MM-DD HH24:MI:SS'),100,'LockedAccountResetted') +; + +SELECT register_migration_script('201503111036_IDEMPIERE-2509.sql') FROM dual +; diff --git a/migration/i2.1/postgresql/201503111036_IDEMPIERE-2509.sql b/migration/i2.1/postgresql/201503111036_IDEMPIERE-2509.sql new file mode 100644 index 0000000000..8eb6c2cbcc --- /dev/null +++ b/migration/i2.1/postgresql/201503111036_IDEMPIERE-2509.sql @@ -0,0 +1,23 @@ +-- Mar 11, 2015 10:13:08 AM CET +-- IDEMPIERE-2509 ResetLockedAccount messages are hardcoded +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200331,'2483519c-32fb-496d-86d0-55b59ec42939',0,TO_TIMESTAMP('2015-03-11 10:13:07','YYYY-MM-DD HH24:MI:SS'),100,'U','Y','User {0} is not locked','I',TO_TIMESTAMP('2015-03-11 10:13:07','YYYY-MM-DD HH24:MI:SS'),100,'UserIsNotLocked') +; + +-- Mar 11, 2015 10:13:29 AM CET +UPDATE AD_Message SET EntityType='D',Updated=TO_TIMESTAMP('2015-03-11 10:13:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200331 +; + +-- Mar 11, 2015 10:13:41 AM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200332,'04e54944-1af1-4d0c-89a6-0240201e529e',0,TO_TIMESTAMP('2015-03-11 10:13:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Could not unlock user account','I',TO_TIMESTAMP('2015-03-11 10:13:41','YYYY-MM-DD HH24:MI:SS'),100,'CouldNotUnlockAccount') +; + +-- Mar 11, 2015 10:14:11 AM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200333,'a84c1b33-f127-4b3b-a526-a2fd35efafa7',0,TO_TIMESTAMP('2015-03-11 10:14:11','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','The user {0} has been unlocked','I',TO_TIMESTAMP('2015-03-11 10:14:11','YYYY-MM-DD HH24:MI:SS'),100,'UserUnlocked') +; + +-- Mar 11, 2015 10:14:23 AM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200334,'9857d80f-65fd-465b-98ec-398644fd93cf',0,TO_TIMESTAMP('2015-03-11 10:14:22','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','locked account has been reset','I',TO_TIMESTAMP('2015-03-11 10:14:22','YYYY-MM-DD HH24:MI:SS'),100,'LockedAccountResetted') +; + +SELECT register_migration_script('201503111036_IDEMPIERE-2509.sql') FROM dual +; diff --git a/org.adempiere.base/src/org/adempiere/process/ResetLockedAccount.java b/org.adempiere.base/src/org/adempiere/process/ResetLockedAccount.java index 3564e27ab6..6876d871a6 100644 --- a/org.adempiere.base/src/org/adempiere/process/ResetLockedAccount.java +++ b/org.adempiere.base/src/org/adempiere/process/ResetLockedAccount.java @@ -9,6 +9,7 @@ import org.compiere.process.ProcessInfoParameter; import org.compiere.process.SvrProcess; import org.compiere.util.DB; import org.compiere.util.Env; +import org.compiere.util.Msg; public class ResetLockedAccount extends SvrProcess { @@ -45,7 +46,7 @@ public class ResetLockedAccount extends SvrProcess { MUser user = new MUser(getCtx(), p_AD_User_ID, null); if (!user.isLocked()) - throw new AdempiereException("User " + user.getName() + " is not locked"); + throw new AdempiereException(Msg.getMsg(getCtx(), "UserIsNotLocked", new Object[] {user.getName()})); StringBuilder sql = new StringBuilder ("UPDATE AD_User SET IsLocked = 'N', DateAccountLocked=NULL, FailedLoginCount=0, Updated=SysDate ") .append(" WHERE IsLocked='Y' AND AD_Client_ID = ? ") @@ -53,9 +54,9 @@ public class ResetLockedAccount extends SvrProcess { .append(" AND AD_User_ID = " + user.getAD_User_ID()); int no = DB.executeUpdate(sql.toString(), new Object[] { p_AD_Client_ID }, false, get_TrxName()); if (no <= 0) - throw new AdempiereException("Could not unlock user account" + user.toString()); + throw new AdempiereException(Msg.getMsg(getCtx(), "CouldNotUnlockAccount") + user.toString()); - StringBuilder msgreturn = new StringBuilder("@OK@ - The user '").append(user.getName()).append("' has been unlocked"); + StringBuilder msgreturn = new StringBuilder(Msg.getMsg(getCtx(), "ProcessOK")).append(" - ").append(Msg.getMsg(getCtx(), "UserUnlocked", new Object[] {user.getName()})); return msgreturn.toString(); } else @@ -84,9 +85,9 @@ public class ResetLockedAccount extends SvrProcess { int no = DB.executeUpdate(sql.toString(), p_AD_Client_ID, get_TrxName()); if (no < 0) - throw new AdempiereException("Could not unlock user account"); - StringBuilder msgreturn = new StringBuilder().append(no).append(" locked account has been reset"); + throw new AdempiereException(Msg.getMsg(getCtx(), "CouldNotUnlockAccount")); + StringBuilder msgreturn = new StringBuilder().append(no).append(" ").append(Msg.getMsg(getCtx(), "LockedAccountResetted")); return msgreturn.toString(); } } -} \ No newline at end of file +} From d9098bd5718b4b27789becb184e1a87bc57d1e6c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Mar 2015 10:03:54 -0500 Subject: [PATCH 13/15] IDEMPIERE-2440 lengh of client name in session active is wrong --- db/ddlutils/oracle/views/AD_SESSIONINFO_V.sql | 12 ++++----- .../postgresql/views/AD_SESSIONINFO_V.sql | 12 ++++----- .../oracle/201503110943_IDEMPIERE-2440.sql | 25 +++++++++++++++++++ .../201503110943_IDEMPIERE-2440.sql | 22 ++++++++++++++++ 4 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 migration/i2.1/oracle/201503110943_IDEMPIERE-2440.sql create mode 100644 migration/i2.1/postgresql/201503110943_IDEMPIERE-2440.sql diff --git a/db/ddlutils/oracle/views/AD_SESSIONINFO_V.sql b/db/ddlutils/oracle/views/AD_SESSIONINFO_V.sql index 2a93630efb..178092942e 100644 --- a/db/ddlutils/oracle/views/AD_SESSIONINFO_V.sql +++ b/db/ddlutils/oracle/views/AD_SESSIONINFO_V.sql @@ -1,12 +1,12 @@ CREATE OR REPLACE VIEW ad_sessioninfo_v AS - SELECT s.ad_session_id,0 as ad_client_id,0 as ad_org_id, s.isactive, - s.created, s.createdby, s.updated, s.updatedby, s.websession, - s.remote_addr, s.remote_host, r.name as roleName, s.logindate, s.ad_session_uu, - s.servername, c.name AS ClientName,o.name as orgName,s.ad_session_id as ad_sessioninfo_v_id, - s.ad_session_uu as ad_sessioninfo_v_uu,u.name as LoginName,u.email as email + SELECT s.ad_session_id,0 as ad_client_id,0 as ad_org_id, s.isactive, + s.created, s.createdby, s.updated, s.updatedby, substr(s.websession,1,40) as websession, + substr(s.remote_addr,1,60) as remote_addr, substr(s.remote_host,1,120) as remote_host, substr(r.name,1,60) as roleName, s.logindate, s.ad_session_uu, + substr(s.servername,1,80) as servername, substr(c.name,1,60) AS ClientName,substr(o.name,1,60) as orgName,s.ad_session_id as ad_sessioninfo_v_id, + s.ad_session_uu as ad_sessioninfo_v_uu,substr(u.name,1,60) as LoginName,substr(u.email,1,60) as email FROM ad_session s inner join AD_User u on (s.createdby = u.AD_User_ID) left join AD_Role r on (s.ad_role_id=r.ad_role_id) inner join AD_Client c on (s.ad_client_id=c.ad_client_id) left join AD_Org o on (s.ad_org_id=o.ad_org_id) - WHERE s.processed = 'N'; \ No newline at end of file + WHERE s.processed = 'N'; diff --git a/db/ddlutils/postgresql/views/AD_SESSIONINFO_V.sql b/db/ddlutils/postgresql/views/AD_SESSIONINFO_V.sql index 3d8f6557d6..4c938be25d 100644 --- a/db/ddlutils/postgresql/views/AD_SESSIONINFO_V.sql +++ b/db/ddlutils/postgresql/views/AD_SESSIONINFO_V.sql @@ -1,13 +1,13 @@ drop view ad_sessioninfo_v; CREATE OR REPLACE VIEW ad_sessioninfo_v AS - SELECT s.ad_session_id, 0::numeric(10,0) AS ad_client_id, 0::numeric(10,0) AS ad_org_id, s.isactive, - s.created, s.createdby, s.updated, s.updatedby, s.websession, - s.remote_addr, s.remote_host, r.name as roleName, s.logindate, s.ad_session_uu, - s.servername, c.name AS ClientName,o.name as orgName,s.ad_session_id as ad_sessioninfo_v_id, - s.ad_session_uu as ad_sessioninfo_v_uu,u.name as LoginName,u.email as email + SELECT s.ad_session_id, 0::numeric(10,0) AS ad_client_id, 0::numeric(10,0) AS ad_org_id, s.isactive, + s.created, s.createdby, s.updated, s.updatedby, substr(s.websession,1,40) as websession, + substr(s.remote_addr,1,60) as remote_addr, substr(s.remote_host,1,120) as remote_host, substr(r.name,1,60) as roleName, s.logindate, s.ad_session_uu, + substr(s.servername,1,80) as servername, substr(c.name,1,60) AS ClientName,substr(o.name,1,60) as orgName,s.ad_session_id as ad_sessioninfo_v_id, + s.ad_session_uu as ad_sessioninfo_v_uu,substr(u.name,1,60) as LoginName,substr(u.email,1,60) as email FROM ad_session s inner join AD_User u on (s.createdby = u.AD_User_ID) left join AD_Role r on (s.ad_role_id=r.ad_role_id) inner join AD_Client c on (s.ad_client_id=c.ad_client_id) left join AD_Org o on (s.ad_org_id=o.ad_org_id) - WHERE s.processed = 'N'::bpchar; \ No newline at end of file + WHERE s.processed = 'N'::bpchar; diff --git a/migration/i2.1/oracle/201503110943_IDEMPIERE-2440.sql b/migration/i2.1/oracle/201503110943_IDEMPIERE-2440.sql new file mode 100644 index 0000000000..ae8f1a58ed --- /dev/null +++ b/migration/i2.1/oracle/201503110943_IDEMPIERE-2440.sql @@ -0,0 +1,25 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2440 +-- Mar 11, 2015 9:43:16 AM COT +UPDATE AD_Column SET FieldLength=60,Updated=TO_DATE('2015-03-11 09:43:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200702 +; + +CREATE OR REPLACE VIEW ad_sessioninfo_v AS + SELECT s.ad_session_id,0 as ad_client_id,0 as ad_org_id, s.isactive, + s.created, s.createdby, s.updated, s.updatedby, substr(s.websession,1,40) as websession, + substr(s.remote_addr,1,60) as remote_addr, substr(s.remote_host,1,120) as remote_host, substr(r.name,1,60) as roleName, s.logindate, s.ad_session_uu, + substr(s.servername,1,80) as servername, substr(c.name,1,60) AS ClientName,substr(o.name,1,60) as orgName,s.ad_session_id as ad_sessioninfo_v_id, + s.ad_session_uu as ad_sessioninfo_v_uu,substr(u.name,1,60) as LoginName,substr(u.email,1,60) as email + FROM ad_session s + inner join AD_User u on (s.createdby = u.AD_User_ID) + left join AD_Role r on (s.ad_role_id=r.ad_role_id) + inner join AD_Client c on (s.ad_client_id=c.ad_client_id) + left join AD_Org o on (s.ad_org_id=o.ad_org_id) + WHERE s.processed = 'N' +; + +SELECT register_migration_script('201503110943_IDEMPIERE-2440.sql') FROM dual +; + diff --git a/migration/i2.1/postgresql/201503110943_IDEMPIERE-2440.sql b/migration/i2.1/postgresql/201503110943_IDEMPIERE-2440.sql new file mode 100644 index 0000000000..33d1a93b5f --- /dev/null +++ b/migration/i2.1/postgresql/201503110943_IDEMPIERE-2440.sql @@ -0,0 +1,22 @@ +-- IDEMPIERE-2440 +-- Mar 11, 2015 9:43:16 AM COT +UPDATE AD_Column SET FieldLength=60,Updated=TO_TIMESTAMP('2015-03-11 09:43:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200702 +; + +CREATE OR REPLACE VIEW ad_sessioninfo_v AS + SELECT s.ad_session_id, 0::numeric(10,0) AS ad_client_id, 0::numeric(10,0) AS ad_org_id, s.isactive, + s.created, s.createdby, s.updated, s.updatedby, substr(s.websession,1,40) as websession, + substr(s.remote_addr,1,60) as remote_addr, substr(s.remote_host,1,120) as remote_host, substr(r.name,1,60) as roleName, s.logindate, s.ad_session_uu, + substr(s.servername,1,80) as servername, substr(c.name,1,60) AS ClientName,substr(o.name,1,60) as orgName,s.ad_session_id as ad_sessioninfo_v_id, + s.ad_session_uu as ad_sessioninfo_v_uu,substr(u.name,1,60) as LoginName,substr(u.email,1,60) as email + FROM ad_session s + inner join AD_User u on (s.createdby = u.AD_User_ID) + left join AD_Role r on (s.ad_role_id=r.ad_role_id) + inner join AD_Client c on (s.ad_client_id=c.ad_client_id) + left join AD_Org o on (s.ad_org_id=o.ad_org_id) + WHERE s.processed = 'N'::bpchar +; + +SELECT register_migration_script('201503110943_IDEMPIERE-2440.sql') FROM dual +; + From 9716fac80cdfca427b41d7acdc76a40f01f50e39 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Mar 2015 11:11:23 -0500 Subject: [PATCH 14/15] IDEMPIERE-2513 Sequence Check not working for native sequences --- .../src/org/compiere/process/SequenceCheck.java | 5 +++++ org.adempiere.base/src/org/compiere/model/MSequence.java | 1 + 2 files changed, 6 insertions(+) diff --git a/org.adempiere.base.process/src/org/compiere/process/SequenceCheck.java b/org.adempiere.base.process/src/org/compiere/process/SequenceCheck.java index ac1147c047..4824879d0a 100644 --- a/org.adempiere.base.process/src/org/compiere/process/SequenceCheck.java +++ b/org.adempiere.base.process/src/org/compiere/process/SequenceCheck.java @@ -21,6 +21,7 @@ import java.sql.ResultSet; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.compiere.Adempiere; import org.compiere.model.MClient; import org.compiere.model.MSequence; @@ -79,6 +80,7 @@ public class SequenceCheck extends SvrProcess catch (Exception e) { s_log.log(Level.SEVERE, "validate", e); + throw new AdempiereException(e); } } // validate @@ -124,6 +126,7 @@ public class SequenceCheck extends SvrProcess catch (Exception e) { s_log.log(Level.SEVERE, sql, e); + throw new AdempiereException(e); } finally { @@ -173,6 +176,7 @@ public class SequenceCheck extends SvrProcess catch (Exception e) { s_log.log (Level.SEVERE, sql, e); + throw new AdempiereException(e); } finally { @@ -233,6 +237,7 @@ public class SequenceCheck extends SvrProcess catch (Exception e) { s_log.log(Level.SEVERE, sql, e); + throw new AdempiereException(e); } finally { diff --git a/org.adempiere.base/src/org/compiere/model/MSequence.java b/org.adempiere.base/src/org/compiere/model/MSequence.java index 3e1ca23654..d0859d301d 100644 --- a/org.adempiere.base/src/org/compiere/model/MSequence.java +++ b/org.adempiere.base/src/org/compiere/model/MSequence.java @@ -902,6 +902,7 @@ public class MSequence extends X_AD_Sequence + "FROM AD_Table t" + " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) " + "WHERE t.TableName='" + tableName + "'" + + " AND t.IsView='N'" // ignore for views -- IDEMPIERE-2513 + " AND c.ColumnName='" + tableName + "_ID'"); if (AD_Column_ID <= 0) return null; From 4050bd6819242a06203bdca505594a526ddeb63c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 12 Mar 2015 09:06:48 -0500 Subject: [PATCH 15/15] IDEMPIERE-2440 --- migration/i2.1/postgresql/201503110943_IDEMPIERE-2440.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/i2.1/postgresql/201503110943_IDEMPIERE-2440.sql b/migration/i2.1/postgresql/201503110943_IDEMPIERE-2440.sql index 33d1a93b5f..a1abe6756c 100644 --- a/migration/i2.1/postgresql/201503110943_IDEMPIERE-2440.sql +++ b/migration/i2.1/postgresql/201503110943_IDEMPIERE-2440.sql @@ -3,6 +3,8 @@ UPDATE AD_Column SET FieldLength=60,Updated=TO_TIMESTAMP('2015-03-11 09:43:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200702 ; +DROP VIEW ad_sessioninfo_v; + CREATE OR REPLACE VIEW ad_sessioninfo_v AS SELECT s.ad_session_id, 0::numeric(10,0) AS ad_client_id, 0::numeric(10,0) AS ad_org_id, s.isactive, s.created, s.createdby, s.updated, s.updatedby, substr(s.websession,1,40) as websession,