Merge branch 'ent-5132-Generacion-de-imagenes-en-PDFs-3' into 'develop'

Fixed errors

See merge request artica/pandorafms!2962
This commit is contained in:
Daniel Rodriguez 2019-12-16 11:20:37 +01:00
commit 11beedc773
3 changed files with 23 additions and 23 deletions

View File

@ -101,7 +101,7 @@ $params = json_decode($_REQUEST['data'], true);
// Metaconsole connection to the node.
$server_id = $params['server_id'];
if ($config['metaconsole'] && !empty($server_id)) {
if (is_metaconsole() && !empty($server_id)) {
$server = metaconsole_get_connection_by_id($server_id);
// Error connecting.
if (metaconsole_connect($server) !== NOERR) {

View File

@ -3851,9 +3851,11 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false
$file_js = $config['homedir'].'/include/web2image.js';
$url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php';
$img_file = 'img_'.uniqid().'.png';
$img_path = $config['homedir'].'/attachment/'.$img_file;
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
if (!$params['return_img_base_64']) {
$img_file = 'img_'.uniqid().'.png';
$img_path = $config['homedir'].'/attachment/'.$img_file;
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
}
$width_img = 500;
@ -3866,8 +3868,8 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false
}
if ($type_graph_pdf === 'slicebar') {
$height_img = 70;
$params['height'] = 70;
$height_img = 90;
$params['height'] = 90;
}
$params_encode_json = urlencode(json_encode($params));

View File

@ -291,16 +291,18 @@ function reporting_make_reporting_data(
$agents_to_macro = $content['id_agent'];
}
// Metaconsole connection.
if (is_metaconsole()) {
$server = metaconsole_get_connection_names();
$connection = metaconsole_get_connection($server);
if (metaconsole_connect($connection) != NOERR) {
continue;
}
}
if (isset($content['style']['name_label'])) {
$server_name = $content['server_name'];
$metaconsole_on = is_metaconsole();
// Metaconsole connection.
if ($metaconsole_on && $server_name != '') {
$connection = metaconsole_get_connection($server_name);
if (!metaconsole_load_external_db($connection)) {
continue;
}
}
// Add macros name.
$items_label = [];
$items_label['type'] = $content['type'];
@ -309,8 +311,6 @@ function reporting_make_reporting_data(
$items_label['modules'] = $modules_to_macro;
$items_label['agents'] = $agents_to_macro;
$items_label['visual_format'] = $visual_format;
$metaconsole_on = is_metaconsole();
$server_name = $content['server_name'];
$items_label['agent_description'] = agents_get_description(
$content['id_agent']
@ -7551,12 +7551,10 @@ function reporting_custom_graph(
if ($type_report == 'custom_graph') {
if (is_metaconsole()) {
$servers = metaconsole_get_connection_names();
foreach ($servers as $server) {
$connection = metaconsole_get_connection($server);
if (metaconsole_connect($connection) != NOERR) {
continue;
}
$id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta);
if (metaconsole_connect($server) != NOERR) {
return false;
}
}
}