From 162b0becf406cda24eacdd8f1872a47139ea208c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 7 May 2012 15:56:25 -0500 Subject: [PATCH] IDEMPIERE-259 Cannot set tab display logic based on specific tab value of field Thanks to Ammar (hamur36) for the proposed solution here: http://sourceforge.net/projects/adempiere/forums/forum/610547/topic/5087640?message=11256178 --- .../src/org/compiere/util/Evaluator.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/util/Evaluator.java b/org.adempiere.base/src/org/compiere/util/Evaluator.java index 8f9122fce7..2bc3d75d74 100644 --- a/org.adempiere.base/src/org/compiere/util/Evaluator.java +++ b/org.adempiere.base/src/org/compiere/util/Evaluator.java @@ -83,7 +83,7 @@ public class Evaluator * * @param source class implementing get_ValueAsString(variable) * @param logic logic string - * @return locic result + * @return logic result */ public static boolean evaluateLogic (Evaluatee source, String logic) { @@ -97,11 +97,29 @@ public class Evaluator return false; } - boolean retValue = evaluateLogicTuple(source, st.nextToken()); + String exprStrand = st.nextToken().trim(); + if (exprStrand.matches("^@\\d+$")) + { + exprStrand = exprStrand.concat(st.nextToken()); + exprStrand = exprStrand.concat(st.nextToken()); + } + + //boolean retValue = evaluateLogicTuple(source, st.nextToken()); + boolean retValue = evaluateLogicTuple(source, exprStrand); while (st.hasMoreTokens()) { String logOp = st.nextToken().trim(); - boolean temp = evaluateLogicTuple(source, st.nextToken()); + //boolean temp = evaluateLogicTuple(source, st.nextToken()); + + exprStrand = st.nextToken().trim(); + if (exprStrand.matches("^@\\d+$")) + { + exprStrand = exprStrand.concat(st.nextToken()); + exprStrand = exprStrand.concat(st.nextToken()); + } + + boolean temp = evaluateLogicTuple(source, exprStrand); + if (logOp.equals("&")) retValue = retValue & temp; else if (logOp.equals("|"))