Skip to content

Commit 923dd4f

Browse files
authored
Fix(Core): take care of mandatory field (#240)
* Fix(Core): take care of mandatory field fix CS * adapt changelog * fix changelog
1 parent 6f52b11 commit 923dd4f

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Fixed
1111

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

1415
## [2.9.10] - 2024-11-27
1516

front/ticket.form.php

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,28 @@
7070
$_form_object['status'] = $_SESSION['plugins']['escalade']['config']['ticket_last_status'];
7171
}
7272
$updates_ticket = new Ticket();
73-
$updates_ticket->update($_POST['ticket_details'] + [
74-
'_actors' => PluginEscaladeTicket::getTicketFieldsWithActors($tickets_id, $group_id),
75-
'_plugin_escalade_no_history' => true, // Prevent a duplicated task to be added
76-
'actortype' => CommonITILActor::ASSIGN,
77-
'groups_id' => $group_id,
78-
'_form_object' => $_form_object,
79-
]);
80-
81-
$task = new TicketTask();
82-
$task->add([
83-
'tickets_id' => $tickets_id,
84-
'is_private' => true,
85-
'state' => Planning::INFO,
86-
// Sanitize before merging with $_POST['comment'] which is already sanitized
87-
'content' => Sanitizer::sanitize(
88-
'<p><i>' . sprintf(__('Escalation to the group %s.', 'escalade'), Sanitizer::unsanitize($group->getName())) . '</i></p><hr />'
89-
) . $_POST['comment']
90-
]);
73+
if (
74+
$updates_ticket->update(
75+
$_POST['ticket_details'] + [
76+
'_actors' => PluginEscaladeTicket::getTicketFieldsWithActors($tickets_id, $group_id),
77+
'_plugin_escalade_no_history' => true, // Prevent a duplicated task to be added
78+
'actortype' => CommonITILActor::ASSIGN,
79+
'groups_id' => $group_id,
80+
'_form_object' => $_form_object,
81+
]
82+
)
83+
) {
84+
$task = new TicketTask();
85+
$task->add([
86+
'tickets_id' => $tickets_id,
87+
'is_private' => true,
88+
'state' => Planning::INFO,
89+
// Sanitize before merging with $_POST['comment'] which is already sanitized
90+
'content' => Sanitizer::sanitize(
91+
'<p><i>' . sprintf(__('Escalation to the group %s.', 'escalade'), Sanitizer::unsanitize($group->getName())) . '</i></p><hr />'
92+
) . $_POST['comment']
93+
]);
94+
}
9195
}
9296

9397
$track = new Ticket();

0 commit comments

Comments
 (0)