diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index aa8c68175e..099d398691 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -3199,7 +3199,7 @@ $class = 'databox filters';
?>
-
+
$value) {
- if (array_search('secondary_groups', $es_agents_inventory_display_options) !== false) {
- $sql_agent_sec_group = sprintf(
- 'SELECT id_group
- FROM tagent_secondary_group
- WHERE id_agent = %d',
- $value['id_agente']
- );
-
- $agent_secondary_groups = [];
- $agent_secondary_groups = db_get_all_rows_sql($sql_agent_sec_group);
-
- $agents[$key]['secondary_groups'] = $agent_secondary_groups;
- }
-
- if (array_search('custom_fields', $es_agents_inventory_display_options) !== false) {
- $sql_agent_custom_fields = sprintf(
- 'SELECT tacd.description, tacf.name
- FROM tagent_custom_data tacd INNER JOIN tagent_custom_fields tacf
- ON tacd.id_field = tacf.id_field
- WHERE tacd.description != "" AND tacd.id_agent = %d',
- $value['id_agente']
- );
-
- $agent_custom_fields = [];
- $agent_custom_fields = db_get_all_rows_sql($sql_agent_custom_fields);
-
- $agents[$key]['custom_fields'] = $agent_custom_fields;
- }
+ if (is_metaconsole()) {
+ $servers_ids = array_column(metaconsole_get_servers(), 'id');
+ } else {
+ $servers_ids = [0];
}
- foreach ($agents as $key => $value) {
- foreach ($value as $agent_val_key => $agent_val) {
- // Exclude from data to be displayed in report those fields that were not selected to be displayed by user.
- if (array_search($agent_val_key, $es_agents_inventory_display_options) === false) {
- unset($agents[$key][$agent_val_key]);
+ $return['data'] = [];
+
+ foreach ($servers_ids as $server_id) {
+ if (is_metaconsole()) {
+ $server = metaconsole_get_connection_by_id($server_id);
+ metaconsole_connect($server);
+ }
+
+ $agents = db_get_all_rows_sql($sql);
+
+ foreach ($agents as $key => $value) {
+ if (array_search('secondary_groups', $es_agents_inventory_display_options) !== false) {
+ $sql_agent_sec_group = sprintf(
+ 'SELECT id_group
+ FROM tagent_secondary_group
+ WHERE id_agent = %d',
+ $value['id_agente']
+ );
+
+ $agent_secondary_groups = [];
+ $agent_secondary_groups = db_get_all_rows_sql($sql_agent_sec_group);
+
+ $agents[$key]['secondary_groups'] = $agent_secondary_groups;
+ }
+
+ if (array_search('custom_fields', $es_agents_inventory_display_options) !== false) {
+ $sql_agent_custom_fields = sprintf(
+ 'SELECT tacd.description, tacf.name
+ FROM tagent_custom_data tacd INNER JOIN tagent_custom_fields tacf
+ ON tacd.id_field = tacf.id_field
+ WHERE tacd.description != "" AND tacd.id_agent = %d',
+ $value['id_agente']
+ );
+
+ $agent_custom_fields = [];
+ $agent_custom_fields = db_get_all_rows_sql($sql_agent_custom_fields);
+
+ $agents[$key]['custom_fields'] = $agent_custom_fields;
}
}
- }
- $return['data'] = $agents;
+ foreach ($agents as $key => $value) {
+ foreach ($value as $agent_val_key => $agent_val) {
+ // Exclude from data to be displayed in report those fields that were not selected to be displayed by user.
+ if (array_search($agent_val_key, $es_agents_inventory_display_options) === false) {
+ unset($agents[$key][$agent_val_key]);
+ }
+ }
+ }
+
+ $return['data'] = array_merge($return['data'], $agents);
+
+ if (is_metaconsole()) {
+ metaconsole_restore_db();
+ }
+ }
return reporting_check_structure_content($return);
}
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index ceba581f11..925adecf50 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -1541,6 +1541,26 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
$column_value = ui_print_module_status((int) $data_field_value, true);
} else if ($data_field_key === 'id_grupo') {
$column_value = ui_print_group_icon((int) $data_field_value, true);
+ } else if ($data_field_key === 'custom_fields') {
+ $custom_fields_value = [];
+
+ if (is_array($data_field_value)) {
+ foreach ($data_field_value as $value) {
+ $custom_fields_value[] = $value['name'].': '.$value['description'];
+ }
+ }
+
+ $column_value = implode(' / ', $custom_fields_value);
+ } else if ($data_field_key === 'secondary_groups') {
+ $custom_fields_value = [];
+
+ if (is_array($data_field_value)) {
+ foreach ($data_field_value as $value) {
+ $custom_fields_value[] = ui_print_group_icon((int) $value['id_group'], true);
+ }
+ }
+
+ $column_value = implode(' / ', $custom_fields_value);
}
$row[] = $column_value;
@@ -1553,6 +1573,8 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
}
}
+ hd('======', true);
+ hd($pdf, true);
if ($pdf === 0) {
$table->colspan['permissions']['cell'] = 3;
$table->cellstyle['permissions']['cell'] = 'text-align: center;';
@@ -5903,6 +5925,8 @@ function reporting_html_permissions($table, $item, $pdf=0)
}
}
+ // hd("lllllp", true);
+ // hd($pdf, true);
if ($pdf === 0) {
$table->colspan['permissions']['cell'] = 3;
$table->cellstyle['permissions']['cell'] = 'text-align: center;';
|