diff --git a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java index a356b9f613..96939c3a41 100644 --- a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java +++ b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java @@ -1478,43 +1478,11 @@ public class ReportStarter implements ProcessCall, ClientProcess */ public ReportData getReportData (ProcessInfo pi, String trxName) { - log.info(""); - String sql = "SELECT pr.JasperReport, pr.IsDirectPrint " - + "FROM AD_Process pr, AD_PInstance pi " - + "WHERE pr.AD_Process_ID = pi.AD_Process_ID " - + " AND pi.AD_PInstance_ID=?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, trxName); - pstmt.setInt(1, pi.getAD_PInstance_ID()); - rs = pstmt.executeQuery(); - String path = null; - boolean directPrint = false; - boolean isPrintPreview = pi.isPrintPreview(); - if (rs.next()) { - path = rs.getString(1); - - if ("Y".equalsIgnoreCase(rs.getString(2)) && !Ini.isPropertyBool(Ini.P_PRINTPREVIEW) - && !isPrintPreview ) - directPrint = true; - } else { - log.severe("data not found; sql = "+sql); - return null; - } - - return new ReportData( path, directPrint); - } - catch (SQLException e) - { - throw new DBException(e, sql); - } - finally - { - DB.close(rs, pstmt); - rs = null; pstmt = null; - } + MProcess process = MProcess.get(pi.getAD_Process_ID()); + String path = process.getJasperReport(); + boolean isPrintPreview = pi.isPrintPreview(); + boolean directPrint = (process.isDirectPrint() && !Ini.isPropertyBool(Ini.P_PRINTPREVIEW) && !isPrintPreview); + return new ReportData( path, directPrint); } static class ReportData {