Avoid scalar values in OQL, replace them with variables

This commit is contained in:
Eric
2019-01-02 16:14:58 +01:00
parent 6c9850b8f6
commit a9bd5a8bb0
4 changed files with 22 additions and 19 deletions

View File

@@ -671,14 +671,14 @@ EOF
if (count($aTriggers) > 0)
{
$iId = $this->GetKey();
$sTriggersList = implode(',', $aTriggers);
$aParams = array('triggers' => $aTriggers, 'id' => $iId);
$aNotifSearches = array();
$iNotifsCount = 0;
$aNotificationClasses = MetaModel::EnumChildClasses('EventNotification', ENUM_CHILD_CLASSES_EXCLUDETOP);
foreach($aNotificationClasses as $sNotifClass)
{
$aNotifSearches[$sNotifClass] = DBObjectSearch::FromOQL("SELECT $sNotifClass AS Ev JOIN Trigger AS T ON Ev.trigger_id = T.id WHERE T.id IN ($sTriggersList) AND Ev.object_id = $iId");
$oNotifSet = new DBObjectSet($aNotifSearches[$sNotifClass]);
$aNotifSearches[$sNotifClass] = DBObjectSearch::FromOQL("SELECT $sNotifClass AS Ev JOIN Trigger AS T ON Ev.trigger_id = T.id WHERE T.id IN (:triggers) AND Ev.object_id = :id");
$oNotifSet = new DBObjectSet($aNotifSearches[$sNotifClass], array(), $aParams);
$iNotifsCount += $oNotifSet->Count();
}
// Display notifications regarding the object: on block per subclass to have the intersting columns