Deactivating a node could impact proceeding
Description
Environment
None
Attachments
2
is duplicated by
relates to
Activity
Show:
Nicolas Micoud March 14, 2013 at 2:26 PM
Hi,
I did not manage to create a patch so i copy/paste the MWFNode.getTransition method, as we discussed yesterday :
public MWFNodeNext[] getTransitions(int AD_Client_ID)
{
ArrayList<MWFNodeNext> list = new ArrayList<MWFNodeNext>();
for (int i = 0; i < m_next.size(); i++)
{
MWFNodeNext next = m_next.get;
MWFNode nodeOnNext = new MWFNode(Env.getCtx(), next.getAD_WF_Next_ID(), get_TrxName()); // IDEMPIERE 731 check that the selected node on transition is active
if (nodeOnNext.isActive() && (next.getAD_Client_ID() == 0 || next.getAD_Client_ID() == AD_Client_ID))
list.add(next);
}
MWFNodeNext[] retValue = new MWFNodeNext [list.size()];
list.toArray(retValue);
return retValue;
} // getNextNodes
Regards,
Nicolas
Steps to reproduce :
Log in System and goto workflow window.
Select Process Bank Statement (for instance) and deactivate "DocPrepare" node.
It has no impact (the node is still used in Start node transition).
Now, complete a bank statement. It will fail. Have a look into the log and you'll see :
MWFActivity.run: MWFNode[240-(Start),Action=Sleep:WaitTime=0] [132]
java.lang.NullPointerException
at org.compiere.wf.MWorkflow.addNodesSF(MWorkflow.java:433)
at org.compiere.wf.MWorkflow.getNodesInOrder(MWorkflow.java:356)
Seems that m_nodes loads only all actives nodes of the workflow (which seems correct).
When you use the getNode (int AD_WF_Node_ID) method, if it doesn't found the corresponding node, it will return null.
Here what should be done :
1 - When deactivating a node, deactivate also the transitions where it is used.
2 - Modify MWorkflow.getTransitions (int AD_Client_ID) so that it will add the node to the list only if it is activated.
WDYT ?
Regards,
Nicolas