From a53ab5c56d4d1d0ad970f0cbf1cfef3844872dba Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Wed, 25 Mar 2026 09:50:54 +0100 Subject: [PATCH 1/2] Fix(notification): fix missing attachment --- CHANGELOG.md | 1 + inc/notificationevent.class.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1baa7570..70de7307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix GLIP Stat injection - Fix missing icon - Fix missing categories in `reportSunburstTicketByCategories` chart. +- Fix missing attachment from notification ## [1.9.3] - 2026-01-08 diff --git a/inc/notificationevent.class.php b/inc/notificationevent.class.php index 47611848..eb6d49d1 100644 --- a/inc/notificationevent.class.php +++ b/inc/notificationevent.class.php @@ -75,7 +75,7 @@ class PluginMreportingNotificationEvent extends NotificationEvent * @param array $options options used * @param string $label used for debugEvent() (default '') **/ - public static function raiseEvent($event, $item, $options = [], ?CommonDBTM $trigger = null, $label = '') + public static function raiseEvent($event, $item, $options = [], $label = '') { /** @var array $CFG_GLPI */ global $CFG_GLPI; @@ -87,7 +87,7 @@ public static function raiseEvent($event, $item, $options = [], ?CommonDBTM $tri $options['entities_id'] = 0; //New code $notificationtarget = NotificationTarget::getInstance($item, $event, $options); - if (!$notificationtarget) { + if (!$notificationtarget || !($notificationtarget instanceof PluginMreportingNotificationTargetNotification)) { return false; } @@ -106,6 +106,7 @@ public static function raiseEvent($event, $item, $options = [], ?CommonDBTM $tri $notificationtarget->setMode($data['mode']); $notificationtarget->setEvent($eventClass); $notificationtarget->clearAddressesList(); + $notificationtarget->addDataForTemplate($event, $options); //Process more infos (for example for tickets) $notificationtarget->addAdditionnalInfosForTarget(); @@ -152,7 +153,7 @@ public static function raiseEvent($event, $item, $options = [], ?CommonDBTM $tri $users_infos, $options, ), - [], + $notificationtarget->additionalData, ); } else { $notificationtarget->getFromDB($target['id']); From 49da592f0a9559a1eddbda9ab21ad7fcc3de2bb5 Mon Sep 17 00:00:00 2001 From: Stanislas Date: Tue, 5 May 2026 14:47:59 +0200 Subject: [PATCH 2/2] Update inc/notificationevent.class.php Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com> --- inc/notificationevent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/notificationevent.class.php b/inc/notificationevent.class.php index eb6d49d1..9e507639 100644 --- a/inc/notificationevent.class.php +++ b/inc/notificationevent.class.php @@ -75,7 +75,7 @@ class PluginMreportingNotificationEvent extends NotificationEvent * @param array $options options used * @param string $label used for debugEvent() (default '') **/ - public static function raiseEvent($event, $item, $options = [], $label = '') + public static function raiseEvent($event, $item, $options = [], ?CommonDBTM $trigger = null, $label = '') { /** @var array $CFG_GLPI */ global $CFG_GLPI;