From 6e4e5be35d7bb0036fea877da8c54a667c6a354e Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Thu, 25 Aug 2011 08:03:39 +0000 Subject: [PATCH] Allow TriggerOnPortalUpdate to work also on derived classes: i.e a trigger defined for the class 'Ticket' will be called when a 'UserRequest' (derived from Ticket) will be updated from the portal. SVN:trunk[1509] --- portal/index.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/portal/index.php b/portal/index.php index cbe58a948..d1baaf899 100644 --- a/portal/index.php +++ b/portal/index.php @@ -977,7 +977,9 @@ function AddComment($oP, $id) $oP->p("

".Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($oRequest)), $oRequest->GetName())."

\n"); // If there is any trigger for the Portal Update, then activate them - $sOQL = "SELECT TriggerOnPortalUpdate WHERE target_class ='UserRequest'"; + $aClasses = MetaModel::EnumParentClasses(get_class($oRequest), ENUM_PARENT_CLASSES_ALL); + $aClasses = CMDBSource::Quote($aClasses); + $sOQL = "SELECT TriggerOnPortalUpdate WHERE target_class IN (".implode(',', $aClasses).")"; $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL)); while($oTrigger = $oSet->Fetch()) {