Skip to content

Commit

Permalink
Fix(Notification): better fix for double notification
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebuzz committed Dec 26, 2024
1 parent 6f52b11 commit 5b8a10c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
16 changes: 9 additions & 7 deletions front/ticket.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,17 @@
if ($_SESSION['plugins']['escalade']['config']['ticket_last_status'] != -1) {
$_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,

$ticket_group = new Group_Ticket();
$ticket_group->add([
'tickets_id' => $tickets_id,
'groups_id' => $group_id,
'type' => CommonITILActor::ASSIGN,
'_disablenotif' => true,
'_plugin_escalade_no_history' => true,
]);


$task = new TicketTask();
$task->add([
'tickets_id' => $tickets_id,
Expand Down
12 changes: 12 additions & 0 deletions inc/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/

use Glpi\Application\View\TemplateRenderer;
use Glpi\Toolbox\Sanitizer;

if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access directly to this file");
Expand Down Expand Up @@ -404,6 +405,17 @@ public static function processAfterAddGroup(CommonDBTM $item)
if ($_SESSION['plugins']['escalade']['config']['remove_group'] == true) {
self::removeAssignGroups($tickets_id, $groups_id);
}

//notified only the last group assigned
$ticket = new Ticket();
$ticket->getFromDB($tickets_id);

$group = new Group();
$group->getFromDB($groups_id);

$event = "assign_group";
NotificationEvent::raiseEvent($event, $ticket);

}


Expand Down

0 comments on commit 5b8a10c

Please sign in to comment.