IDEMPIERE-3856 reportstart: switch query process by process_id instead of AD_PInstance_ID (#733)
This commit is contained in:
parent
adc9999d89
commit
c94583f0f1
|
@ -1478,43 +1478,11 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
||||||
*/
|
*/
|
||||||
public ReportData getReportData (ProcessInfo pi, String trxName)
|
public ReportData getReportData (ProcessInfo pi, String trxName)
|
||||||
{
|
{
|
||||||
log.info("");
|
MProcess process = MProcess.get(pi.getAD_Process_ID());
|
||||||
String sql = "SELECT pr.JasperReport, pr.IsDirectPrint "
|
String path = process.getJasperReport();
|
||||||
+ "FROM AD_Process pr, AD_PInstance pi "
|
boolean isPrintPreview = pi.isPrintPreview();
|
||||||
+ "WHERE pr.AD_Process_ID = pi.AD_Process_ID "
|
boolean directPrint = (process.isDirectPrint() && !Ini.isPropertyBool(Ini.P_PRINTPREVIEW) && !isPrintPreview);
|
||||||
+ " AND pi.AD_PInstance_ID=?";
|
return new ReportData( path, directPrint);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ReportData {
|
static class ReportData {
|
||||||
|
|
Loading…
Reference in New Issue