Skip to content

Commit

Permalink
Fix(Core): take care of mandatory field
Browse files Browse the repository at this point in the history
fix CS
  • Loading branch information
stonebuzz committed Sep 4, 2024
1 parent 2d6e8ce commit ef8f919
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions front/ticket.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,28 @@
$_form_object['status'] = $_SESSION['plugins']['escalade']['config']['ticket_last_status'];
}
$updates_ticket = new Ticket();
$updates_ticket->update($_POST['ticket_details'] + [
'_actors' => PluginEscaladeTicket::getTicketFieldsWithActors($tickets_id, $group_id),
'_plugin_escalade_no_history' => true, // Prevent a duplicated task to be added
'actortype' => CommonITILActor::ASSIGN,
'groups_id' => $group_id,
'_form_object' => $_form_object,
]);

$task = new TicketTask();
$task->add([
'tickets_id' => $tickets_id,
'is_private' => true,
'state' => Planning::INFO,
// Sanitize before merging with $_POST['comment'] which is already sanitized
'content' => Sanitizer::sanitize(
'<p><i>' . sprintf(__('Escalation to the group %s.', 'escalade'), Sanitizer::unsanitize($group->getName())) . '</i></p><hr />'
) . $_POST['comment']
]);
if (
$updates_ticket->update(
$_POST['ticket_details'] + [
'_actors' => PluginEscaladeTicket::getTicketFieldsWithActors($tickets_id, $group_id),
'_plugin_escalade_no_history' => true, // Prevent a duplicated task to be added
'actortype' => CommonITILActor::ASSIGN,
'groups_id' => $group_id,
'_form_object' => $_form_object,
]
)
) {
$task = new TicketTask();
$task->add([
'tickets_id' => $tickets_id,
'is_private' => true,
'state' => Planning::INFO,
// Sanitize before merging with $_POST['comment'] which is already sanitized
'content' => Sanitizer::sanitize(
'<p><i>' . sprintf(__('Escalation to the group %s.', 'escalade'), Sanitizer::unsanitize($group->getName())) . '</i></p><hr />'
) . $_POST['comment']
]);
}
}
}

Expand Down

0 comments on commit ef8f919

Please sign in to comment.