2012-12-12 Sergio Martin <sergio.martin@artica.es>

* godmode/reporting/reporting_builder.list_items.php: Fixed the
	modules/agents shown in the table of report items in inventory
	kind
	merged from 4.0.2



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7271 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-12-12 14:23:04 +00:00
parent 4b5b7c0db8
commit 6c48aa56d0
2 changed files with 37 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2012-12-12 Sergio Martin <sergio.martin@artica.es>
* godmode/reporting/reporting_builder.list_items.php: Fixed the
modules/agents shown in the table of report items in inventory
kind
merged from 4.0.2
2012-12-12 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_visual_map_editor.php: increased the size of

View File

@ -294,15 +294,41 @@ foreach ($items as $item) {
}
if ($item['id_agent'] == 0) {
$is_inventory_item = $item['type'] == 'inventory' || $item['type'] == 'inventory_changes';
// Due to SLA or top N or general report items
if (($item['id_agent_module'] == '') or ($item['id_agent_module'] == 0)) {
if (!$is_inventory_item && ($item['id_agent_module'] == '' || $item['id_agent_module'] == 0)) {
$row[2] = '';
$row[3] = '';
}
else {
$row[2] = ui_print_truncate_text(agents_get_name(agents_get_agent_id_by_module_id($item['id_agent_module'])), 'agent_small');
$module_name_db = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$row[3] = ui_print_truncate_text(io_safe_output($module_name_db), 'module_small');
// The inventory items have the agents and modules in json format in the field external_source
if($is_inventory_item) {
$external_source = json_decode($item['external_source'], true);
$agents = $external_source['id_agents'];
$modules = $external_source['id_agents'];
$agent_name_db = array();
foreach($agents as $a) {
$agent_name_db[] = agents_get_name($a);
}
$agent_name_db = implode('<br>',$agent_name_db);
$module_name_db = array();
foreach($modules as $m) {
$module_name_raw = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $m));
$module_name_db[] = ui_print_truncate_text(io_safe_output($module_name_raw), 'module_small');
}
$module_name_db = implode('<br>',$module_name_db);
}
else {
$agent_name_db = agents_get_name(agents_get_agent_id_by_module_id($item['id_agent_module']));
$agent_name_db = ui_print_truncate_text($agent_name_db, 'agent_small');
$module_name_db = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$module_name_db = ui_print_truncate_text(io_safe_output($module_name_db), 'module_small');
}
$row[2] = $agent_name_db;
$row[3] = $module_name_db;
}
}
else {