From f59cdc523b8f632af45cdc7f6bdb62e86987cbff Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Wed, 18 Aug 2010 14:09:39 +0000 Subject: [PATCH] #208 Missing email notification tabs for tickets - now automatically added for any class SVN:trunk[679] --- application/cmdbabstract.class.inc.php | 19 +++++++++++++++++++ dictionaries/dictionary.itop.ui.php | 1 + dictionaries/fr.dictionary.itop.ui.php | 1 + 3 files changed, 21 insertions(+) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 73c4c877d..7c3a7fc21 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -228,6 +228,25 @@ abstract class cmdbAbstractObject extends CMDBObject } } $oPage->SetCurrentTab(''); + + if (!$bEditMode) + { + // Get the actual class of the current object + // And look for triggers referring to it + // If any trigger has been found then display a tab with notifications + // + $sClass = get_class($this); + $oTriggerSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObject AS T WHERE T.target_class = '$sClass'")); + if ($oTriggerSet->Count() > 0) + { + $oPage->SetCurrentTab(Dict::S('UI:NotificationsTab')); + + // Display notifications regarding the object + $iId = $this->GetKey(); + $oNotifSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT EventNotificationEmail AS Ev JOIN TriggerOnObject AS T ON Ev.trigger_id = T.id WHERE T.target_class = '$sClass' AND Ev.object_id = $iId")); + self::DisplaySet($oPage, $oNotifSet); + } + } } function GetBareProperties(WebPage $oPage, $bEditMode = false) diff --git a/dictionaries/dictionary.itop.ui.php b/dictionaries/dictionary.itop.ui.php index 1d558b4dd..bcd928139 100644 --- a/dictionaries/dictionary.itop.ui.php +++ b/dictionaries/dictionary.itop.ui.php @@ -365,6 +365,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:NoObject_Class_ToDisplay' => 'No %1$s to display', 'UI:History:LastModified_On_By' => 'Last modified on %1$s by %2$s.', 'UI:HistoryTab' => 'History', + 'UI:NotificationsTab' => 'Notifications', 'UI:History:Date' => 'Date', 'UI:History:Date+' => 'Date of the change', 'UI:History:User' => 'User', diff --git a/dictionaries/fr.dictionary.itop.ui.php b/dictionaries/fr.dictionary.itop.ui.php index dec3b9e16..68a91b4bf 100644 --- a/dictionaries/fr.dictionary.itop.ui.php +++ b/dictionaries/fr.dictionary.itop.ui.php @@ -366,6 +366,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:NoObject_Class_ToDisplay' => 'Aucun objet %1$s à afficher', 'UI:History:LastModified_On_By' => 'Dernière modification par %2$s le %1$s.', 'UI:HistoryTab' => 'Historique', + 'UI:NotificationsTab' => 'Notifications', 'UI:History:Date' => 'Date', 'UI:History:Date+' => 'Date de modification', 'UI:History:User' => 'Utilisateur',