From c7796259474e07329ff38d3172ba05b716320415 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 7 Oct 2014 06:39:13 +0000 Subject: [PATCH] backport of Nathans r48906: handle multiple comma-separated category IDs --- addressbook/inc/class.addressbook_sql.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addressbook/inc/class.addressbook_sql.inc.php b/addressbook/inc/class.addressbook_sql.inc.php index 8f76b5d431..911d333377 100644 --- a/addressbook/inc/class.addressbook_sql.inc.php +++ b/addressbook/inc/class.addressbook_sql.inc.php @@ -444,13 +444,13 @@ class addressbook_sql extends so_sql_cf * fix cat_id criteria to search in comma-separated multiple cats * * @internal - * @param int/array $cats + * @param int|array|string $cats * @return array of sql-strings to be OR'ed or AND'ed together */ function _cat_search($cats) { $cat_filter = array(); - foreach(is_array($cats) ? $cats : array($cats) as $cat) + foreach(is_array($cats) ? $cats : (is_numeric($cats) ? array($cats) : explode(',',$cats)) as $cat) { if (is_numeric($cat)) $cat_filter[] = $this->db->concat("','",cat_id,"','")." LIKE '%,$cat,%'"; }