From 70b5e48440335d9e761180861b91ef9a030f4a1b Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Sat, 19 Jan 2019 11:58:46 +0100 Subject: [PATCH] IDEMPIERE-3873 Popup of process button displays inactive processes --- .../src/org/compiere/model/MToolBarButton.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MToolBarButton.java b/org.adempiere.base/src/org/compiere/model/MToolBarButton.java index 3bc3019e48..dee868459b 100644 --- a/org.adempiere.base/src/org/compiere/model/MToolBarButton.java +++ b/org.adempiere.base/src/org/compiere/model/MToolBarButton.java @@ -50,10 +50,12 @@ public class MToolBarButton extends X_AD_ToolBarButton { public static MToolBarButton[] getProcessButtonOfTab(int AD_Tab_ID, String trxName) { MToolBarButton[] buttons = new MToolBarButton[0]; - - Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), Table_ID), "AD_Tab_ID=? AND Action=? AND AD_Process_ID IS NOT NULL", trxName); + + Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), Table_ID), "AD_ToolBarButton.AD_Tab_ID=? AND AD_ToolBarButton.Action=? AND AD_ToolBarButton.AD_Process_ID IS NOT NULL", trxName) + .addJoinClause("INNER JOIN AD_Process p ON (p.AD_Process_ID = AD_ToolBarButton.AD_Process_ID AND p.IsActive = 'Y')"); + List list = query.setParameters(AD_Tab_ID, "W").setOnlyActiveRecords(true) - .setOrderBy("CASE WHEN COALESCE(SeqNo,0)=0 THEN AD_ToolBarButton_ID ELSE SeqNo END").list(); + .setOrderBy("CASE WHEN COALESCE(AD_ToolBarButton.SeqNo,0)=0 THEN AD_ToolBarButton.AD_ToolBarButton_ID ELSE AD_ToolBarButton.SeqNo END").list(); if (list != null && !list.isEmpty()) { buttons = list.toArray(buttons); }