Impact analysis enhancement:

- Some of the "context" rules are marked as "default=yes"
- Only the "default" context rules are used for the initial display of the impact analysis graph AND are used to compute the impacted items of a ticket.

SVN:trunk[3713]
This commit is contained in:
Denis Flaven
2015-09-03 16:56:44 +00:00
parent 5425f55af7
commit be3bce26ed
6 changed files with 46 additions and 10 deletions

View File

@@ -133,6 +133,7 @@ class _Ticket extends cmdbAbstractObject
public function UpdateImpactedItems()
{
require_once(APPROOT.'core/displayablegraph.class.inc.php');
$oContactsSet = $this->Get('contacts_list');
$oCIsSet = $this->Get('functionalcis_list');
@@ -195,11 +196,24 @@ class _Ticket extends cmdbAbstractObject
}
$oContactsSet = DBObjectSet::FromScratch('lnkContactToTicket');
$oGraph = MetaModel::GetRelatedObjectsDown('impacts', $aSources, 10, true /* bEnableRedundancy */, $aExcluded);
$sContextKey = 'itop-tickets/relation_context/'.get_class($this).'/impacts/down';
$aContextDefs = DisplayableGraph::GetContextDefinitions($sContextKey, true, array('this' => $this));
$aDefaultContexts = array();
foreach($aContextDefs as $sKey => $aDefinition)
{
// Add the default context queries to the computation
if (array_key_exists('default', $aDefinition) && ($aDefinition['default'] == 'yes'))
{
$aDefaultContexts[] = $aDefinition['oql'];
}
}
$oGraph = MetaModel::GetRelatedObjectsDown('impacts', $aSources, 10, true /* bEnableRedundancy */, $aExcluded, $aDefaultContexts);
$oIterator = new RelationTypeIterator($oGraph, 'Node');
foreach ($oIterator as $oNode)
{
if ( ($oNode instanceof RelationObjectNode) && ($oNode->GetProperty('is_reached')) && (!$oNode->GetProperty('source')))
if ( ($oNode instanceof RelationObjectNode) && ($oNode->GetProperty('is_reached')) && (!$oNode->GetProperty('source')) && ($oNode->GetProperty('context_root_causes', null) == null) )
{
$oObj = $oNode->GetProperty('object');
$iKey = $oObj->GetKey();
@@ -237,7 +251,8 @@ class _Ticket extends cmdbAbstractObject
public function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
{
parent::DisplayBareRelations($oPage, $bEditMode);
if (!$bEditMode)
// Display the impact analysis for tickets not in 'closed' or 'resolved' status... and not in edition
if ((!$bEditMode) && (!in_array($this->Get('status'), array('resolved', 'closed'))))
{
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/fraphael.js');
$oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/jquery.contextMenu.css');