Notification were not working well with class hierarchy (not in Trac at that time)

SVN:trunk[734]
This commit is contained in:
Romain Quetiez
2010-08-31 21:11:11 +00:00
parent 1f6473947c
commit 77159e8766
4 changed files with 41 additions and 7 deletions

View File

@@ -238,14 +238,15 @@ abstract class cmdbAbstractObject extends CMDBObject
// 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'"));
$sClassList = implode("', '", MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
$oTriggerSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObject AS T WHERE T.target_class IN ('$sClassList')"));
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"));
$oNotifSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT EventNotificationEmail AS Ev JOIN TriggerOnObject AS T ON Ev.trigger_id = T.id WHERE T.target_class IN ('$sClassList') AND Ev.object_id = $iId"));
self::DisplaySet($oPage, $oNotifSet);
}
}