IDEMPIERE-1053 WxxxGenForm and InvoicePrint process can't use jasper print format

This commit is contained in:
Carlos Ruiz 2014-07-28 12:26:53 +02:00
parent 5aeaec339c
commit 7d028de0a3
3 changed files with 32 additions and 6 deletions

View File

@ -74,12 +74,14 @@ import org.compiere.model.PrintInfo;
import static org.compiere.model.SystemIDs.*;
import org.compiere.print.layout.LayoutEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ServerProcessCtl;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Ini;
import org.compiere.util.Language;
import org.compiere.util.Trx;
import org.compiere.util.Util;
import org.eevolution.model.MDDOrder;
import org.eevolution.model.X_PP_Order;
@ -993,11 +995,18 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
try
{
if (m_printFormat != null && m_printFormat.getJasperProcess_ID() > 0) {
ProcessInfo pi = new ProcessInfo ("", m_printFormat.getJasperProcess_ID(), m_printFormat.getAD_Table_ID(), m_info.getRecord_ID());
pi.setIsBatch(true);
pi.setPDFFileName(fileName);
ServerProcessCtl.process(pi, (m_trxName == null ? null : Trx.get(m_trxName, false)));
} else {
if (m_layout == null)
layout ();
Document.getPDFAsFile(fileName, m_layout.getPageable(false));
ArchiveEngine.get().archive(new File(fileName), m_info);
}
}
catch (Exception e)
{
log.log(Level.SEVERE, "PDF", e);

View File

@ -43,7 +43,7 @@ public class ProcessInfo implements Serializable
/**
*
*/
private static final long serialVersionUID = 1371812474929601477L;
private static final long serialVersionUID = -3654748247858779823L;
/**
* Constructor
@ -783,4 +783,16 @@ public class ProcessInfo implements Serializable
public PO getPO() {
return m_po;
}
/** FileName to be used */
private String m_PDFfileName;
public String getPDFFileName() {
return m_PDFfileName;
}
public void setPDFFileName(String fileName) {
this.m_PDFfileName = fileName;
}
} // ProcessInfo

View File

@ -668,7 +668,12 @@ public class ReportStarter implements ProcessCall, ClientProcess
{
try
{
File PDF = File.createTempFile(makePrefix(jasperPrint.getName()), ".pdf");
File PDF;
if (processInfo.getPDFFileName() != null) {
PDF = new File(processInfo.getPDFFileName());
} else {
PDF = File.createTempFile(makePrefix(jasperPrint.getName()), ".pdf");
}
DefaultJasperReportsContext jrContext = DefaultJasperReportsContext.getInstance();
LocalJasperReportsContext ljrContext = new LocalJasperReportsContext(jrContext);
ljrContext.setClassLoader(this.getClass().getClassLoader());