Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
new event
  • Loading branch information
Rom1-B committed Mar 24, 2025
commit a8a03bbbf7ba66ebe74c4da4e8793201fa22fee2
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 @@ -147,6 +147,7 @@ public function getEvents()
'pendingreason_add' => __('Pending reason added'),
'pendingreason_del' => __('Pending reason removed'),
'pendingreason_close' => __('Pending reason auto close'),
'del_assign_user' => __('Deletion of a user in assignees'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, we should add a remove_xxx event for all possible actor type (e.g. requester user, requester group, observer user, observer group, assigned user, assigned group and assigned suplier).

If we add this only for assigned users, I am pretty sure that someone will ask for the same feature for another actor type as soon as the feature will be released.

];

asort($events);
Expand Down Expand Up @@ -884,7 +885,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