N°2875 - Fix error when trigger has an OQL on a root class which is not abstract

This commit is contained in:
Molkobain
2021-11-08 19:21:43 +01:00
parent ab40c67678
commit 4c69865480

View File

@@ -611,8 +611,17 @@ class TriggerOnObjectMention extends TriggerOnObject
if (strlen($sFilter) > 0)
{
$oSearch = DBObjectSearch::FromOQL($sFilter);
$sSearchClass = $oSearch->GetClass();
// If filter not on current object class (or descendants), consider it as not in scope
if (is_a($oObject, $sSearchClass, true) === false) {
return false;
}
$oSearch->AddCondition('id', $oObject->GetKey(), '=');
$oSearch->AddCondition('finalclass', get_class($oObject), '=');
if (MetaModel::IsAbstract($oSearch->GetClass())) {
$oSearch->AddCondition('finalclass', get_class($oObject), '=');
}
$aParams = $oObject->ToArgs('this');
$oSet = new DBObjectSet($oSearch, [], $aParams);