From 51ed00a1eca99fb8fe1dd8556dc302f9943d5ef7 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 6 Sep 2011 12:13:13 +0800 Subject: [PATCH] IDEMPIERE-16 Can report all users from "My Profile" window. Make report window to Inherit where clause from tab. (transplanted from ed65734395b7e40d981da1c2f9050711c015455a) --- .../src/org/adempiere/webui/apps/WReport.java | 23 ++++++++++++++++++- .../webui/panel/AbstractADWindowPanel.java | 2 +- .../adempiere/webui/window/FindWindow.java | 2 ++ .../webui/window/ZkReportViewer.java | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java index 3a45136093..2bb4c53e1c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java @@ -71,6 +71,22 @@ public class WReport implements EventListener { */ public WReport (int AD_Table_ID, MQuery query, Component parent, int WindowNo) + { + this(AD_Table_ID, query, parent, WindowNo, null); + } + + /** + * Constructor + * + * @param AD_Table_ID table + * @param invoker component to display popup (optional) + * @param query query + * @param parent The invoking parent window + * @param WindowNo The invoking parent window number + * @param whereExtended + */ + public WReport (int AD_Table_ID, MQuery query, Component parent, + int WindowNo, String whereExtended) { log.config("AD_Table_ID=" + AD_Table_ID + " " + query); if (!MRole.getDefault().isCanReport(AD_Table_ID)) @@ -82,6 +98,7 @@ public class WReport implements EventListener { m_query = query; this.parent = parent; this.WindowNo = WindowNo; + this.whereExtended = whereExtended; // See What is there getPrintFormats (AD_Table_ID); @@ -98,7 +115,9 @@ public class WReport implements EventListener { Component parent; /** The parent window number */ int WindowNo; - + /** The filter to apply to this report */ + private String whereExtended; + /** * Get the Print Formats for the table. * Fill the list and the popup menu @@ -214,6 +233,8 @@ public class WReport implements EventListener { { // It's a default report using the standard printing engine ReportEngine re = new ReportEngine (Env.getCtx(), pf, m_query, info); + re.setWhereExtended(whereExtended); + re.setWindowNo(WindowNo); ReportCtl.preview(re); } } // launchReport diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index 5362150322..5435a41d79 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -1843,7 +1843,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To infoName, infoDisplay); } - new WReport (curTab.getAD_Table_ID(), query, toolbar.getEvent().getTarget(), curWindowNo); + new WReport (curTab.getAD_Table_ID(), query, toolbar.getEvent().getTarget(), curWindowNo, curTab.getWhereExtended()); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index c47c98ea59..c8a59e63ab 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -1023,6 +1023,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe { // m_query = new MQuery(m_tableName); + m_query.addRestriction(Env.parseContext(Env.getCtx(), m_targetWindowNo, m_whereExtended, false)); StringBuffer code = new StringBuffer(); List rowList = advancedPanel.getChildren(); @@ -1304,6 +1305,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe { // Create Query String m_query = new MQuery(m_tableName); + m_query.addRestriction(Env.parseContext(Env.getCtx(), m_targetWindowNo, m_whereExtended, false)); if (hasValue && !fieldValue.getText().equals("%") && fieldValue.getText().length() != 0) { String value = fieldValue.getText().toUpperCase(); 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 23ea805629..467a2cfe25 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 @@ -975,7 +975,7 @@ public class ZkReportViewer extends Window implements EventListener, ITabOnClose bFind.setVisible(false); else { - FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,"", findFields, 1, AD_Tab_ID); + FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,m_reportEngine.getWhereExtended(), findFields, 1, AD_Tab_ID); if (!find.isCancel()) { m_reportEngine.setQuery(find.getQuery());