Merge branch 'ent-4109-Bug-en-utilizacion-de-macro-en-report-a-traves-de-plantillas' into 'develop'
fix item name macros when using report templates See merge request artica/pandorafms!2570
This commit is contained in:
commit
e43469954a
|
@ -1531,7 +1531,7 @@ function agents_get_alias($id_agent, $case='none')
|
|||
return $cache[$case][$id_agent];
|
||||
}
|
||||
|
||||
if ($config['dbconnection_cache'] == null && is_metaconsole()) {
|
||||
if (is_metaconsole()) {
|
||||
$alias = (string) db_get_value('alias', 'tmetaconsole_agent', 'id_tagente', (int) $id_agent);
|
||||
} else {
|
||||
$alias = (string) db_get_value('alias', 'tagente', 'id_agente', (int) $id_agent);
|
||||
|
|
|
@ -284,6 +284,25 @@ function reporting_make_reporting_data(
|
|||
if (!metaconsole_load_external_db($connection)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$items_label['agent_description'] = agents_get_description($content['id_agent']);
|
||||
$items_label['agent_group'] = agents_get_agent_group($content['id_agent']);
|
||||
$items_label['agent_address'] = agents_get_address($content['id_agent']);
|
||||
|
||||
$modules = agents_get_modules(
|
||||
$agent_value,
|
||||
[
|
||||
'id_agente_modulo',
|
||||
'nombre',
|
||||
'descripcion',
|
||||
],
|
||||
[
|
||||
'id_agente_modulo' => $content['id_agent_module'],
|
||||
]
|
||||
);
|
||||
|
||||
$items_label['module_name'] = $modules[$content['id_agent_module']]['nombre'];
|
||||
$items_label['module_description'] = $modules[$content['id_agent_module']]['descripcion'];
|
||||
}
|
||||
|
||||
if (is_array($content['id_agent']) && count($content['id_agent']) != 1) {
|
||||
|
@ -294,12 +313,12 @@ function reporting_make_reporting_data(
|
|||
$content['style']['name_label'] = str_replace('_module_', count($content['id_agent_module']).__(' modules'), $content['style']['name_label']);
|
||||
}
|
||||
|
||||
$content['name'] = reporting_label_macro($items_label, $content['style']['name_label']);
|
||||
|
||||
if ($metaconsole_on) {
|
||||
// Restore db connection.
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$content['name'] = reporting_label_macro($items_label, $content['style']['name_label']);
|
||||
}
|
||||
|
||||
switch (reporting_get_type($content)) {
|
||||
|
@ -11119,6 +11138,7 @@ function reporting_get_stats_servers()
|
|||
|
||||
$output = '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Server performance').'</legend>'.html_print_table($table_srv, true).'</fieldset>';
|
||||
|
||||
$public_hash = get_parameter('hash', false);
|
||||
if ($public_hash === false) {
|
||||
$output .= '<script type="text/javascript">';
|
||||
|
@ -11505,17 +11525,32 @@ function reporting_label_macro($item, $label)
|
|||
}
|
||||
|
||||
if (preg_match('/_agentdescription_/', $label)) {
|
||||
if (!is_metaconsole()) {
|
||||
$agent_name = agents_get_description($item['id_agent']);
|
||||
} else {
|
||||
$agent_name = $item['agent_description'];
|
||||
}
|
||||
|
||||
$label = str_replace('_agentdescription_', $agent_name, $label);
|
||||
}
|
||||
|
||||
if (preg_match('/_agentgroup_/', $label)) {
|
||||
if (!is_metaconsole()) {
|
||||
$agent_name = groups_get_name(agents_get_agent_group($item['id_agent']), true);
|
||||
} else {
|
||||
$agent_name = $item['agent_group'];
|
||||
}
|
||||
|
||||
$label = str_replace('_agentgroup_', $agent_name, $label);
|
||||
}
|
||||
|
||||
if (preg_match('/_address_/', $label)) {
|
||||
if (!is_metaconsole()) {
|
||||
$agent_name = agents_get_address($item['id_agent']);
|
||||
} else {
|
||||
$agent_name = $item['agent_address'];
|
||||
}
|
||||
|
||||
$label = str_replace('_address_', $agent_name, $label);
|
||||
}
|
||||
break;
|
||||
|
@ -11554,7 +11589,11 @@ function reporting_label_macro($item, $label)
|
|||
if (count($item['agents']) > 1) {
|
||||
$agent_name = '';
|
||||
} else {
|
||||
if (!is_metaconsole()) {
|
||||
$agent_name = agents_get_description($item['id_agent']);
|
||||
} else {
|
||||
$agent_name = $item['agent_description'];
|
||||
}
|
||||
}
|
||||
|
||||
$label = str_replace('_agentdescription_', $agent_name, $label);
|
||||
|
@ -11564,7 +11603,11 @@ function reporting_label_macro($item, $label)
|
|||
if (count($item['agents']) > 1) {
|
||||
$agent_name = '';
|
||||
} else {
|
||||
if (!is_metaconsole()) {
|
||||
$agent_name = groups_get_name(agents_get_agent_group($item['id_agent']), true);
|
||||
} else {
|
||||
$agent_name = $item['agent_group'];
|
||||
}
|
||||
}
|
||||
|
||||
$label = str_replace('_agentgroup_', $agent_name, $label);
|
||||
|
@ -11574,7 +11617,11 @@ function reporting_label_macro($item, $label)
|
|||
if (count($item['agents']) > 1) {
|
||||
$agent_name = '';
|
||||
} else {
|
||||
if (!is_metaconsole()) {
|
||||
$agent_name = agents_get_address($item['id_agent']);
|
||||
} else {
|
||||
$agent_name = $item['agent_address'];
|
||||
}
|
||||
}
|
||||
|
||||
$label = str_replace('_address_', $agent_name, $label);
|
||||
|
@ -11584,7 +11631,11 @@ function reporting_label_macro($item, $label)
|
|||
if ($item['modules'] > 1) {
|
||||
$module_name = $item['modules'].__(' modules');
|
||||
} else {
|
||||
if (!is_metaconsole()) {
|
||||
$module_name = modules_get_agentmodule_name($item['id_agent_module']);
|
||||
} else {
|
||||
$module_name = $item['module_name'];
|
||||
}
|
||||
}
|
||||
|
||||
$label = str_replace('_module_', $module_name, $label);
|
||||
|
@ -11594,7 +11645,11 @@ function reporting_label_macro($item, $label)
|
|||
if ($item['modules'] > 1) {
|
||||
$module_description = '';
|
||||
} else {
|
||||
if (!is_metaconsole()) {
|
||||
$module_description = modules_get_agentmodule_descripcion($item['id_agent_module']);
|
||||
} else {
|
||||
$module_description = $item['module_description'];
|
||||
}
|
||||
}
|
||||
|
||||
$label = str_replace('_moduledescription_', $module_description, $label);
|
||||
|
|
Loading…
Reference in New Issue