mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 18:18:46 +02:00
Model factory: introduced a new variation of attribute _delta: delete_if_exists. Use this flag to delete a branch from the data model being hacked, without caring if it is already deleted (or non existing). This eases the burden of coping with different installation combinations.
SVN:trunk[4306]
This commit is contained in:
@@ -490,7 +490,17 @@ class ModelFactory
|
||||
$oTargetParentNode->RedefineChildNode($oTargetNode, $sSearchId);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
case 'delete_if_exists':
|
||||
$oTargetNode = $oTargetParentNode->_FindChildNode($oSourceNode);
|
||||
if (($oTargetNode !== null) && ($oTargetNode->getAttribute('_alteration') !== 'removed'))
|
||||
{
|
||||
// Delete the node if it actually exists and is not already marked as deleted
|
||||
$oTargetNode->Delete();
|
||||
}
|
||||
// otherwise fail silently
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$oTargetNode = $oTargetParentNode->_FindChildNode($oSourceNode);
|
||||
if ($oTargetNode == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user