fixed filters pandora_enterprise#9864

This commit is contained in:
Daniel Barbero 2022-11-22 11:35:38 +01:00
parent 1a77ee9ce4
commit d1beb5cb2d
3 changed files with 40 additions and 12 deletions

View File

@ -553,7 +553,7 @@ if ($load_filter_modal) {
);
echo '<div id="load-filter-select" class="load-filter-modal">';
echo '<form method="post" id="form_load_filter">';
echo '<form method="post" id="form_load_filter" action="index.php?sec=eventos&sec2=operation/events/events&pure=">';
$table = new StdClass;
$table->id = 'load_filter_form';

View File

@ -222,7 +222,7 @@ $id_source_event = get_parameter(
$server_id = get_parameter(
'filter[server_id]',
($filter['id_server_meta'] ?? '')
($filter['server_id'] ?? '')
);
if (is_metaconsole() === true) {
@ -241,13 +241,19 @@ if (is_metaconsole() === true) {
$servers[0] = __('Metaconsola');
if ($server_id === '') {
if (empty($server_id) === true) {
$server_id = array_keys($servers);
} else if (is_array($server_id) === false) {
if ((int) $server_id !== 0) {
$server_id = [$server_id];
} else {
$server_id = array_keys($servers);
} else {
if (is_array($server_id) === false) {
if (is_numeric($server_id) === true) {
if ($server_id !== 0) {
$server_id = [$filter['server_id']];
} else {
$server_id = array_keys($servers);
}
} else {
$server_id = explode(',', $filter['server_id']);
}
}
}
}
@ -1108,7 +1114,21 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$id_extra = $filter['id_extra'];
$user_comment = $filter['user_comment'];
$id_source_event = ($filter['id_source_event'] ?? '');
$server_id = $filter['server_id'];
$server_id = '';
if (empty($filter['server_id']) === false) {
if (is_array($server_id) === false) {
if (is_numeric($server_id) === true) {
if ($server_id !== 0) {
$server_id = [$filter['server_id']];
} else {
$server_id = array_keys($servers);
}
} else {
$server_id = explode(',', $filter['server_id']);
}
}
}
$custom_data = $filter['custom_data'];
$custom_data_filter_type = $filter['custom_data_filter_type'];
}
@ -2849,7 +2869,11 @@ $(document).ready( function() {
inputs = $("#<?php echo $form_id; ?> :input");
values = {};
inputs.each(function() {
values[this.name] = $(this).val();
if (this.name === 'server_id') {
values[this.name] = $(this).val().join();
} else {
values[this.name] = $(this).val();
}
})
values['history'] = "<?php echo (int) $history; ?>";
@ -3030,7 +3054,11 @@ $(document).ready( function() {
inputs = $("#events_form :input");
values = {};
inputs.each(function() {
values[this.name] = $(this).val();
if (this.name === 'server_id') {
values[this.name] = $(this).val().join();
} else {
values[this.name] = $(this).val();
}
})
var newValue = btoa(JSON.stringify(values));

View File

@ -1256,7 +1256,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`id_extra` TINYTEXT,
`user_comment` TEXT,
`id_source_event` INT NULL DEFAULT 0,
`server_id` INT NOT NULL DEFAULT 0,
`server_id` TEXT,
`time_from` TIME NULL,
`time_to` TIME NULL,
`custom_data` VARCHAR(500) DEFAULT '',