Handle searching for a single integer as looking for a specific event by ID, similar to infolog

This commit is contained in:
nathangray 2016-10-20 09:49:39 -06:00
parent cc9795b71e
commit d02d3b8d50

View File

@ -739,11 +739,18 @@ class calendar_so
}
elseif ($params['query'])
{
foreach(array('cal_title','cal_description','cal_location') as $col)
if(is_numeric($params['query']))
{
$to_or[] = $col.' '.$this->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote('%'.$params['query'].'%');
$where[] = $this->cal_table.'.cal_id = ' . (int)$params['query'];
}
else
{
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).')';
}
$where[] = '('.implode(' OR ',$to_or).')';
// Searching - restrict private to own or private grant
if (!isset($params['private_grants']))