Merge branch '311-Filtrar-por-campo-personalizado-en-eventos-comas' into 'develop'

Fix bug when there is an event with a bad data in custom_data - #311

See merge request !568
This commit is contained in:
vgilc 2017-06-07 18:02:13 +02:00
commit 84b02bdf9d
1 changed files with 6 additions and 2 deletions

View File

@ -81,16 +81,20 @@ $events_wi_cdata = db_get_all_rows_sql('SELECT id_evento,custom_data from tevent
$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){
if(strpos(strtolower(base64_decode($value['custom_data'])),strtolower($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 = str_replace(',,', ',', $events_wi_cdata_id);
}
}
$events_wi_cdata_id .= ')';
$events_wi_cdata_id = str_replace(',)', ')', $events_wi_cdata_id);
if($count_events == 0){
$events_wi_cdata_id = '';
}