/** * Process Filter for regular fields * * Notice: PA Processes module have not associated one only record as other modules in SugarCRM, current FilterApi is designed * to handle operations over those records. This method is trying to create a little copy to haandle queries through API for PA * but still needs a lot of work. * @param $field * @param $expression * @param SugarQuery_Builder_Where $where */ public static function addFieldFilter($field, $expression, SugarQuery_Builder_Where $where) { list($operator, $value) = self::getExpression($expression); switch ($operator) { case '$equals': $where->equals($field, $value); break; case '$not_equals': $where->notEquals($field, $value); break; case '$in': $where->in($field, $value); break; case '$not_in': $where->notIn($field, $value); break; case '$dateRange': $where->dateRange($field, $value); break; case '$starts': //Dirty hack to allow quicksearch filtering by activity name (process name) if ($field === 'act_name') { $sql = "activity.name LIKE '" . $value . "%'"; $where->queryOr()->addRaw($sql); } else { $where->starts($field, $value); } break; } }