IDEMPIERE-659 Use of Context Variables in Report Views' where clause
This commit is contained in:
parent
75948bce27
commit
34a5b9212a
|
@ -171,8 +171,13 @@ public class DataEngine
|
||||||
reportName = rs.getString(3);
|
reportName = rs.getString(3);
|
||||||
// Add WhereClause restriction from AD_ReportView - teo_sarca BF [ 1761891 ]
|
// Add WhereClause restriction from AD_ReportView - teo_sarca BF [ 1761891 ]
|
||||||
String whereClause = rs.getString(4);
|
String whereClause = rs.getString(4);
|
||||||
if (!Util.isEmpty(whereClause))
|
if (!Util.isEmpty(whereClause)) {
|
||||||
queryCopy.addRestriction(whereClause);
|
if (whereClause.indexOf("@") == -1) {
|
||||||
|
query.addRestriction(whereClause);
|
||||||
|
} else { // replace context variables
|
||||||
|
query.addRestriction(Env.parseContext(ctx, 0, whereClause.toString(), false, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
|
|
|
@ -1125,7 +1125,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
int AD_Table_ID = 0;
|
int AD_Table_ID = 0;
|
||||||
int AD_ReportView_ID = 0;
|
int AD_ReportView_ID = 0;
|
||||||
String TableName = null;
|
String TableName = null;
|
||||||
String whereClause = "";
|
|
||||||
int AD_PrintFormat_ID = 0;
|
int AD_PrintFormat_ID = 0;
|
||||||
boolean IsForm = false;
|
boolean IsForm = false;
|
||||||
int Client_ID = -1;
|
int Client_ID = -1;
|
||||||
|
@ -1152,9 +1151,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
AD_ReportView_ID = rs.getInt(1); // required
|
AD_ReportView_ID = rs.getInt(1); // required
|
||||||
whereClause = rs.getString(2);
|
|
||||||
if (rs.wasNull())
|
|
||||||
whereClause = "";
|
|
||||||
//
|
//
|
||||||
AD_Table_ID = rs.getInt(3);
|
AD_Table_ID = rs.getInt(3);
|
||||||
TableName = rs.getString(4); // required for query
|
TableName = rs.getString(4); // required for query
|
||||||
|
@ -1188,7 +1184,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
whereClause = "";
|
|
||||||
AD_Table_ID = rs.getInt(1);
|
AD_Table_ID = rs.getInt(1);
|
||||||
TableName = rs.getString(2); // required for query
|
TableName = rs.getString(2); // required for query
|
||||||
AD_PrintFormat_ID = rs.getInt(3); // required
|
AD_PrintFormat_ID = rs.getInt(3); // required
|
||||||
|
@ -1224,10 +1219,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName);
|
query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to static where clause from ReportView
|
|
||||||
if (whereClause.length() != 0)
|
|
||||||
query.addRestriction(whereClause);
|
|
||||||
|
|
||||||
// Get Print Format
|
// Get Print Format
|
||||||
MPrintFormat format = null;
|
MPrintFormat format = null;
|
||||||
Object so = pi.getSerializableObject();
|
Object so = pi.getSerializableObject();
|
||||||
|
|
Loading…
Reference in New Issue