diff --git a/core/displayablegraph.class.inc.php b/core/displayablegraph.class.inc.php
index 27021266e..36ad229a9 100644
--- a/core/displayablegraph.class.inc.php
+++ b/core/displayablegraph.class.inc.php
@@ -999,7 +999,7 @@ class DisplayableGraph extends SimpleGraph
*/
function GetAsJSON($sContextKey)
{
- $aContextDefs = $this->GetContextDefinitions($sContextKey, false);
+ $aContextDefs = static::GetContextDefinitions($sContextKey, false);
$aData = array('nodes' => array(), 'edges' => array(), 'groups' => array());
$iGroupIdx = 0;
@@ -1055,7 +1055,7 @@ class DisplayableGraph extends SimpleGraph
*/
function RenderAsPDF(PDFPage $oPage, $sComments = '', $sContextKey, $xMin = -1, $xMax = -1, $yMin = -1, $yMax = -1)
{
- $aContextDefs = $this->GetContextDefinitions($sContextKey, false); // No need to develop the parameters
+ $aContextDefs = static::GetContextDefinitions($sContextKey, false); // No need to develop the parameters
$oPdf = $oPage->get_tcpdf();
$aBB = $this->GetBoundingBox();
@@ -1219,7 +1219,7 @@ class DisplayableGraph extends SimpleGraph
* @param array $aContextParams Arguments for the queries (via ToArgs()) if $bDevelopParams == true
* @return multitype:multitype:string
*/
- public function GetContextDefinitions($sContextKey, $bDevelopParams = true, $aContextParams = array())
+ public static function GetContextDefinitions($sContextKey, $bDevelopParams = true, $aContextParams = array())
{
$aLevels = explode('/', $sContextKey);
$sLeafClass = $aLevels[2];
@@ -1246,6 +1246,7 @@ class DisplayableGraph extends SimpleGraph
}
catch(Exception $e)
{
+ IssueLog::Warning('Invalid OQL query: '.$sOQL.' in the parameter '.$sContextKey);
unset($aContextDefs[$sKey]);
}
}
@@ -1262,7 +1263,7 @@ class DisplayableGraph extends SimpleGraph
*/
function Display(WebPage $oP, $aResults, $sRelation, ApplicationContext $oAppContext, $aExcludedObjects = array(), $sObjClass = null, $iObjKey = null, $sContextKey, $aContextParams = array())
{
- $aContextDefs = $this->GetContextDefinitions($sContextKey, true, $aContextParams);
+ $aContextDefs = static::GetContextDefinitions($sContextKey, true, $aContextParams);
$aExcludedByClass = array();
foreach($aExcludedObjects as $oObj)
{
@@ -1310,7 +1311,7 @@ EOF
$aAdditionalContexts = array();
foreach($aContextDefs as $sKey => $aDefinition)
{
- $aAdditionalContexts[] = array('key' => $sKey, 'label' => Dict::S($aDefinition['dict']), 'oql' => $aDefinition['oql']);
+ $aAdditionalContexts[] = array('key' => $sKey, 'label' => Dict::S($aDefinition['dict']), 'oql' => $aDefinition['oql'], 'default' => (array_key_exists('default', $aDefinition) && ($aDefinition['default'] == 'yes')));
}
$sDirection = utils::ReadParam('d', 'horizontal');
diff --git a/datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml b/datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml
index 2cd834038..4f6830f9d 100755
--- a/datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml
+++ b/datamodels/2.x/itop-change-mgmt/datamodel.itop-change-mgmt.xml
@@ -828,11 +828,13 @@
id)]]>
Tickets:Related:OpenChanges
itop-change-mgmt/images/change-ongoing.png
+ yes
-
id) AND (DATE_ADD(C.end_date, INTERVAL 3 DAY) < NOW())]]>
Tickets:Related:RecentChanges
itop-change-mgmt/images/change-done.png
+ no
@@ -846,11 +848,13 @@
id)]]>
Tickets:Related:OpenChanges
itop-change-mgmt/images/change-ongoing.png
+ yes
-
id) AND (DATE_ADD(C.end_date, INTERVAL 3 DAY) < NOW())]]>
Tickets:Related:RecentChanges
itop-change-mgmt/images/change-done.png
+ no
@@ -864,11 +868,13 @@
id)]]>
Tickets:Related:OpenChanges
itop-change-mgmt/images/change-ongoing.png
+ yes
-
id) AND (DATE_ADD(C.end_date, INTERVAL 3 DAY) < NOW())]]>
Tickets:Related:RecentChanges
itop-change-mgmt/images/change-done.png
+ no
@@ -886,11 +892,13 @@
Tickets:Related:OpenChanges
itop-change-mgmt/images/change-ongoing.png
+ yes
-
Tickets:Related:RecentChanges
itop-change-mgmt/images/change-done.png
+ no
@@ -900,11 +908,13 @@
Tickets:Related:OpenChanges
itop-change-mgmt/images/change-ongoing.png
+ yes
-
Tickets:Related:RecentChanges
itop-change-mgmt/images/change-done.png
+ no
diff --git a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml
index 48ec2565e..518c8167d 100755
--- a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml
+++ b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml
@@ -1755,6 +1755,7 @@
id)]]>
Tickets:Related:OpenIncidents
itop-incident-mgmt-itil/images/incident-red.png
+ yes
@@ -1768,6 +1769,7 @@
id)]]>
Tickets:Related:OpenIncidents
itop-incident-mgmt-itil/images/incident-red.png
+ yes
@@ -1781,6 +1783,7 @@
id)]]>
Tickets:Related:OpenIncidents
itop-incident-mgmt-itil/images/incident-red.png
+ yes
@@ -1798,6 +1801,7 @@
Tickets:Related:OpenIncidents
itop-incident-mgmt-itil/images/incident-red.png
+ yes
@@ -1807,6 +1811,7 @@
Tickets:Related:OpenIncidents
itop-incident-mgmt-itil/images/incident-red.png
+ yes
diff --git a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml
index aad41ac3a..9916b3c6d 100755
--- a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml
+++ b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml
@@ -1855,7 +1855,8 @@
id)]]>
Tickets:Related:OpenIncidents
itop-request-mgmt/images/incident-red.png
-
+ yes
+
@@ -1868,6 +1869,7 @@
id)]]>
Tickets:Related:OpenIncidents
itop-request-mgmt/images/incident-red.png
+ yes
@@ -1885,6 +1887,7 @@
Tickets:Related:OpenIncidents
itop-request-mgmt/images/incident-red.png
+ yes
@@ -1894,6 +1897,7 @@
Tickets:Related:OpenIncidents
itop-request-mgmt/images/incident-red.png
+ yes
diff --git a/datamodels/2.x/itop-tickets/main.itop-tickets.php b/datamodels/2.x/itop-tickets/main.itop-tickets.php
index 9cd0fb949..c400be957 100755
--- a/datamodels/2.x/itop-tickets/main.itop-tickets.php
+++ b/datamodels/2.x/itop-tickets/main.itop-tickets.php
@@ -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');
diff --git a/js/simple_graph.js b/js/simple_graph.js
index 69bb9a594..daf8beab1 100644
--- a/js/simple_graph.js
+++ b/js/simple_graph.js
@@ -445,7 +445,8 @@ $(function()
sHtml += ' '+this.options.labels.additional_context_info+' '
}