Merge branch 'ent-5445-Item-prediction-date-no-funciona-correctamente-en-meta' into 'develop'

fix prediction date item in meta

See merge request artica/pandorafms!3340
This commit is contained in:
Daniel Rodriguez 2020-07-13 11:12:53 +02:00
commit ad93a7c681
3 changed files with 18 additions and 6 deletions

View File

@ -36,7 +36,8 @@ function forecast_projection_graph(
$prediction_period,
$max_value=false,
$min_value=false,
$csv=false
$csv=false,
$server_name=''
) {
global $config;
@ -55,7 +56,7 @@ function forecast_projection_graph(
'projection' => true,
];
$module_data = grafico_modulo_sparse($params);
$module_data = grafico_modulo_sparse($params, $server_name);
if (empty($module_data)) {
return [];
@ -252,12 +253,13 @@ function forecast_prediction_date(
$module_id,
$period=SECONDS_2MONTHS,
$max_value=0,
$min_value=0
$min_value=0,
$server_name=''
) {
// Checks interval
if ($min_value > $max_value) {
return false;
}
return forecast_projection_graph($module_id, $period, false, $max_value, $min_value);
return forecast_projection_graph($module_id, $period, false, $max_value, $min_value, false, $server_name);
}

View File

@ -616,7 +616,7 @@ function grafico_modulo_sparse_data(
*
* @return string html Content graphs.
*/
function grafico_modulo_sparse($params)
function grafico_modulo_sparse($params, $server_name='')
{
global $config;
@ -812,6 +812,12 @@ function grafico_modulo_sparse($params)
$date_array['final_date'] = $params['date'];
$date_array['start_date'] = ($params['date'] - $params['period']);
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($server_name);
$server = metaconsole_get_connection_by_id($id_meta);
metaconsole_connect($server);
}
if ($agent_module_id) {
$module_data = db_get_row_sql(
'SELECT * FROM tagente_modulo
@ -1022,6 +1028,10 @@ function grafico_modulo_sparse($params)
}
}
if (is_metaconsole()) {
metaconsole_restore_db();
}
return $return;
}

View File

@ -4664,7 +4664,7 @@ function reporting_prediction_date($report, $content)
$max_interval = $intervals_text[0];
$min_interval = $intervals_text[1];
$value = forecast_prediction_date($content['id_agent_module'], $content['period'], $max_interval, $min_interval);
$value = forecast_prediction_date($content['id_agent_module'], $content['period'], $max_interval, $min_interval, $content['server_name']);
if ($value === false) {
$return['data']['value'] = __('Unknown');