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. // Metaconsole connection to the node.
$server_id = $params['server_id']; $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); $server = metaconsole_get_connection_by_id($server_id);
// Error connecting. // Error connecting.
if (metaconsole_connect($server) !== NOERR) { 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'; $file_js = $config['homedir'].'/include/web2image.js';
$url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php'; $url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php';
$img_file = 'img_'.uniqid().'.png'; if (!$params['return_img_base_64']) {
$img_path = $config['homedir'].'/attachment/'.$img_file; $img_file = 'img_'.uniqid().'.png';
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file; $img_path = $config['homedir'].'/attachment/'.$img_file;
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
}
$width_img = 500; $width_img = 500;
@ -3866,8 +3868,8 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false
} }
if ($type_graph_pdf === 'slicebar') { if ($type_graph_pdf === 'slicebar') {
$height_img = 70; $height_img = 90;
$params['height'] = 70; $params['height'] = 90;
} }
$params_encode_json = urlencode(json_encode($params)); $params_encode_json = urlencode(json_encode($params));

View File

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