IDEMPIERE-6165 + IDEMPIERE-6168 More problems with jasper setting filename (#2392)

- the test case is failing for orders with jasper print format
- the downloadable file name for jasper is wrong in zk when using FileNamePattern
This commit is contained in:
Carlos Ruiz 2024-06-13 03:39:44 +02:00
parent 689573c90d
commit a45283b855
3 changed files with 7 additions and 5 deletions

View File

@ -85,7 +85,10 @@ public class ServerReportCtl {
// ============================== // ==============================
if(format.getJasperProcess_ID() > 0) if(format.getJasperProcess_ID() > 0)
{ {
boolean result = runJasperProcess(Record_ID, re, true, printerName, pi); int jasperRecordId = Record_ID;
if (re.getPrintInfo() != null && re.getPrintInfo().getRecord_ID() > 0)
jasperRecordId = re.getPrintInfo().getRecord_ID();
boolean result = runJasperProcess(jasperRecordId, re, true, printerName, pi);
return(result); return(result);
} }
else else

View File

@ -427,7 +427,7 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
mediaSuppliers.put(toMediaType(PDF_MIME_TYPE, PDF_FILE_EXT), () -> { mediaSuppliers.put(toMediaType(PDF_MIME_TYPE, PDF_FILE_EXT), () -> {
try { try {
attachment = getPDF(); attachment = getPDF();
return new AMedia(m_title+"."+PDF_FILE_EXT, PDF_FILE_EXT, PDF_MIME_TYPE, attachment, true); return new AMedia(attachment.getName(), PDF_FILE_EXT, PDF_MIME_TYPE, attachment, true);
} catch (Exception e) { } catch (Exception e) {
if (e instanceof RuntimeException) if (e instanceof RuntimeException)
throw (RuntimeException)e; throw (RuntimeException)e;

View File

@ -31,6 +31,7 @@ import java.io.File;
import org.compiere.model.MOrder; import org.compiere.model.MOrder;
import org.compiere.model.MPInstance; import org.compiere.model.MPInstance;
import org.compiere.model.MProcess; import org.compiere.model.MProcess;
import org.compiere.model.SystemIDs;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
import org.compiere.process.ServerProcessCtl; import org.compiere.process.ServerProcessCtl;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -45,14 +46,12 @@ public class ReportTest extends AbstractTestCase {
public ReportTest() { public ReportTest() {
} }
private static final int Order_Print_Process = 110;
/** /**
* https://idempiere.atlassian.net/browse/IDEMPIERE-6165 * https://idempiere.atlassian.net/browse/IDEMPIERE-6165
*/ */
@Test @Test
public void testPDFFileName() { public void testPDFFileName() {
MProcess orderReport = MProcess.get(Env.getCtx(), Order_Print_Process); MProcess orderReport = MProcess.get(Env.getCtx(), SystemIDs.PROCESS_RPT_C_ORDER);
MOrder order = new MOrder(Env.getCtx(), 108, getTrxName()); // Garden Order 60000 MOrder order = new MOrder(Env.getCtx(), 108, getTrxName()); // Garden Order 60000
String fileName = order.getDocumentNo() + ".pdf"; String fileName = order.getDocumentNo() + ".pdf";