IDEMPIERE-3996 Implement DisplayLogic for PrintFormatItem. Add support for global context variable(#xyz and $xyz)

This commit is contained in:
Heng Sin Low 2019-07-03 11:49:00 +08:00
parent 2af8ec1a39
commit 2a5ab65fee
1 changed files with 15 additions and 10 deletions

View File

@ -54,17 +54,22 @@ public class PrintDataEvaluatee implements Evaluatee {
variableName = variableName.substring(0, f);
}
Object obj = m_data.getNode(variableName);
if ( obj == null || !(obj instanceof PrintDataElement))
return "";
PrintDataElement data = (PrintDataElement) obj;
if (data.isNull() )
return "";
String value = null;
if (data.getValue() instanceof Boolean)
value = ((Boolean)data.getValue()).booleanValue() ? "Y" : "N";
else
value = data.getValueAsString();
if (variableName.startsWith("#") || variableName.startsWith("$")) {
value = Env.getContext(Env.getCtx(), variableName);
} else {
Object obj = m_data.getNode(variableName);
if ( obj == null || !(obj instanceof PrintDataElement))
return "";
PrintDataElement data = (PrintDataElement) obj;
if (data.isNull() )
return "";
if (data.getValue() instanceof Boolean)
value = ((Boolean)data.getValue()).booleanValue() ? "Y" : "N";
else
value = data.getValueAsString();
}
if (!Util.isEmpty(value) && !Util.isEmpty(foreignColumn) && variableName.endsWith("_ID")) {
String refValue = "";
int id = 0;