IDEMPIERE-3856 reportstart: switch query process by process_id instead of AD_PInstance_ID (#733)

This commit is contained in:
hengsin 2021-06-28 19:58:46 +08:00 committed by GitHub
parent adc9999d89
commit c94583f0f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 37 deletions

View File

@ -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 {