diff --git a/setup/modelfactory.class.inc.php b/setup/modelfactory.class.inc.php index 2dfc095e4..b7874b2ec 100644 --- a/setup/modelfactory.class.inc.php +++ b/setup/modelfactory.class.inc.php @@ -479,6 +479,15 @@ class ModelFactory } } + $oAlteredNodes = $oXPath->query('/itop_design//*[@_delta]'); + if ($oAlteredNodes->length > 0) + { + foreach($oAlteredNodes as $oAlteredNode) + { + $oAlteredNode->SetAttribute('_altered_in', $sModuleName); + } + } + $oFormat = new iTopDesignFormat($oDocument); if (!$oFormat->Convert()) { @@ -1592,7 +1601,24 @@ class MFElement extends DOMElement return false; } - + /** + * Check if the given node is (a child of a node) altered by one of the supplied modules + * @param array $aModules The list of module codes to consider + * @return boolean + */ + public function IsAlteredByModule($aModules) + { + // Iterate through the parents: reset the flag if any of them has a flag set + for($oParent = $this ; $oParent instanceof MFElement ; $oParent = $oParent->parentNode) + { + if (in_array($oParent->getAttribute('_altered_in'), $aModules)) + { + return true; + } + } + return false; + } + static $aTraceAttributes = null; /** * Enable/disable the trace on changed nodes @@ -2012,6 +2038,7 @@ class MFDocument extends DOMDocument } return $oElement; } + /** * For debugging purposes */