IDEMPIERE-659 Use of Context Variables in Report Views' where clause

This commit is contained in:
Carlos Ruiz 2014-10-01 09:13:46 -05:00
parent 75948bce27
commit 34a5b9212a
2 changed files with 7 additions and 11 deletions

View File

@ -171,8 +171,13 @@ public class DataEngine
reportName = rs.getString(3);
// Add WhereClause restriction from AD_ReportView - teo_sarca BF [ 1761891 ]
String whereClause = rs.getString(4);
if (!Util.isEmpty(whereClause))
queryCopy.addRestriction(whereClause);
if (!Util.isEmpty(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)

View File

@ -1125,7 +1125,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
int AD_Table_ID = 0;
int AD_ReportView_ID = 0;
String TableName = null;
String whereClause = "";
int AD_PrintFormat_ID = 0;
boolean IsForm = false;
int Client_ID = -1;
@ -1152,9 +1151,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
if (rs.next())
{
AD_ReportView_ID = rs.getInt(1); // required
whereClause = rs.getString(2);
if (rs.wasNull())
whereClause = "";
//
AD_Table_ID = rs.getInt(3);
TableName = rs.getString(4); // required for query
@ -1188,7 +1184,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
rs = pstmt.executeQuery();
if (rs.next())
{
whereClause = "";
AD_Table_ID = rs.getInt(1);
TableName = rs.getString(2); // required for query
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);
}
// Add to static where clause from ReportView
if (whereClause.length() != 0)
query.addRestriction(whereClause);
// Get Print Format
MPrintFormat format = null;
Object so = pi.getSerializableObject();