IDEMPIERE-6168 Found problems with jasper setting filename (#2390)

This commit is contained in:
Carlos Ruiz 2024-06-11 09:15:45 +02:00
parent 4875568cf2
commit 6d9c35a365
4 changed files with 15 additions and 13 deletions

View File

@ -1686,10 +1686,10 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
if (DocSubTypeSO == null) if (DocSubTypeSO == null)
DocSubTypeSO = ""; DocSubTypeSO = "";
// WalkIn Receipt, WalkIn Invoice, // WalkIn Receipt, WalkIn Invoice,
if (DocSubTypeSO.equals("WR") || DocSubTypeSO.equals("WI")) if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_POS) || DocSubTypeSO.equals(MOrder.DocSubTypeSO_OnCredit))
what[0] = INVOICE; what[0] = INVOICE;
// WalkIn Pickup, // WalkIn Pickup,
else if (DocSubTypeSO.equals("WP")) else if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_Warehouse))
what[0] = SHIPMENT; what[0] = SHIPMENT;
// Offer Binding, Offer Nonbinding, Standard Order // Offer Binding, Offer Nonbinding, Standard Order
else else

View File

@ -256,6 +256,11 @@ public class ServerProcessCtl implements Runnable {
m_pi.setReportingProcess(true); m_pi.setReportingProcess(true);
m_pi.setClassName(ProcessUtil.JASPER_STARTER_CLASS); m_pi.setClassName(ProcessUtil.JASPER_STARTER_CLASS);
startProcess(); startProcess();
if (m_pi.isError()) {
MPInstance pinstance = new MPInstance(Env.getCtx(), m_pi.getAD_PInstance_ID(), null);
pinstance.setErrorMsg(m_pi.getSummary());
pinstance.saveEx();
}
return; return;
} }

View File

@ -229,10 +229,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
String[] reportPathList = reportFilePath.split(";"); String[] reportPathList = reportFilePath.split(";");
for (String reportPath : reportPathList) { for (String reportPath : reportPathList) {
if (Util.isEmpty(reportPath, true)) if (Util.isEmpty(reportPath, true))
{ throw new AdempiereException("Invalid report file path: " + reportFilePath);
pi.setSummary("Invalid report file path: " + reportFilePath, true);
return false;
}
if (reportPath.startsWith("@#LocalHttpAddr@")) { if (reportPath.startsWith("@#LocalHttpAddr@")) {
String localaddr = Env.getContext(Env.getCtx(), Env.LOCAL_HTTP_ADDRESS); String localaddr = Env.getContext(Env.getCtx(), Env.LOCAL_HTTP_ADDRESS);
if (!Util.isEmpty(localaddr)) { if (!Util.isEmpty(localaddr)) {
@ -263,11 +260,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
} }
if (reportFile == null && reportURL == null) if (reportFile == null && reportURL == null)
{ throw new AdempiereException("Can not load report from path: " + reportPath);
String tmp = "Can not load report from path: " + reportPath;
pi.setSummary(tmp, true);
return false;
}
JasperInfo jasperInfo = reportFile != null ? getJasperInfo(reportFile) : getJasperInfo(reportURL); JasperInfo jasperInfo = reportFile != null ? getJasperInfo(reportFile) : getJasperInfo(reportURL);
JasperReport jasperReport = jasperInfo.getJasperReport(); JasperReport jasperReport = jasperInfo.getJasperReport();

View File

@ -476,8 +476,12 @@ public class ReportCtl
// ============================== // ==============================
if(format.getJasperProcess_ID() > 0) if(format.getJasperProcess_ID() > 0)
{ {
ServerReportCtl.runJasperProcess(Record_ID, re, IsDirectPrint, printerName); int jasperRecordId = Record_ID;
if (IsDirectPrint) { if (re.getPrintInfo() != null && re.getPrintInfo().getRecord_ID() > 0)
jasperRecordId = re.getPrintInfo().getRecord_ID();
boolean result = ServerReportCtl.runJasperProcess(jasperRecordId, re, IsDirectPrint, printerName);
if (result && IsDirectPrint)
{
ReportEngine.printConfirm(type, Record_ID); ReportEngine.printConfirm(type, Record_ID);
} }
} }