IDEMPIERE-2101 Invoice Print NPE in zk

This commit is contained in:
Carlos Ruiz 2014-07-27 19:11:39 +02:00
parent 53c142a32c
commit 29530e1bce
1 changed files with 16 additions and 6 deletions

View File

@ -229,7 +229,7 @@ public class InvoicePrint extends SvrProcess
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
List<File> pdfList = new ArrayList<File>(); final List<File> pdfList = new ArrayList<File>();
try try
{ {
pstmt = DB.prepareStatement(sql.toString(), get_TrxName()); pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
@ -368,6 +368,20 @@ public class InvoicePrint extends SvrProcess
DB.close(rs, pstmt); 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<File> pdfList) {
if (pdfList.size() > 1) { if (pdfList.size() > 1) {
try { try {
File outFile = File.createTempFile("InvoicePrint", ".pdf"); 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 } // InvoicePrint