* Calendar - use same search as the rest of EGroupware (supports quotes, boolean, #<id> to search for id)

This commit is contained in:
nathangray 2017-11-07 09:55:12 -07:00
parent 331364810b
commit f33ce2d9f5

View File

@ -739,18 +739,11 @@ class calendar_so
} }
elseif ($params['query']) elseif ($params['query'])
{ {
if(is_numeric($params['query'])) $columns = array('cal_title','cal_description','cal_location');
{
$where[] = $this->cal_table.'.cal_id = ' . (int)$params['query']; $wildcard = $op = null;
} $so_sql = new Api\Storage\Base('calendar', $this->cal_table, $this->db);
else $where = $so_sql->search2criteria($params['query'], $wildcard, $op, null, $columns);
{
foreach(array('cal_title','cal_description','cal_location') as $col)
{
$to_or[] = $col.' '.$this->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote('%'.$params['query'].'%');
}
$where[] = '('.implode(' OR ',$to_or).')';
}
// Searching - restrict private to own or private grant // Searching - restrict private to own or private grant
if (!isset($params['private_grants'])) if (!isset($params['private_grants']))