From 93144b9d1694ee5f483a7b609d4ebd600cdf8436 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 18 Sep 2009 04:11:59 +0000 Subject: [PATCH] Print button while creating a new document - ID: 2858657 --- client/src/org/compiere/print/ReportCtl.java | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/client/src/org/compiere/print/ReportCtl.java b/client/src/org/compiere/print/ReportCtl.java index e42a67b65c..31e91bf282 100644 --- a/client/src/org/compiere/print/ReportCtl.java +++ b/client/src/org/compiere/print/ReportCtl.java @@ -16,10 +16,11 @@ *****************************************************************************/ package org.compiere.print; +import java.lang.reflect.Method; import java.util.Properties; import java.util.logging.Level; -import org.adempiere.webui.window.FDialog; +import org.adempiere.exceptions.AdempiereException; import org.compiere.apps.ADialog; import org.compiere.apps.ProcessCtl; import org.compiere.model.MPaySelectionCheck; @@ -32,7 +33,6 @@ import org.compiere.util.ASyncProcess; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Ini; -import org.zkoss.zk.ui.Component; /** * Report Controller. @@ -257,7 +257,23 @@ public class ReportCtl ReportEngine re = ReportEngine.get (Env.getCtx(), type, Record_ID); if (re == null) { - ADialog.error(0, null, "NoDocPrintFormat"); + if (Ini.isClient()) + { + ADialog.error(0, null, "NoDocPrintFormat"); + } + else + { + try + { + ClassLoader loader = ReportCtl.class.getClassLoader(); + Class clazz = loader.loadClass("org.adempiere.webui.window.FDialog"); + Method m = clazz.getMethod("error", Integer.TYPE, String.class); + m.invoke(null, 0, "NoDocPrintFormat"); + } catch (Exception e) + { + throw new AdempiereException(e); + } + } return false; }