Skip to content

Commit a8a03bb

Browse files
committed
new event
1 parent 05ccd85 commit a8a03bb

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/CommonITILActor.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ public function post_deleteFromDB()
162162
'id' => $this->fields[static::getItilObjectForeignKey()],
163163
'status' => $status
164164
]);
165+
if ($donotif) {
166+
$options = [];
167+
if (isset($this->fields['users_id'])) {
168+
$options = ['_old_user' => $this->fields];
169+
NotificationEvent::raiseEvent('del_assign_user', $item, $options);
170+
}
171+
}
165172
} else {
166173
$item->updateDateMod($this->fields[static::getItilObjectForeignKey()]);
167174

@@ -171,6 +178,7 @@ public function post_deleteFromDB()
171178
$options = ['_old_user' => $this->fields];
172179
}
173180
NotificationEvent::raiseEvent("update", $item, $options);
181+
NotificationEvent::raiseEvent('del_assign_user', $item, $options);
174182
}
175183
}
176184
}

src/NotificationTargetCommonITILObject.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public function getEvents()
147147
'pendingreason_add' => __('Pending reason added'),
148148
'pendingreason_del' => __('Pending reason removed'),
149149
'pendingreason_close' => __('Pending reason auto close'),
150+
'del_assign_user' => __('Deletion of a user in assignees'),
150151
];
151152

152153
asort($events);
@@ -884,7 +885,10 @@ public function addAdditionalTargets($event = '')
884885
return; // Do not propose more targets
885886
}
886887

887-
if ($event == 'update') {
888+
if (
889+
$event == 'update' ||
890+
$event == 'del_assign_user'
891+
) {
888892
$this->addTarget(
889893
Notification::OLD_TECH_IN_CHARGE,
890894
__('Former technician in charge of the ticket')

0 commit comments

Comments
 (0)