diff --git a/core/ormstopwatch.class.inc.php b/core/ormstopwatch.class.inc.php index 53184459f..109afaae8 100644 --- a/core/ormstopwatch.class.inc.php +++ b/core/ormstopwatch.class.inc.php @@ -525,10 +525,10 @@ class CheckStopWatchThresholds implements iBackgroundProcess $iPercent = $aThresholdData['percent']; // could be different than the index ! $sNow = date(AttributeDateTime::GetSQLFormat()); - $sExpression = "SELECT $sClass WHERE {$sAttCode}_laststart AND {$sAttCode}_{$iThreshold}_triggered = 0 AND {$sAttCode}_{$iThreshold}_deadline < '$sNow'"; + $sExpression = "SELECT $sClass WHERE {$sAttCode}_laststart AND {$sAttCode}_{$iThreshold}_triggered = 0 AND {$sAttCode}_{$iThreshold}_deadline < :now"; $oFilter = DBObjectSearch::FromOQL($sExpression); - $oSet = new DBObjectSet($oFilter); - $oSet->OptimizeColumnLoad(array($sAttCode)); + $oSet = new DBObjectSet($oFilter, array(), array('now' => $sNow)); + $oSet->OptimizeColumnLoad(array($sClass => array($sAttCode))); while ((time() < $iTimeLimit) && ($oObj = $oSet->Fetch())) { $sClass = get_class($oObj);