minor change

This commit is contained in:
alejandro.campos@artica.es 2022-04-01 14:06:51 +02:00
parent 7bfa78a3d5
commit b7aca968a3
2 changed files with 9 additions and 7 deletions

View File

@ -894,7 +894,9 @@ function save_update_filter() {
"id_extra": $("#text-id_extra").val(), "id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(), "user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val(), "id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val() "server_id": $("#server_id").val(),
"custom_data": $("#text-custom_data").val(),
"custom_data_filter_type": $("#custom_data_filter_type").val()
}, },
function (data) { function (data) {

View File

@ -1126,15 +1126,15 @@ function events_get_all(
if (empty($filter['custom_data']) === false) { if (empty($filter['custom_data']) === false) {
if ($filter['custom_data_filter_type'] === '1') { if ($filter['custom_data_filter_type'] === '1') {
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") ', ' AND JSON_VALID(custom_data) = 1
$filter['custom_data'], AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ',
$filter['custom_data'] io_safe_output($filter['custom_data'])
); );
} else { } else {
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_KEYS(custom_data) REGEXP "%s" ', ' AND JSON_VALID(custom_data) = 1
$filter['custom_data'], AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ',
$filter['custom_data'] io_safe_output($filter['custom_data'])
); );
} }
} }