Merge branch '2354-Fallo-grafico-tarta-consola-visual' into 'develop'

Changed function that gets pie graphs module data to print no data to show message in such case

See merge request artica/pandorafms!1581
This commit is contained in:
slerena 2018-06-29 15:44:29 +02:00
commit 6da5736a4b
1 changed files with 13 additions and 1 deletions

View File

@ -2711,12 +2711,19 @@ function visual_map_process_wizard_add_modules ($id_modules, $image,
function get_donut_module_data ($id_module) {
$mod_values = db_get_value_filter('datos', 'tagente_estado', array('id_agente_modulo' => $id_module));
$no_data_to_show = false;
if (preg_match("/\r\n/", $mod_values)) {
$values = explode("\r\n", $mod_values);
}
elseif (preg_match("/\n/", $mod_values)) {
$values = explode("\n", $mod_values);
}
else {
$values=array(__('No data to show').",1");
$no_data_to_show=true;
}
$colors = array();
$colors[] = "#aa3333";
@ -2737,7 +2744,12 @@ function get_donut_module_data ($id_module) {
if ($data[1] == 0) {
$data[1] = __('No data');
}
$values_to_return[$index]['tag_name'] = $data[0] . ": " . $data[1];
if ($no_data_to_show)
$values_to_return[$index]['tag_name'] = $data[0];
else
$values_to_return[$index]['tag_name'] = $data[0] . ": " . $data[1];
$values_to_return[$index]['color'] = $colors[$index];
$values_to_return[$index]['value'] = (int)$data[1];
$total += (int)$data[1];