Merge branch 'ent-11560-item-de-inventory-en-informes-funciona-mal-en-meta-y-nodo' into 'develop'

Ent 11560 item de inventory en informes funciona mal en meta y nodo

See merge request artica/pandorafms!6127
This commit is contained in:
Rafael Ameijeiras 2023-06-27 11:21:52 +00:00
commit 9b1e413fcc
3 changed files with 41 additions and 18 deletions

View File

@ -1219,7 +1219,7 @@ $class = 'databox filters';
<?php
html_print_select(
$servers,
'combo_server_sql',
'combo_server',
$server_name,
''
);
@ -1240,7 +1240,7 @@ $class = 'databox filters';
<?php
html_print_select(
$servers_all_opt,
'combo_server',
'combo_server_sql',
$server_name,
'',
$nothing,
@ -5333,7 +5333,7 @@ $(document).ready (function () {
break;
case 'inventory':
case 'inventory_changes':
if ($("select#inventory_modules>option:selected").val() == 0) {
if ($("select#inventory_modules>option:selected").val() == -1) {
dialog_message('#message_no_module');
return false;
}
@ -7163,9 +7163,6 @@ function chooseType() {
$('#row_regular_expression').show();
$("#row_date").show();
$("#id_agents")
.change(event_change_id_agent_inventory);
$("#id_agents").trigger('change');
$("#row_servers").show();
@ -7187,12 +7184,16 @@ function chooseType() {
false,
false,
false,
false
false,
).'"';
echo ', "false", '.json_encode($id_agents).'';
?>
);
});
$("#combo_server").trigger('change');
$("#combo_group").change(function() {
$('#hidden-date_selected').val('');
updateInventoryDates(
@ -7216,6 +7217,9 @@ function chooseType() {
?>
);
});
$("#id_agents").change(event_change_id_agent_inventory);
$("#id_agents").trigger('change');
$("#id_agents").change(function() {
$('#hidden-date_selected').val('');
updateInventoryDates(
@ -7242,7 +7246,7 @@ function chooseType() {
?>
);
});
if (!$("#hidden-date_selected").val())
updateInventoryDates(
<?php

View File

@ -1411,6 +1411,7 @@ switch ($action) {
];
$report = db_get_row_filter(
'treport',
['id_report' => $idReport]
@ -1520,21 +1521,28 @@ switch ($action) {
$good_format = false;
switch ($action) {
case 'update':
$values = [];
$server_id = get_parameter('server_id', 0);
if (is_metaconsole() === true
&& empty($server_id) === false
) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
metaconsole_connect($connection);
$values['server_name'] = $connection['server_name'];
$values['type'] = get_parameter('type', null);
if (is_metaconsole() === true && $values['type'] === 'inventory') {
$values['server_name'] = get_parameter('combo_server');
} else {
$server_id = get_parameter('server_id', 0);
if (is_metaconsole() === true
&& empty($server_id) === false
) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
metaconsole_connect($connection);
$values['server_name'] = $connection['server_name'];
}
}
$values['id_report'] = $idReport;
$values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null);
$values['recursion'] = get_parameter('recursion', null);
$values['show_extended_events'] = get_parameter(
'include_extended_events',
@ -1757,9 +1765,14 @@ switch ($action) {
'inventory_modules'
);
$es['inventory_regular_expression'] = get_parameter('inventory_regular_expression', '');
if (is_metaconsole() === true) {
$es['inventory_server'] = get_parameter('combo_server');
}
$description = get_parameter('description');
$values['external_source'] = json_encode($es);
$good_format = true;
break;
case 'inventory_changes':
@ -2579,6 +2592,7 @@ switch ($action) {
$es['inventory_regular_expression'] = get_parameter('inventory_regular_expression', '');
$values['external_source'] = json_encode($es);
$good_format = true;
break;
case 'event_report_log':

View File

@ -63,7 +63,12 @@ function inventory_get_data(
array_push($where, 'id_agente IN ('.implode(',', $agents_ids).')');
}
foreach ($inventory_module_name as $key => $module_name) {
$inventory_module_name[$key] = io_safe_output($module_name);
}
if ($inventory_module_name[0] !== '0'
&& $inventory_module_name[0] !== 0
&& $inventory_module_name !== ''
&& $inventory_module_name !== 'all'
) {