diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 2879eda64c..936a0864b3 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -1192,6 +1192,9 @@ public class GridField // ** dynamic content ** if (checkContext) { + if (m_vo.DisplayLogic.startsWith("@SQL=")) { + return Evaluator.parseSQLLogic(m_vo.DisplayLogic, m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, m_vo.ColumnName); + } Evaluatee evaluatee = new Evaluatee() { public String get_ValueAsString(String variableName) { return GridField.this.get_ValueAsString(ctx, variableName); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarCustomButton.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarCustomButton.java index e6b65fa6e0..67ff617a1a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarCustomButton.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarCustomButton.java @@ -76,8 +76,22 @@ public class ToolbarCustomButton implements EventListener, Evaluatee { String displayLogic = mToolbarButton.getDisplayLogic(); if (displayLogic == null || displayLogic.trim().length() == 0) return; - - boolean visible = Evaluator.evaluateLogic(this, displayLogic); + + boolean visible = true; + if (displayLogic.startsWith("@SQL=")) { + ADWindow adwindow = ADWindow.get(windowNo); + if (adwindow == null) + return; + + IADTabpanel adTabpanel = adwindow.getADWindowContent().getADTab().getSelectedTabpanel(); + if (adTabpanel == null) + return; + + visible = Evaluator.parseSQLLogic(displayLogic, Env.getCtx(), windowNo, adTabpanel.getTabNo(), mToolbarButton.getActionName()); + }else { + visible = Evaluator.evaluateLogic(this, displayLogic); + } + toolbarButton.setVisible(visible); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarProcessButton.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarProcessButton.java index 0352765dfa..1614ff0cf9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarProcessButton.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ToolbarProcessButton.java @@ -119,7 +119,13 @@ public class ToolbarProcessButton implements IProcessButton, Evaluatee { if (displayLogic == null || displayLogic.trim().length() == 0) return; - boolean visible = Evaluator.evaluateLogic(this, displayLogic); + boolean visible = true; + if (displayLogic.startsWith("@SQL=")) { + visible = Evaluator.parseSQLLogic(displayLogic, Env.getCtx(), windowNo, adTabpanel.getTabNo(), mToolbarButton.getActionName()); + }else { + visible = Evaluator.evaluateLogic(this, displayLogic); + } + button.setVisible(visible); }