From 596670afd5dcf25bf9288be120753bc53665dc60 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 2 Jul 2014 08:39:06 -0500 Subject: [PATCH] IDEMPIERE-1725 List of available print formats should be filtered with report view in report viewer --- .../org/adempiere/webui/window/ZkReportViewer.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index a47dcced8c..7604a1f989 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -595,7 +595,9 @@ public class ZkReportViewer extends Window implements EventListener, ITab int AD_Window_ID = Env.getContextAsInt(Env.getCtx(), m_reportEngine.getWindowNo(), "_WinInfo_AD_Window_ID", true); 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, 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, 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()) {