IDEMPIERE-1053 WxxxGenForm and InvoicePrint process can't use jasper print format
This commit is contained in:
parent
5aeaec339c
commit
7d028de0a3
|
@ -74,12 +74,14 @@ import org.compiere.model.PrintInfo;
|
||||||
import static org.compiere.model.SystemIDs.*;
|
import static org.compiere.model.SystemIDs.*;
|
||||||
import org.compiere.print.layout.LayoutEngine;
|
import org.compiere.print.layout.LayoutEngine;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
|
import org.compiere.process.ServerProcessCtl;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Ini;
|
import org.compiere.util.Ini;
|
||||||
import org.compiere.util.Language;
|
import org.compiere.util.Language;
|
||||||
|
import org.compiere.util.Trx;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
import org.eevolution.model.MDDOrder;
|
import org.eevolution.model.MDDOrder;
|
||||||
import org.eevolution.model.X_PP_Order;
|
import org.eevolution.model.X_PP_Order;
|
||||||
|
@ -993,10 +995,17 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (m_layout == null)
|
if (m_printFormat != null && m_printFormat.getJasperProcess_ID() > 0) {
|
||||||
layout ();
|
ProcessInfo pi = new ProcessInfo ("", m_printFormat.getJasperProcess_ID(), m_printFormat.getAD_Table_ID(), m_info.getRecord_ID());
|
||||||
Document.getPDFAsFile(fileName, m_layout.getPageable(false));
|
pi.setIsBatch(true);
|
||||||
ArchiveEngine.get().archive(new File(fileName), m_info);
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ProcessInfo implements Serializable
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1371812474929601477L;
|
private static final long serialVersionUID = -3654748247858779823L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -783,4 +783,16 @@ public class ProcessInfo implements Serializable
|
||||||
public PO getPO() {
|
public PO getPO() {
|
||||||
return m_po;
|
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
|
} // ProcessInfo
|
||||||
|
|
|
@ -668,7 +668,12 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
||||||
{
|
{
|
||||||
try
|
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();
|
DefaultJasperReportsContext jrContext = DefaultJasperReportsContext.getInstance();
|
||||||
LocalJasperReportsContext ljrContext = new LocalJasperReportsContext(jrContext);
|
LocalJasperReportsContext ljrContext = new LocalJasperReportsContext(jrContext);
|
||||||
ljrContext.setClassLoader(this.getClass().getClassLoader());
|
ljrContext.setClassLoader(this.getClass().getClassLoader());
|
||||||
|
|
Loading…
Reference in New Issue