From c4ffd0257ffb04d9a950dd76d7ff28dd827ce9d8 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Thu, 18 May 2017 14:59:17 +0200 Subject: [PATCH] Free search input in event list view filter also by custom_data - #311 --- .../operation/events/events.build_query.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php index 31f65cdf14..f75410fe90 100755 --- a/pandora_console/operation/events/events.build_query.php +++ b/pandora_console/operation/events/events.build_query.php @@ -76,9 +76,29 @@ switch ($status) { break; } + +$events_wi_cdata = db_get_all_rows_sql('SELECT id_evento,custom_data from tevento WHERE custom_data != ""'); +$count_events = 0; +$events_wi_cdata_id = 'OR id_evento IN ('; +foreach ($events_wi_cdata as $key => $value) { + if(strpos(base64_decode($value['custom_data']),$search) != false){ + $events_wi_cdata_id .= $value['id_evento']; + $count_events++; + } + if ($value !== end($events_wi_cdata) && $count_events > 0) { + $events_wi_cdata_id .= ','; + } +} +$events_wi_cdata_id .= ')'; + +if($count_events == 0){ + $events_wi_cdata_id = ''; +} + + if ($search != "") { $filter_resume['free_search'] = $search; - $sql_post .= " AND (evento LIKE '%". io_safe_input($search) . "%' OR id_evento LIKE '%$search%')"; + $sql_post .= " AND (evento LIKE '%". io_safe_input($search) . "%' OR id_evento LIKE '%$search%' ".$events_wi_cdata_id.")"; } if ($event_type != "") {