IDEMPIERE-1725 List of available print formats should be filtered with report view in report viewer

This commit is contained in:
Nicolas Micoud 2014-07-02 08:39:06 -05:00
parent 1024db2d14
commit 596670afd5
1 changed files with 9 additions and 3 deletions

View File

@ -596,6 +596,8 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
if (AD_Window_ID == 0)
AD_Window_ID = Env.getZoomWindowID(m_reportEngine.getQuery());
int reportViewID = m_reportEngine.getPrintFormat().getAD_ReportView_ID();
// fill Report Options
String sql = MRole.getDefault().addAccessSQL(
"SELECT * "
@ -605,6 +607,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
+ "AND IsActive='Y' "
//End of Added Lines
+ (AD_Window_ID > 0 ? "AND (AD_Window_ID=? OR AD_Window_ID IS NULL) " : "")
+ (reportViewID > 0 ? "AND AD_ReportView_ID=? " : "")
+ "ORDER BY Name",
"AD_PrintFormat", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
int AD_Table_ID = m_reportEngine.getPrintFormat().getAD_Table_ID();
@ -613,9 +616,12 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Table_ID);
int idx = 1;
pstmt.setInt(idx++, AD_Table_ID);
if (AD_Window_ID > 0)
pstmt.setInt(2, AD_Window_ID);
pstmt.setInt(idx++, AD_Window_ID);
if (reportViewID > 0)
pstmt.setInt(idx++, reportViewID);
rs = pstmt.executeQuery();
while (rs.next())
{