Skip to content

Commit

Permalink
feat(targetticket): compatibility with GLPI 9.4
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Dec 18, 2018
1 parent c08e299 commit 6afe5fe
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions inc/targetticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1368,13 +1368,27 @@ public function save(PluginFormcreatorFormAnswer $formanswer) {
$use_mailing = PluginFormcreatorCommon::isNotificationEnabled();
PluginFormcreatorCommon::setNotification(false);

$ticketFollowup = new TicketFollowup();
$ticketFollowup->add([
'tickets_id' => $ticketID,
'date' => $_SESSION['glpi_currenttime'],
'users_id' => $_SESSION['glpiID'],
'content' => $message
]);
$followUpInput = [
'date' => $_SESSION['glpi_currenttime'],
'users_id' => Session::getLoginUserID(),
'content' => $message,
];
if (class_exists(ITILFollowup::class)) {
// GLPI 9.4+
$followUpInput += [
'items_id' => $ticketID,
'itemtype' => Ticket::class,
];
$ticketFollowup = new ITILFollowup();
$ticketFollowup->add($followUpInput);
} else {
// GLPI < 9.4
$followUpInput += [
'tickets_id' => $ticketID,
];
$ticketFollowup = new TicketFollowup();
$ticketFollowup->add($followUpInput);
}

// Restore mail notification setting
PluginFormcreatorCommon::setNotification($use_mailing);
Expand Down

0 comments on commit 6afe5fe

Please sign in to comment.