IDEMPIERE-4523 - Process Audit not mark AD_PInstance.IsProcessing on simple Reports (#1343)
* IDEMPIERE-4523 - Process Audit not mark AD_PInstance.IsProcessing on simple Reports * IDEMPIERE-4523 - fixed workflow use case
This commit is contained in:
parent
20116c6144
commit
bf32da5738
|
@ -15,6 +15,7 @@ import java.util.ArrayList;
|
|||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MPInstance;
|
||||
import org.compiere.model.MProcess;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MTable;
|
||||
|
@ -217,6 +218,11 @@ public class ServerReportCtl {
|
|||
static public boolean start (ProcessInfo pi)
|
||||
{
|
||||
|
||||
MPInstance instance = new MPInstance(Env.getCtx(), pi.getAD_PInstance_ID(), null);
|
||||
instance.setIsProcessing(true);
|
||||
instance.saveEx();
|
||||
|
||||
try {
|
||||
/**
|
||||
* Order Print
|
||||
*/
|
||||
|
@ -247,6 +253,11 @@ public class ServerReportCtl {
|
|||
* Standard Report
|
||||
*******************/
|
||||
return startStandardReport (pi);
|
||||
}
|
||||
finally {
|
||||
instance.setIsProcessing(false);
|
||||
instance.saveEx();
|
||||
}
|
||||
} // create
|
||||
|
||||
/**************************************************************************
|
||||
|
|
|
@ -1159,7 +1159,9 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
|
|||
// Process
|
||||
MProcess process = MProcess.get(getCtx(), m_node.getAD_Process_ID());
|
||||
MPInstance pInstance = new MPInstance(getCtx(), process.getAD_Process_ID(), getRecord_ID());
|
||||
pInstance.setIsProcessing(true);
|
||||
pInstance.saveEx();
|
||||
try {
|
||||
fillParameter(pInstance, trx);
|
||||
//
|
||||
ProcessInfo pi = new ProcessInfo (m_node.getName(true), m_node.getAD_Process_ID(),
|
||||
|
@ -1194,6 +1196,11 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
|
|||
setTextMsg(pi.getSummary());
|
||||
return success;
|
||||
}
|
||||
finally {
|
||||
pInstance.setIsProcessing(false);
|
||||
pInstance.saveEx();
|
||||
}
|
||||
}
|
||||
|
||||
/****** Start Task (Probably redundant;
|
||||
same can be achieved by attaching a Workflow node sequentially) ******/
|
||||
|
|
|
@ -869,8 +869,10 @@ public class DashboardController implements EventListener<Event> {
|
|||
int AD_Table_ID = 0;
|
||||
int Record_ID = 0;
|
||||
//
|
||||
MPInstance pInstance = new MPInstance(Env.getCtx(), process.getAD_Process_ID(), Record_ID);
|
||||
MPInstance pInstance = new MPInstance(process, Record_ID);
|
||||
pInstance.setIsProcessing(true);
|
||||
pInstance.saveEx();
|
||||
try {
|
||||
fillParameter(pInstance, parameters);
|
||||
//
|
||||
ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID(),
|
||||
|
@ -886,9 +888,14 @@ public class DashboardController implements EventListener<Event> {
|
|||
if (re == null)
|
||||
throw new IllegalStateException("Cannot create Report AD_Process_ID=" + process.getAD_Process_ID()
|
||||
+ " - " + process.getName());
|
||||
|
||||
return re;
|
||||
}
|
||||
finally {
|
||||
pInstance.setIsProcessing(false);
|
||||
pInstance.saveEx();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AMedia generateReport(int AD_Process_ID, String parameters) throws Exception {
|
||||
ReportEngine re = runReport(AD_Process_ID, parameters);
|
||||
|
|
|
@ -167,13 +167,21 @@ public abstract class AbstractProcessCtl implements Runnable
|
|||
*/
|
||||
if (AD_Workflow_ID > 0)
|
||||
{
|
||||
startWorkflow (AD_Workflow_ID);
|
||||
MPInstance pinstance = new MPInstance(Env.getCtx(), m_pi.getAD_PInstance_ID(), null);
|
||||
pinstance.setIsProcessing(true);
|
||||
pinstance.saveEx();
|
||||
try {
|
||||
startWorkflow (AD_Workflow_ID);
|
||||
String errmsg = m_pi.getSummary();
|
||||
pinstance.setResult(!m_pi.isError());
|
||||
pinstance.setErrorMsg(errmsg);
|
||||
pinstance.saveEx();
|
||||
unlock();
|
||||
}
|
||||
finally {
|
||||
pinstance.setIsProcessing(false);
|
||||
pinstance.saveEx();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,8 +136,10 @@ public class ReportCtl
|
|||
instance.setAD_PrintFormat_ID(((MPrintFormat)pi.getSerializableObject()).getAD_PrintFormat_ID());
|
||||
instance.setIsSummary(pi.isSummary());
|
||||
instance.setAD_Language_ID(pi.getLanguageID());
|
||||
instance.setIsProcessing(true);
|
||||
instance.saveEx();
|
||||
|
||||
try {
|
||||
/**
|
||||
* Order Print
|
||||
*/
|
||||
|
@ -178,6 +180,11 @@ public class ReportCtl
|
|||
* Standard Report
|
||||
*******************/
|
||||
return startStandardReport (pi, WindowNo);
|
||||
}
|
||||
finally {
|
||||
instance.setIsProcessing(false);
|
||||
instance.saveEx();
|
||||
}
|
||||
} // create
|
||||
|
||||
/**************************************************************************
|
||||
|
|
|
@ -324,6 +324,8 @@ public class Process {
|
|||
// Start
|
||||
if (process.isWorkflow())
|
||||
{
|
||||
pInstance.setIsProcessing(true);
|
||||
pInstance.saveEx();
|
||||
try
|
||||
{
|
||||
int AD_Workflow_ID = process.getAD_Workflow_ID();
|
||||
|
@ -345,6 +347,10 @@ public class Process {
|
|||
r.setIsError( true );
|
||||
return res;
|
||||
}
|
||||
finally {
|
||||
pInstance.setIsProcessing(false);
|
||||
pInstance.saveEx();
|
||||
}
|
||||
}
|
||||
|
||||
if (process.isJavaProcess() && !jasperreport)
|
||||
|
|
Loading…
Reference in New Issue