IDEMPIERE-4641 AD_ProcessPara.DisplayLogic is not accepting @Value_ID.ForeignColumn@ notation (#520)

This commit is contained in:
Carlos Ruiz 2021-01-12 14:33:48 +01:00 committed by GitHub
parent 402300a53e
commit a1f39f9506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 10 deletions

View File

@ -1243,23 +1243,34 @@ public class GridField
}
value = Env.getContext (ctx, m_vo.WindowNo, m_vo.TabNo, variableName, tabOnly, true);
}
if (!Util.isEmpty(value) && !Util.isEmpty(foreignColumn) && variableName.endsWith("_ID")
&& getGridTab() != null) {
String refValue = "";
if (!Util.isEmpty(value) && !Util.isEmpty(foreignColumn) && variableName.endsWith("_ID")) {
int id = 0;
try {
id = Integer.parseInt(value);
} catch (Exception e){}
if (id > 0) {
MColumn column = MColumn.get(ctx, getGridTab().getTableName(), variableName);
if (column != null) {
String foreignTable = column.getReferenceTableName();
refValue = DB.getSQLValueString(null,
"SELECT " + foreignColumn + " FROM " + foreignTable + " WHERE "
+ foreignTable + "_ID = ?", id);
String refValue = "";
if (getGridTab() != null) {
MColumn column = MColumn.get(ctx, getGridTab().getTableName(), variableName);
if (column != null) {
String foreignTable = column.getReferenceTableName();
refValue = DB.getSQLValueString(null,
"SELECT " + foreignColumn + " FROM " + foreignTable + " WHERE "
+ foreignTable + "_ID = ?", id);
}
return refValue;
} else {
// no GridTab - maybe coming from process parameter, try tableName from columnName
String foreignTable = variableName.substring(0, variableName.length()-3);
MTable table = MTable.get(ctx, foreignTable);
if (table != null) {
refValue = DB.getSQLValueString(null,
"SELECT " + foreignColumn + " FROM " + foreignTable + " WHERE "
+ foreignTable + "_ID = ?", id);
return refValue;
}
}
}
return refValue;
}
return value;
} // get_ValueAsString