From a31b413018bbe1a42b4d179fb91dd6de6f628ba6 Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 20 Oct 2016 09:49:39 -0600 Subject: [PATCH] Handle searching for a single integer as looking for a specific event by ID, similar to infolog --- calendar/inc/class.calendar_so.inc.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index 39d9b24a59..bbd41c16d5 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -735,11 +735,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']))