diff --git a/inc/ticket.class.php b/inc/ticket.class.php index a88bbec1..3313e16c 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -73,9 +73,6 @@ function ($carry, $type) use ($item) { [] ); - // Get updated actors - $actors_update = $item->input['_actors'] ?? []; - // Get deletion rights for each type of actor $deletion_rights = [ User::getType() => [ @@ -93,12 +90,16 @@ function ($carry, $type) use ($item) { ], ]; - // Iteration through actor types and verification of deletion rights - foreach ($ticket_actors as $type => $actors) { - foreach ($actors as $actor) { - // If the actor has been deleted and deletion is forbidden, it is readjusted to simulate a non-deletion - if (empty($deletion_rights[$actor['itemtype']][$type])) { - $item->input['_actors'][$type][] = $actor; + if (!isset($item->input['_actors'])) { + $item->input['_actors'] = $item->fields['_actors']; + } else { + // Iteration through actor types and verification of deletion rights + foreach ($ticket_actors as $type => $actors) { + foreach ($actors as $actor) { + // If the actor has been deleted and deletion is forbidden, it is readjusted to simulate a non-deletion + if ($deletion_rights[$actor['itemtype']][$type] == 0) { + $item->input['_actors'][$type][] = $actor; + } } } }