IDEMPIERE-3917: add sql logic for display logic of field, process button, customize button

This commit is contained in:
hieplq 2019-03-20 08:53:05 +07:00
parent 322a2413d7
commit 59655e3324
3 changed files with 26 additions and 3 deletions

View File

@ -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);

View File

@ -76,8 +76,22 @@ public class ToolbarCustomButton implements EventListener<Event>, 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);
}

View File

@ -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);
}