Skip to content

Commit af9a6f8

Browse files
authored
Fix FormcreatorIssues requester not updated (#3560)
* Fix FormcreatorIssues requester not updated * Fix Lints
1 parent 6069ee6 commit af9a6f8

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

hook.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,18 @@ function plugin_formcreator_hook_add_ticket(CommonDBTM $item) {
443443
]);
444444
}
445445

446+
function plugin_formcreator_hook_update_ticket_actors(CommonITILActor $item) {
447+
if ($item::$itemtype_1 == Ticket::class) {
448+
if ($item->fields['type'] == CommonITILActor::REQUESTER) {
449+
$ticket_id = $item->fields['tickets_id'];
450+
$ticket = new Ticket();
451+
if ($ticket->getFromDB($ticket_id)) {
452+
plugin_formcreator_hook_update_ticket($ticket);
453+
}
454+
}
455+
}
456+
}
457+
446458
function plugin_formcreator_hook_update_ticket(CommonDBTM $item) {
447459
global $DB;
448460

@@ -490,6 +502,7 @@ function plugin_formcreator_hook_update_ticket(CommonDBTM $item) {
490502
'entities_id' => $item->fields['entities_id'],
491503
'is_recursive' => '0',
492504
'requester_id' => $requester,
505+
'users_id_recipient' => $requester,
493506
'comment' => $DB->escape($item->fields['content']),
494507
]);
495508
}

setup.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ function plugin_formcreator_permanent_hook(): void {
281281
$PLUGIN_HOOKS[Hooks::ITEM_ADD]['formcreator'] = [
282282
Ticket::class => 'plugin_formcreator_hook_add_ticket',
283283
ITILFollowup::class => 'plugin_formcreator_hook_update_itilFollowup',
284+
Ticket_User::class => 'plugin_formcreator_hook_update_ticket_actors',
284285
];
285286
$PLUGIN_HOOKS[Hooks::PRE_ITEM_UPDATE]['formcreator'] = [
286287
User::class => 'plugin_formcreator_hook_update_user',
@@ -299,6 +300,7 @@ function plugin_formcreator_permanent_hook(): void {
299300
$PLUGIN_HOOKS[Hooks::ITEM_PURGE]['formcreator'] = [
300301
Ticket::class => 'plugin_formcreator_hook_purge_ticket',
301302
TicketValidation::class => 'plugin_formcreator_hook_purge_ticketvalidation',
303+
Ticket_User::class => 'plugin_formcreator_hook_update_ticket_actors',
302304
];
303305
$PLUGIN_HOOKS[Hooks::PRE_ITEM_PURGE]['formcreator'] = [
304306
PluginFormcreatorTargetTicket::class => 'plugin_formcreator_hook_pre_purge_targetTicket',

0 commit comments

Comments
 (0)