|
@@ -247,9 +247,37 @@ abstract class Change extends Ticket
|
|
|
|
|
|
protected function OnInsert()
|
|
|
{
|
|
|
+ $oToNotify = $this->Get('contact_list');
|
|
|
+ $oToImpact = $this->Get('ci_list');
|
|
|
+
|
|
|
+ $oImpactedInfras = DBObjectSet::FromLinkSet($this, 'ci_list', 'ci_id');
|
|
|
+
|
|
|
+ $aComputed = $oImpactedInfras->GetRelatedObjects('impacts', 10);
|
|
|
+
|
|
|
+ if (isset($aComputed['FunctionalCI']) && is_array($aComputed['FunctionalCI']))
|
|
|
+ {
|
|
|
+ foreach($aComputed['FunctionalCI'] as $iKey => $oObject)
|
|
|
+ {
|
|
|
+ $oNewLink = new lnkTicketToCI();
|
|
|
+ $oNewLink->Set('ci_id', $iKey);
|
|
|
+ $oToImpact->AddObject($oNewLink);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isset($aComputed['Contact']) && is_array($aComputed['Contact']))
|
|
|
+ {
|
|
|
+ foreach($aComputed['Contact'] as $iKey => $oObject)
|
|
|
+ {
|
|
|
+ $oNewLink = new lnkTicketToContact();
|
|
|
+ $oNewLink->Set('contact_id', $iKey);
|
|
|
+ $oNewLink->Set('role', 'contact automatically computed');
|
|
|
+ $oToNotify->AddObject($oNewLink);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$this->Set('creation_date', time());
|
|
|
$this->Set('last_update', time());
|
|
|
}
|
|
|
+
|
|
|
protected function OnUpdate()
|
|
|
{
|
|
|
$this->Set('last_update', time());
|