From fc9a5c46623e4260baa3cb26f935eeec76085ca1 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 10 Oct 2017 13:39:44 +0200 Subject: [PATCH] Fixed search by tags --- pandora_console/operation/events/events.build_query.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php index aca3603f8c..832f9b3831 100755 --- a/pandora_console/operation/events/events.build_query.php +++ b/pandora_console/operation/events/events.build_query.php @@ -234,8 +234,12 @@ if (!empty($tag_with)) { $first = true; $filter_resume['tag_inc'] = $tag_with; foreach ($tag_with as $id_tag) { - if ($first) $first = false; - else $sql_post .= " AND "; + if ($first){ + $sql_post .= " ( "; + $first = false; + } else { + $sql_post .= " AND ( "; + } $sql_post .= "tags LIKE '" . tags_get_name($id_tag) . "'"; $sql_post .= " OR "; $sql_post .= "tags LIKE '" . tags_get_name($id_tag) . ",%'"; @@ -243,6 +247,7 @@ if (!empty($tag_with)) { $sql_post .= "tags LIKE '%," . tags_get_name($id_tag) . "'"; $sql_post .= " OR "; $sql_post .= "tags LIKE '%," . tags_get_name($id_tag) . ",%'"; + $sql_post .= ' ) '; } $sql_post .= ' ) '; }