Fixed bug in CSV export

This commit is contained in:
manuel 2019-10-21 11:48:13 +02:00
parent 2884226e56
commit 312b1c7c40

View File

@ -4190,10 +4190,22 @@ function reporting_sql_graph(
$return['description'] = $content['description']; $return['description'] = $content['description'];
$return['date'] = reporting_get_date_text(); $return['date'] = reporting_get_date_text();
$module_source = db_get_all_rows_sql(
'SELECT id_agent_module
FROM tgraph_source
WHERE id_graph = '.$content['id_gs']
);
if (isset($module_source) && is_array($module_source)) {
$modules = [];
foreach ($module_source as $key => $value) {
$modules[$key] = $value['id_agent_module'];
}
}
switch ($type) { switch ($type) {
case 'dinamic': case 'dinamic':
case 'static': case 'static':
case 'data':
$return['chart'] = graph_custom_sql_graph( $return['chart'] = graph_custom_sql_graph(
$content['id_rc'], $content['id_rc'],
$width, $width,
@ -4205,6 +4217,19 @@ function reporting_sql_graph(
$content['top_n_value'] $content['top_n_value']
); );
break; break;
case 'data':
$data = [];
foreach ($modules as $key => $value) {
$data[$value] = modules_get_agentmodule_data(
$value,
$content['period'],
$report['datetime']
);
}
$return['chart'] = $data;
break;
} }
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
@ -7560,10 +7585,19 @@ function reporting_custom_graph(
$content['name'] = __('Simple graph'); $content['name'] = __('Simple graph');
} }
$id_agent = agents_get_module_id( $module_source = db_get_all_rows_sql(
$content['id_agent_module'] 'SELECT id_agent_module
FROM tgraph_source
WHERE id_graph = '.$content['id_gs']
); );
$id_agent_module = $content['id_agent_module'];
if (isset($module_source) && is_array($module_source)) {
$modules = [];
foreach ($module_source as $key => $value) {
$modules[$key] = $value['id_agent_module'];
}
}
$agent_description = agents_get_description($id_agent); $agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent); $agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent); $agent_address = agents_get_address($id_agent);
@ -7593,7 +7627,6 @@ function reporting_custom_graph(
switch ($type) { switch ($type) {
case 'dinamic': case 'dinamic':
case 'static': case 'static':
case 'data':
$params = [ $params = [
'period' => $content['period'], 'period' => $content['period'],
'width' => $width, 'width' => $width,
@ -7624,6 +7657,19 @@ function reporting_custom_graph(
); );
break; break;
case 'data':
$data = [];
foreach ($modules as $key => $value) {
$data[$value] = modules_get_agentmodule_data(
$value,
$content['period'],
$report['datetime']
);
}
$return['chart'] = $data;
break;
} }
if ($type_report == 'custom_graph') { if ($type_report == 'custom_graph') {