BF [ 2440281 ] MWorkflow.afterSave should check success flag

https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2440281&group_id=176962
This commit is contained in:
teo_sarca 2008-12-17 14:12:40 +00:00
parent cd267a3155
commit f6e8a3df80
1 changed files with 13 additions and 7 deletions

View File

@ -618,23 +618,29 @@ public class MWorkflow extends X_AD_Workflow
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
log.fine("Success=" + success); log.fine("Success=" + success);
if (success && newRecord) if (!success)
{
return false;
}
if (newRecord)
{ {
// save all nodes -- Creating new Workflow // save all nodes -- Creating new Workflow
MWFNode[] nodes = getNodesInOrder(0); MWFNode[] nodes = getNodesInOrder(0);
for (int i = 0; i < nodes.length; i++) for (int i = 0; i < nodes.length; i++)
nodes[i].save(get_TrxName()); {
nodes[i].saveEx(get_TrxName());
}
} }
if (newRecord) if (newRecord)
{ {
int AD_Role_ID = Env.getAD_Role_ID(getCtx()); int AD_Role_ID = Env.getAD_Role_ID(getCtx());
MWorkflowAccess wa = new MWorkflowAccess(this, AD_Role_ID); MWorkflowAccess wa = new MWorkflowAccess(this, AD_Role_ID);
wa.save(); wa.saveEx();
} }
// Menu/Workflow // Menu/Workflow
else if (is_ValueChanged("IsActive") || is_ValueChanged("Name") else if (is_ValueChanged("IsActive") || is_ValueChanged(COLUMNNAME_Name)
|| is_ValueChanged("Description") || is_ValueChanged("Help")) || is_ValueChanged(COLUMNNAME_Description) || is_ValueChanged(COLUMNNAME_Help))
{ {
MMenu[] menues = MMenu.get(getCtx(), "AD_Workflow_ID=" + getAD_Workflow_ID(), get_TrxName()); MMenu[] menues = MMenu.get(getCtx(), "AD_Workflow_ID=" + getAD_Workflow_ID(), get_TrxName());
for (int i = 0; i < menues.length; i++) for (int i = 0; i < menues.length; i++)
@ -642,7 +648,7 @@ public class MWorkflow extends X_AD_Workflow
menues[i].setIsActive(isActive()); menues[i].setIsActive(isActive());
menues[i].setName(getName()); menues[i].setName(getName());
menues[i].setDescription(getDescription()); menues[i].setDescription(getDescription());
menues[i].save(); menues[i].saveEx();
} }
X_AD_WF_Node[] nodes = MWindow.getWFNodes(getCtx(), "AD_Workflow_ID=" + getAD_Workflow_ID(), get_TrxName()); X_AD_WF_Node[] nodes = MWindow.getWFNodes(getCtx(), "AD_Workflow_ID=" + getAD_Workflow_ID(), get_TrxName());
for (int i = 0; i < nodes.length; i++) for (int i = 0; i < nodes.length; i++)
@ -661,7 +667,7 @@ public class MWorkflow extends X_AD_Workflow
changed = true; changed = true;
} }
if (changed) if (changed)
nodes[i].save(); nodes[i].saveEx();
} }
} }