Skip to content

Commit

Permalink
new event
Browse files Browse the repository at this point in the history
  • Loading branch information
Rom1-B committed Sep 10, 2024
1 parent 8fc0d67 commit a724df0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/CommonITILActor.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ public function post_deleteFromDB()
'id' => $this->fields[static::getItilObjectForeignKey()],
'status' => $status
]);
if ($donotif) {
$options = [];
if (isset($this->fields['users_id'])) {
$options = ['_old_user' => $this->fields];
NotificationEvent::raiseEvent('del_assign_user', $item, $options);
}
}
} else {
$item->updateDateMod($this->fields[static::getItilObjectForeignKey()]);

Expand All @@ -171,6 +178,7 @@ public function post_deleteFromDB()
$options = ['_old_user' => $this->fields];
}
NotificationEvent::raiseEvent("update", $item, $options);
NotificationEvent::raiseEvent('del_assign_user', $item, $options);
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/NotificationTargetCommonITILObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function getEvents()
'user_mention' => __('User mentioned'),
'auto_reminder' => ITILReminder::getTypeName(1),
'add_document' => __('New document'),
'del_assign_user' => __('Deletion of a user in assignees'),
];

asort($events);
Expand Down Expand Up @@ -881,7 +882,10 @@ public function addAdditionalTargets($event = '')
return; // Do not propose more targets
}

if ($event == 'update') {
if (
$event == 'update' ||
$event == 'del_assign_user'
) {
$this->addTarget(
Notification::OLD_TECH_IN_CHARGE,
__('Former technician in charge of the ticket')
Expand Down

0 comments on commit a724df0

Please sign in to comment.