From e8b0df69d367857b9085d999604aa6ca7683c40f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 4 Dec 2018 19:19:17 +0100 Subject: [PATCH] IDEMPIERE-3551 External (non-plugin) 2Pack automation / fix problem reprocessing zip files from tenants --- .../adempiere/plugin/utils/AbstractActivator.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AbstractActivator.java b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AbstractActivator.java index 9d049f8482..4ffe6436c2 100644 --- a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AbstractActivator.java +++ b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AbstractActivator.java @@ -87,8 +87,17 @@ public abstract class AbstractActivator implements BundleActivator, ServiceTrack protected boolean installedPackage(String version) { StringBuilder where = new StringBuilder("AD_Client_ID=? AND Name=? AND PK_Status='Completed successfully'"); List params = new ArrayList(); - params.add(Env.getAD_Client_ID(Env.getCtx())); - params.add(getName()); + String fileName = getName(); + int clientId = Env.getAD_Client_ID(Env.getCtx()); + if (version == null) { + String [] parts = fileName.split("_"); + String clientValue = parts[1]; + clientId = DB.getSQLValueEx(null, "SELECT AD_Client_ID FROM AD_Client WHERE Value=?", clientValue); + if (clientId < 0) + clientId = 0; + } + params.add(clientId); + params.add(fileName); if (version != null) { where.append(" AND PK_Version LIKE ?"); params.add(version + "%");