Free search input in event list view filter also by custom_data - #311

This commit is contained in:
enriquecd 2017-05-18 14:59:17 +02:00
parent 51538db187
commit c4ffd0257f
1 changed files with 21 additions and 1 deletions

View File

@ -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 != "") {