From 29530e1bce8317767b4e6b5a4f2527af3fd97db1 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 27 Jul 2014 19:11:39 +0200 Subject: [PATCH] IDEMPIERE-2101 Invoice Print NPE in zk --- .../adempiere/webui/process/InvoicePrint.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java index a56e43f0cd..90089e6dcb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java @@ -229,7 +229,7 @@ public class InvoicePrint extends SvrProcess PreparedStatement pstmt = null; ResultSet rs = null; - List pdfList = new ArrayList(); + final List pdfList = new ArrayList(); try { pstmt = DB.prepareStatement(sql.toString(), get_TrxName()); @@ -368,6 +368,20 @@ public class InvoicePrint extends SvrProcess DB.close(rs, pstmt); } + AEnv.executeAsyncDesktopTask(new Runnable() { + @Override + public void run() { + showReports(pdfList); + } + }); + + // + if (p_EMailPDF) + return "@Sent@=" + count + " - @Errors@=" + errors; + return "@Printed@=" + count; + } // doIt + + private void showReports(List pdfList) { if (pdfList.size() > 1) { try { File outFile = File.createTempFile("InvoicePrint", ".pdf"); @@ -390,10 +404,6 @@ public class InvoicePrint extends SvrProcess } } - // - if (p_EMailPDF) - return "@Sent@=" + count + " - @Errors@=" + errors; - return "@Printed@=" + count; - } // doIt + } } // InvoicePrint