Skip to content

Commit

Permalink
Fix(Core): take care of mandatory field (#240)
Browse files Browse the repository at this point in the history
* Fix(Core): take care of mandatory field

fix CS

* adapt changelog

* fix changelog
  • Loading branch information
stonebuzz authored Dec 26, 2024
1 parent 6f52b11 commit 923dd4f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- Redirect users without ticket rights after escalation.
- Fix private task added when ticket mandatory fields are not filled

## [2.9.10] - 2024-11-27

Expand Down
40 changes: 22 additions & 18 deletions front/ticket.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,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']
]);
}
}

$track = new Ticket();
Expand Down

0 comments on commit 923dd4f

Please sign in to comment.