From 2f234415161f89c8683c57111c4295ccede11a42 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 25 May 2015 16:01:33 +0200 Subject: [PATCH] Fixed the 'inventory' and 'inventory_changes' items in metaconsole reports. TICKET: #2249 --- .../reporting_builder.item_editor.php | 24 ++++++++++------ .../include/functions_reporting.php | 28 +++++++++++++++++++ 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index f73ef53dd7..e91b95910a 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -2425,11 +2425,11 @@ function chooseType() { $("#row_module_multi").show(); $("#row_show_in_two_columns").show(); $("#row_servers").show(); - $("#id_agents").change(agent_changed_by_multiple_agents_inventory); + $("#id_agents").change(event_change_id_agent_inventory); $("#id_agents").trigger('change'); $("#combo_group").change(function() { - updateAgents($(this).val()); + updateAgents($(this).val(), ); }); break; @@ -2441,27 +2441,27 @@ function chooseType() { $("#row_date").show(); $("#row_show_in_two_columns").show(); - $("#id_agents").change(agent_changed_by_multiple_agents_inventory); + $("#id_agents").change(event_change_id_agent_inventory); $("#id_agents").trigger('change'); $("#row_servers").show(); $("#combo_group").change(function() { $('#hidden-date_selected').val(''); - updateInventoryDates(); - updateAgents($(this).val()); + updateInventoryDates(); + updateAgents($(this).val(), ); }); $("#id_agents").change(function() { $('#hidden-date_selected').val(''); - updateInventoryDates(); + updateInventoryDates(); }); $("#inventory_modules").change(function() { $('#hidden-date_selected').val(''); - updateInventoryDates(); + updateInventoryDates(); }); if (!$("#hidden-date_selected").val()) - updateInventoryDates(); + updateInventoryDates(); break; case 'inventory_changes': break; @@ -2514,6 +2514,14 @@ function chooseType() { } } +function event_change_id_agent_inventory() { + agent_changed_by_multiple_agents_inventory( + {"data" : {"homedir" : }}, + null, + null, + $("#combo_server").val()); +} + function set_last_value_period() { var checked = $("input[name='last_value']").prop("checked"); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 87dd1ac63d..c8d6b5c959 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1445,6 +1445,14 @@ function reporting_inventory_changes($report, $content) { $content['name'] = __('Inventory Changes'); } + if ($config['metaconsole']) { + $id_meta = metaconsole_get_id_server($content["server_name"]); + + + $server = metaconsole_get_connection_by_id ($id_meta); + metaconsole_connect($server); + } + $return['title'] = $content['name']; $return['subtitle'] = agents_get_name($content['id_agent']); $return["description"] = $content["description"]; @@ -1471,6 +1479,10 @@ function reporting_inventory_changes($report, $content) { $return['data'] = $inventory_changes; } + if ($config['metaconsole']) { + metaconsole_restore_db(); + } + return reporting_check_structure_content($return); } @@ -1485,6 +1497,14 @@ function reporting_inventory($report, $content) { $content['name'] = __('Inventory'); } + if ($config['metaconsole']) { + $id_meta = metaconsole_get_id_server($content["server_name"]); + + + $server = metaconsole_get_connection_by_id ($id_meta); + metaconsole_connect($server); + } + $return['title'] = $content['name']; $return["description"] = $content["description"]; $return["date"] = reporting_get_date_text($report, $content); @@ -1510,6 +1530,10 @@ function reporting_inventory($report, $content) { $return['data'] = $inventory_data; } + if ($config['metaconsole']) { + metaconsole_restore_db(); + } + return reporting_check_structure_content($return); } @@ -1606,6 +1630,10 @@ function reporting_agent_module($report, $content) { } } + if ($config['metaconsole']) { + metaconsole_restore_db(); + } + return reporting_check_structure_content($return); }