IDEMPIERE-2356 Allow global context in virtual columns

This commit is contained in:
Carlos Ruiz 2014-12-10 15:06:54 -05:00
parent 812b3944d9
commit d547cacad8
7 changed files with 24 additions and 5 deletions

View File

@ -200,10 +200,14 @@ public class GridFieldVO implements Serializable
vo.AD_Reference_Value_ID = rs.getInt(i); vo.AD_Reference_Value_ID = rs.getInt(i);
else if (columnName.equalsIgnoreCase("ValidationCode")) else if (columnName.equalsIgnoreCase("ValidationCode"))
vo.ValidationCode = rs.getString(i); vo.ValidationCode = rs.getString(i);
else if (columnName.equalsIgnoreCase("ColumnSQL")) else if (columnName.equalsIgnoreCase("ColumnSQL")) {
vo.ColumnSQL = rs.getString(i); vo.ColumnSQL = rs.getString(i);
if (vo.ColumnSQL != null && vo.ColumnSQL.contains("@")) {
// NOTE: cannot use window context because this is set globally on the query, not per record
vo.ColumnSQL = Env.parseContext(ctx, -1, vo.ColumnSQL, false, true);
}
//Feature Request FR [ 1757088 ] //Feature Request FR [ 1757088 ]
else if (columnName.equalsIgnoreCase("Included_Tab_ID")) } else if (columnName.equalsIgnoreCase("Included_Tab_ID"))
vo.Included_Tab_ID = rs.getInt(i); vo.Included_Tab_ID = rs.getInt(i);
// Collapse Default State // Collapse Default State
else if (columnName.equalsIgnoreCase("IsCollapsedByDefault")) else if (columnName.equalsIgnoreCase("IsCollapsedByDefault"))

View File

@ -417,6 +417,8 @@ public class MLookupFactory
ZoomWindowPO = rs.getInt(9); ZoomWindowPO = rs.getInt(9);
//AD_Table_ID = rs.getInt(10); //AD_Table_ID = rs.getInt(10);
displayColumnSQL = rs.getString(11); displayColumnSQL = rs.getString(11);
if (displayColumnSQL != null && displayColumnSQL.contains("@"))
displayColumnSQL = Env.parseContext(Env.getCtx(), -1, displayColumnSQL, false, true);
overrideZoomWindow = rs.getInt(12); overrideZoomWindow = rs.getInt(12);
infoWindowId = rs.getInt(13); infoWindowId = rs.getInt(13);
loaded = true; loaded = true;

View File

@ -1114,7 +1114,10 @@ class Restriction implements Serializable
MTable table = MTable.get(Env.getCtx(), tableName); MTable table = MTable.get(Env.getCtx(), tableName);
if (table != null) { if (table != null) {
for (MColumn col : table.getColumns(false)) { for (MColumn col : table.getColumns(false)) {
if (ColumnName.equals(col.getColumnSQL())) { String colSQL = col.getColumnSQL();
if (colSQL != null && colSQL.contains("@"))
colSQL = Env.parseContext(Env.getCtx(), -1, colSQL, false, true);
if (ColumnName.equals(colSQL)) {
virtualColumn = true; virtualColumn = true;
break; break;
} }

View File

@ -198,6 +198,8 @@ public class POInfo implements Serializable
// //
m_AccessLevel = rs.getString(18); m_AccessLevel = rs.getString(18);
String ColumnSQL = rs.getString(19); String ColumnSQL = rs.getString(19);
if (ColumnSQL != null && ColumnSQL.contains("@"))
ColumnSQL = Env.parseContext(Env.getCtx(), -1, ColumnSQL, false, true);
boolean IsEncrypted = "Y".equals(rs.getString(20)); boolean IsEncrypted = "Y".equals(rs.getString(20));
boolean IsAllowLogging = "Y".equals(rs.getString(21)); boolean IsAllowLogging = "Y".equals(rs.getString(21));
boolean IsAllowCopy = "Y".equals(rs.getString(22)); boolean IsAllowCopy = "Y".equals(rs.getString(22));

View File

@ -299,6 +299,8 @@ public class DataEngine
int AD_Column_ID = rs.getInt(1); int AD_Column_ID = rs.getInt(1);
String ColumnName = rs.getString(2); String ColumnName = rs.getString(2);
String ColumnSQL = rs.getString(24); String ColumnSQL = rs.getString(24);
if (ColumnSQL != null && ColumnSQL.contains("@"))
ColumnSQL = Env.parseContext(Env.getCtx(), -1, ColumnSQL, false, true);
if (ColumnSQL == null) if (ColumnSQL == null)
ColumnSQL = ""; ColumnSQL = "";
int AD_Reference_ID = rs.getInt(3); int AD_Reference_ID = rs.getInt(3);

View File

@ -256,6 +256,8 @@ public class InfoGeneral extends Info
{ {
m_queryColumns.add(rs.getString(1)); m_queryColumns.add(rs.getString(1));
String columnSql = rs.getString(4); String columnSql = rs.getString(4);
if (columnSql != null && columnSql.contains("@"))
columnSql = Env.parseContext(Env.getCtx(), -1, columnSql, false, true);
if (columnSql != null && columnSql.length() > 0) if (columnSql != null && columnSql.length() > 0)
m_queryColumnsSql.add(columnSql); m_queryColumnsSql.add(columnSql);
else else
@ -325,6 +327,8 @@ public class InfoGeneral extends Info
int AD_Reference_Value_ID = rs.getInt(5); int AD_Reference_Value_ID = rs.getInt(5);
// teo_sarca // teo_sarca
String columnSql = rs.getString(6); String columnSql = rs.getString(6);
if (columnSql != null && columnSql.contains("@"))
columnSql = Env.parseContext(Env.getCtx(), -1, columnSql, false, true);
if (columnSql == null || columnSql.length() == 0) if (columnSql == null || columnSql.length() == 0)
columnSql = columnName; columnSql = columnName;
// Default // Default

View File

@ -301,7 +301,8 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
{ {
m_queryColumns.add(rs.getString(1)); m_queryColumns.add(rs.getString(1));
String columnSql = rs.getString(4); String columnSql = rs.getString(4);
if (columnSql != null && columnSql.contains("@"))
columnSql = Env.parseContext(Env.getCtx(), -1, columnSql, false, true);
if (columnSql != null && columnSql.length() > 0) if (columnSql != null && columnSql.length() > 0)
m_queryColumnsSql.add(columnSql); m_queryColumnsSql.add(columnSql);
else else
@ -378,7 +379,8 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
boolean isDisplayed = rs.getString(4).equals("Y"); boolean isDisplayed = rs.getString(4).equals("Y");
int AD_Reference_Value_ID = rs.getInt(5); int AD_Reference_Value_ID = rs.getInt(5);
String columnSql = rs.getString(6); String columnSql = rs.getString(6);
if (columnSql != null && columnSql.contains("@"))
columnSql = Env.parseContext(Env.getCtx(), -1, columnSql, false, true);
if (columnSql == null || columnSql.length() == 0) if (columnSql == null || columnSql.length() == 0)
columnSql = columnName; columnSql = columnName;