コード例 #1
0
 /**
  * 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;
     }
 }
コード例 #2
0
ファイル: FilterApi.php プロジェクト: jglaine/sugar761-ent
 /**
  * This function adds a creator filter to the sugar query
  *
  * @param SugarQuery $q The whole SugarQuery object
  * @param SugarQuery_Builder_Where $where The Where part of the SugarQuery object
  * @param string $link Which module are you adding the owner filter to.
  */
 protected static function addCreatorFilter(SugarQuery $q, SugarQuery_Builder_Where $where, $link)
 {
     if ($link == '' || $link == '_this') {
         $linkPart = '';
     } else {
         $q->join($link, array('joinType' => 'LEFT'));
         $linkPart = $link . '.';
     }
     $where->equals($linkPart . 'created_by', self::$current_user->id);
 }