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)
DocSubTypeSO = "";
// 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;
// WalkIn Pickup,
else if (DocSubTypeSO.equals("WP"))
else if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_Warehouse))
what[0] = SHIPMENT;
// Offer Binding, Offer Nonbinding, Standard Order
else

View File

@ -256,6 +256,11 @@ public class ServerProcessCtl implements Runnable {
m_pi.setReportingProcess(true);
m_pi.setClassName(ProcessUtil.JASPER_STARTER_CLASS);
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;
}

View File

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

View File

@ -476,8 +476,12 @@ public class ReportCtl
// ==============================
if(format.getJasperProcess_ID() > 0)
{
ServerReportCtl.runJasperProcess(Record_ID, re, IsDirectPrint, printerName);
if (IsDirectPrint) {
int jasperRecordId = Record_ID;
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);
}
}