From ef8f919e297024600f4d08d43f65f2ac3b5793a6 Mon Sep 17 00:00:00 2001 From: stonebuzz Date: Wed, 4 Sep 2024 11:18:34 +0200 Subject: [PATCH] Fix(Core): take care of mandatory field fix CS --- front/ticket.form.php | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/front/ticket.form.php b/front/ticket.form.php index c144c55d..5c676833 100644 --- a/front/ticket.form.php +++ b/front/ticket.form.php @@ -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( - '

' . sprintf(__('Escalation to the group %s.', 'escalade'), Sanitizer::unsanitize($group->getName())) . '


' - ) . $_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( + '

' . sprintf(__('Escalation to the group %s.', 'escalade'), Sanitizer::unsanitize($group->getName())) . '


' + ) . $_POST['comment'] + ]); + } } }