IDEMPIERE-214 - Schedular does not work with Jasper reports

(transplanted from 56ae246dc7cc02cbee0ec8ff89c51d86f97cb2a6)
This commit is contained in:
Hesham S. Ahmed 2012-07-10 20:43:19 +03:00
parent 42fbf81e8e
commit bb8239152c
2 changed files with 24 additions and 7 deletions

View File

@ -4,7 +4,9 @@ Bundle-Name: org.adempiere.server
Bundle-SymbolicName: org.adempiere.server;singleton:=true Bundle-SymbolicName: org.adempiere.server;singleton:=true
Bundle-Version: 1.0.0.qualifier Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.adempiere.base;bundle-version="1.0.0", Require-Bundle: org.adempiere.base;bundle-version="1.0.0",
org.eclipse.equinox.app;bundle-version="1.3.0" org.eclipse.equinox.app;bundle-version="1.3.0",
org.adempiere.report.jasper;bundle-version="1.0.0",
org.adempiere.report.jasper.library;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Web-ContextPath: / Web-ContextPath: /
Bundle-ClassPath: WEB-INF/lib/jardiff.jar, Bundle-ClassPath: WEB-INF/lib/jardiff.jar,

View File

@ -38,9 +38,11 @@ import org.compiere.model.MScheduler;
import org.compiere.model.MSchedulerLog; import org.compiere.model.MSchedulerLog;
import org.compiere.model.MSchedulerPara; import org.compiere.model.MSchedulerPara;
import org.compiere.model.MUser; import org.compiere.model.MUser;
import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportEngine; import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoUtil; import org.compiere.process.ProcessInfoUtil;
import org.compiere.process.ServerProcessCtl;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.TimeUtil; import org.compiere.util.TimeUtil;
@ -217,12 +219,25 @@ public class Scheduler extends AdempiereServer
File report = null; File report = null;
if (isReport) { if (isReport) {
// Report // Report
ReportEngine re = ReportEngine.get(m_schedulerctx, pi); if(process.getJasperReport() != null)
if (re == null) {
return "Cannot create Report AD_Process_ID=" + process.getAD_Process_ID() ProcessInfo jasperpi = new ProcessInfo ("", process.getAD_Process_ID());
+ " - " + process.getName(); jasperpi.setIsBatch(true);
report = re.getPDF(); ServerProcessCtl.process(null, jasperpi, null);
report = jasperpi.getPDFReport();
}
// Standard Print Format (Non-Jasper)
// ==================================
else
{
// We have a Jasper Print Format
// ==============================
ReportEngine re = ReportEngine.get(m_schedulerctx, pi);
if (re == null)
return "Cannot create Report AD_Process_ID=" + process.getAD_Process_ID()
+ " - " + process.getName();
report = re.getPDF();
}
} }
if (notice) { if (notice) {