diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index caa4bbfb56..bfd7760d26 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -2855,4 +2855,20 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) element.setStyle(styleBuilder.toString()); // } + + private ProcessInfo m_pi = null; + + /** + * @param pi + */ + public void setProcessInfo(ProcessInfo pi) { + m_pi = pi; + } + + /** + * @return ProcessInfo + */ + public ProcessInfo getProcessInfo() { + return m_pi; + } } // ReportEngine diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java index fc26b84d71..c2815c8658 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java @@ -93,6 +93,8 @@ import com.lowagie.text.pdf.PdfWriter; */ public class ProcessDialog extends AbstractProcessDialog implements EventListener, IHelpContext, ITabOnCloseHandler { + public static final String SAVED_PREDEFINED_CONTEXT_VARIABLES = "__PredefinedContextVariables__"; + /** * generated serial id */ @@ -152,6 +154,11 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene m_WindowNo = SessionManager.getAppDesktop().registerWindow(this); this.setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, m_WindowNo); Env.setContext(Env.getCtx(), m_WindowNo, "IsSOTrx", isSOTrx ? "Y" : "N"); + //save for rerun of report + if (predefinedContextVariables != null && MProcess.get(AD_Process_ID).isReport()) + { + Env.setContext(Env.getCtx(), m_WindowNo, SAVED_PREDEFINED_CONTEXT_VARIABLES, predefinedContextVariables); + } Env.setPredefinedVariables(Env.getCtx(), m_WindowNo, predefinedContextVariables); try { 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 f7ae2ae4f1..fd7bfbd664 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 @@ -44,6 +44,7 @@ import org.adempiere.webui.Extensions; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.BusyDialog; +import org.adempiere.webui.apps.ProcessDialog; import org.adempiere.webui.apps.ProcessModalDialog; import org.adempiere.webui.apps.WReport; import org.adempiere.webui.apps.form.WReportCustomization; @@ -52,6 +53,7 @@ import org.adempiere.webui.component.Label; import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Mask; +import org.adempiere.webui.component.ProcessInfoDialog; import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.Window; @@ -92,6 +94,7 @@ import org.compiere.print.ArchiveEngine; import org.compiere.print.MPrintFormat; import org.compiere.print.ReportEngine; import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoUtil; import org.compiere.tools.FileUtil; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -1038,7 +1041,24 @@ public class ZkReportViewer extends Window implements EventListener, IRep fillComboReport(m_reportEngine.getPrintFormat().get_ID()); revalidate(); + + if (Window.REPLACE.equals(getAttribute(Window.INSERT_POSITION_KEY))) { + if (m_reportEngine != null && m_reportEngine.getProcessInfo() != null) { + ProcessInfo pi = m_reportEngine.getProcessInfo(); + checkProcessInfo(pi); + } + } } // dynInit + + private void checkProcessInfo(ProcessInfo pi) { + ProcessInfoUtil.setLogFromDB(pi); + if (pi.isError() || (pi.getLogs() != null && pi.getLogs().length > 0)) { + ProcessInfoDialog dialog = new ProcessInfoDialog(pi, false); + dialog.setAutoCloseAfterZoom(false); + dialog.setPage(this.getPage()); + dialog.doHighlighted(); + } + } /** * Fill ComboBox comboReport (report options) @@ -1189,6 +1209,9 @@ public class ZkReportViewer extends Window implements EventListener, IRep if (getDesktop() != null) clearTabOnCloseHandler(); } + ProcessInfo pi = dialog.getProcessInfo(); + if (pi != null) + checkProcessInfo(pi); } } else if(IDesktop.ON_CLOSE_WINDOW_SHORTCUT_EVENT.equals(event.getName())) { @@ -1571,7 +1594,15 @@ public class ZkReportViewer extends Window implements EventListener, IRep pi.setReplaceTabContent(); if(!Util.isEmpty(showHelp)) pi.setShowHelp(showHelp); - setTabOnCloseHandler(); + setTabOnCloseHandler(); + String predefined = (String) getAttribute(ProcessDialog.SAVED_PREDEFINED_CONTEXT_VARIABLES); + if (!Util.isEmpty(predefined, true)) { + Env.setContext(Env.getCtx(), m_WindowNo, ProcessDialog.SAVED_PREDEFINED_CONTEXT_VARIABLES, predefined); + Env.setPredefinedVariables(Env.getCtx(), m_WindowNo, predefined); + } + if (getAttribute("IsSOTrx") != null) { + Env.setContext(Env.getCtx(), m_WindowNo, "IsSOTrx", getAttribute("IsSOTrx").toString()); + } ProcessModalDialog processModalDialog = new ProcessModalDialog(this, m_WindowNo, pi); ZKUpdateUtil.setWindowWidthX(processModalDialog, 850); this.getParent().appendChild(processModalDialog); @@ -1782,6 +1813,7 @@ public class ZkReportViewer extends Window implements EventListener, IRep } private boolean ToolBarMenuRestictionLoaded = false; + public void updateToolbarAccess(int AD_Window_ID, int AD_Process_ID) { if (ToolBarMenuRestictionLoaded) return; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java index fcc641e726..c8c047c2f9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java @@ -17,11 +17,14 @@ package org.adempiere.webui.window; import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.apps.ProcessDialog; import org.adempiere.webui.component.Window; import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.session.SessionManager; import org.compiere.print.ReportEngine; import org.compiere.print.ReportViewerProvider; +import org.compiere.util.Env; +import org.compiere.util.Util; import org.zkoss.zk.ui.Executions; /** @@ -55,6 +58,11 @@ public class ZkReportViewerProvider implements ReportViewerProvider { if(report.isReplaceTabContent()) { viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.REPLACE); viewer.setAttribute(WindowContainer.REPLACE_WINDOW_NO, report.getWindowNo()); + String predefined = Env.getContext(Env.getCtx(), report.getWindowNo(), ProcessDialog.SAVED_PREDEFINED_CONTEXT_VARIABLES); + if (!Util.isEmpty(predefined, true)) { + viewer.setAttribute(ProcessDialog.SAVED_PREDEFINED_CONTEXT_VARIABLES, predefined); + } + viewer.setAttribute("IsSOTrx", Env.getContext(Env.getCtx(), report.getWindowNo(), "IsSOTrx")); } viewer.setAttribute(WindowContainer.DEFER_SET_SELECTED_TAB, Boolean.TRUE); SessionManager.getAppDesktop().showWindow(viewer); diff --git a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java index 4c19bed8fd..2718753393 100644 --- a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java +++ b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java @@ -312,6 +312,7 @@ public class ReportCtl } re.setLanguageID(pi.getLanguageID()); re.setIsReplaceTabContent(pi.isReplaceTabContent()); + re.setProcessInfo(pi); createOutput(re, pi.isPrintPreview(), null); return true; } // startStandardReport