You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2024-10-22 12:12:23

redwhale
Member
Registered: 2024-10-22
Posts: 2

[PLUGIN DEV] Notifications are being overwritten in queue

I'm currently developing a plugin for GLPI and I'm implementing the notifications. So far so good, I'm registering correctly the events, I'm raising them whenever I need them to and the notification emails get sent though though they dont leave the queue (as intended), the problem comes when I raise the same event 2 times, which should create 2 different notifications/emails but what happens is: the first notification gets overwritten by the second one in the notification queue.

Help is much appreciated, I searched the forum before posting but didn't find anything.

Note: "Prestamo" means "Loan" in english
NotificationTargetPrestamo

<?php
namespace GlpiPlugin\Prestamo;
use NotificationTarget;

if (!defined('GLPI_ROOT')) {
   die("Sorry. You can't access directly to this file");
}

// Class NotificationTarget
class NotificationTargetPrestamo extends NotificationTarget {

   function getEvents() {
      return  [
         'testprestamonotification' => __('TestNoti NotificationTargetPrestamo.php', 'prestamo'),
         'loan_upadate' => __('Actualizar NotificationTargetPrestamo.php', 'prestamo'),
         'prestamoTest2' => __('prestamoTest2 NotificationTargetPrestamo.php', 'prestamo'),
         'prestamocreado' => __('prestamocreado NotificationTargetPrestamo.php', 'prestamo'),
      ];
   }

//more code...
?>

Offline

#2 2024-10-22 14:02:16

redwhale
Member
Registered: 2024-10-22
Posts: 2

Re: [PLUGIN DEV] Notifications are being overwritten in queue

I solved it!

I just had to set the variable $deduplicate_queued_notifications to false in my Prestamo class which was extending from CommonDBTM.

Offline

Board footer

Powered by FluxBB