SugarCRM ListView查询中加入默认条件


$_REQUEST['where'] = $where;
$storeQuery->process_views($currentModule);
上面加入以下代码,下面的代码指默认为查询本月
if($where=='')
{
 $date_period ='thismonth';
 
 $date_from = get_date_from($date_period);
 $date_to = get_date_to($date_period);

 if(isset($date_from) && $date_from != "") array_push($where_clauses, "ser_teenagers.date_modified>='$date_from'");
 if(isset($date_to) && $date_to != "") array_push($where_clauses, "ser_teenagers.date_modified<'$date_to'");
 
 $seedser_Teenager->custom_fields->setWhereClauses($where_clauses);
 
 $where = '';
 foreach($where_clauses as $clause){
  if($where != '')
   $where .= ' AND ';
  $where .= $clause;
 }
}

posted @ 2011-03-29 13:19  海乐学习  阅读(546)  评论(0编辑  收藏  举报