[ 1949324 ] Can't trigger workflow before commit

This commit is contained in:
Heng Sin Low 2008-04-23 02:25:43 +00:00
parent 9e5979268e
commit 1315cc4757
4 changed files with 8 additions and 5 deletions

View File

@ -249,9 +249,10 @@ public final class ProcessUtil {
MWorkflow wf = MWorkflow.get (ctx, AD_Workflow_ID); MWorkflow wf = MWorkflow.get (ctx, AD_Workflow_ID);
MWFProcess wfProcess = null; MWFProcess wfProcess = null;
if (pi.isBatch()) if (pi.isBatch())
wfProcess = wf.start(pi, null); // may return null wfProcess = wf.start(pi, pi.getTransactionName()); // may return null
else else {
wfProcess = wf.startWait(pi); // may return null wfProcess = wf.startWait(pi); // may return null
}
log.fine(pi.toString()); log.fine(pi.toString());
return wfProcess; return wfProcess;
} }

View File

@ -371,7 +371,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
*/ */
public PO getPO() public PO getPO()
{ {
return getPO(null); return getPO(get_TrxName() != null ? Trx.get(get_TrxName(), false) : null);
} // getPO } // getPO
/** /**
@ -381,7 +381,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
public int getPO_AD_Client_ID() public int getPO_AD_Client_ID()
{ {
if (m_po == null) if (m_po == null)
getPO(null); getPO(get_TrxName() != null ? Trx.get(get_TrxName(), false) : null);
if (m_po != null) if (m_po != null)
return m_po.getAD_Client_ID(); return m_po.getAD_Client_ID();
return 0; return 0;

View File

@ -710,7 +710,7 @@ public class MWorkflow extends X_AD_Workflow
final int SLEEP = 500; // 1/2 sec final int SLEEP = 500; // 1/2 sec
final int MAXLOOPS = 30; // 15 sec final int MAXLOOPS = 30; // 15 sec
// //
MWFProcess process = start(pi, null); MWFProcess process = start(pi, pi.getTransactionName());
if (process == null) if (process == null)
return null; return null;
Thread.yield(); Thread.yield();

View File

@ -571,6 +571,8 @@ public class ProcessCtl implements Runnable
// Run locally // Run locally
if (!started && !m_IsServerProcess) if (!started && !m_IsServerProcess)
{ {
if (m_trx != null)
m_pi.setTransactionName(m_trx.getTrxName());
MWFProcess wfProcess = ProcessUtil.startWorkFlow(Env.getCtx(), m_pi, AD_Workflow_ID); MWFProcess wfProcess = ProcessUtil.startWorkFlow(Env.getCtx(), m_pi, AD_Workflow_ID);
started = wfProcess != null; started = wfProcess != null;
} }