Added some tags fixes to event filter

This commit is contained in:
Arturo Gonzalez 2017-04-06 13:20:34 +02:00
parent dc654b0f3e
commit e576f6d3e8

View File

@ -126,7 +126,13 @@ if (is_ajax()) {
$values['id_group_filter'] = get_parameter('id_group_filter'); $values['id_group_filter'] = get_parameter('id_group_filter');
$values['date_from'] = get_parameter('date_from'); $values['date_from'] = get_parameter('date_from');
$values['date_to'] = get_parameter('date_to'); $values['date_to'] = get_parameter('date_to');
html_debug($values, true); if (io_safe_output($values['tag_with']) == "[\"0\"]") {
$values['tag_with'] = "[]";
}
if (io_safe_output($values['tag_without']) == "[\"0\"]") {
$values['tag_without'] = "[]";
}
$result = db_process_sql_update('tevent_filter', $result = db_process_sql_update('tevent_filter',
$values, array('id_filter' => $id)); $values, array('id_filter' => $id));
@ -318,11 +324,11 @@ if ($user_filter != 0 && empty($id_name) && !$update_from_filter_table) {
if ($user_default_filter['date_to'] != "0000-00-00") { if ($user_default_filter['date_to'] != "0000-00-00") {
$filter_resume['time_to'] = $user_default_filter['date_to']; $filter_resume['time_to'] = $user_default_filter['date_to'];
} }
if ($user_default_filter['tag_with'] != "[]") { if (io_safe_output($user_default_filter['tag_with']) != "[]") {
$tag_with_clean_tag = io_safe_output($user_default_filter['tag_with']); $tag_with_clean_tag = io_safe_output($user_default_filter['tag_with']);
$filter_resume['tag_inc'] = json_decode($tag_with_clean_tag, true); $filter_resume['tag_inc'] = json_decode($tag_with_clean_tag, true);
} }
if ($user_default_filter['tag_without'] != "[]") { if (io_safe_output($user_default_filter['tag_without']) != "[]") {
$tag_without_clean_tag = io_safe_output($user_default_filter['tag_without']); $tag_without_clean_tag = io_safe_output($user_default_filter['tag_without']);
$filter_resume['tag_no_inc'] = json_decode($tag_without_clean_tag, true); $filter_resume['tag_no_inc'] = json_decode($tag_without_clean_tag, true);
} }
@ -370,14 +376,14 @@ $tags_select_without = array();
$tag_with_temp = array(); $tag_with_temp = array();
$tag_without_temp = array(); $tag_without_temp = array();
foreach ($tags as $id_tag => $tag) { foreach ($tags as $id_tag => $tag) {
if (array_search($id_tag, $tag_with) === false) { if ((array_search($id_tag, $tag_with) === false) || (array_search($id_tag, $tag_with) === null)) {
$tags_select_with[$id_tag] = ui_print_truncate_text ($tag, 50, true); $tags_select_with[$id_tag] = ui_print_truncate_text ($tag, 50, true);
} }
else { else {
$tag_with_temp[$id_tag] = ui_print_truncate_text ($tag, 50, true); $tag_with_temp[$id_tag] = ui_print_truncate_text ($tag, 50, true);
} }
if (array_search($id_tag, $tag_without) === false) { if ((array_search($id_tag, $tag_without) === false) || (array_search($id_tag, $tag_without) === null)) {
$tags_select_without[$id_tag] = ui_print_truncate_text ($tag, 50, true); $tags_select_without[$id_tag] = ui_print_truncate_text ($tag, 50, true);
} }
else { else {
@ -1087,11 +1093,15 @@ $(document).ready( function() {
$("#text-date_from").val(''); $("#text-date_from").val('');
$("#text-date_to").val(''); $("#text-date_to").val('');
$("#pagination").val(20); $("#pagination").val(20);
$("#update_from_filter_table").val(1);
clear_tags_inputs(); clear_tags_inputs();
// Update the view of filter load with no loaded filters message // Update the view of filter load with no loaded filters message
$('#filter_loaded_span').html($('#not_filter_loaded_text').html()); $('#filter_loaded_span').html($('#not_filter_loaded_text').html());
// Update the view with the loaded filter
$('#submit-update').trigger('click');
} }
// If filter selected then load filter // If filter selected then load filter
else { else {