Merge branch 'ent-12696-usuario-de-con-permisos-de-grupo-ve-todas-las-paradas-planificadas-en-la-vista-tactica' into 'develop'

Ent 12696 usuario de con permisos de grupo ve todas las paradas planificadas en la vista tactica

See merge request artica/pandorafms!6852
This commit is contained in:
Rafael Ameijeiras 2024-01-18 12:53:02 +00:00
commit edc5354c21
3 changed files with 14 additions and 7 deletions

View File

@ -436,12 +436,16 @@ class Agents extends Element
$percentages = [];
$total = array_sum($data);
foreach ($data as $key => $value) {
$percentage = (($value / $total) * 100);
if ($percentage < 1 && $percentage > 0) {
$percentage = 1;
}
if ($total > 0) {
$percentage = (($value / $total) * 100);
if ($percentage < 1 && $percentage > 0) {
$percentage = 1;
}
$percentages[$key] = format_numeric($percentage, 0);
$percentages[$key] = format_numeric($percentage, 0);
} else {
$percentages[$key] = '0%';
}
}
$data = $percentages;

View File

@ -113,8 +113,9 @@ class Groups extends Element
$id_groups = implode(',', $id_groups);
$modules = modules_get_modules_in_group($id_groups);
$total_groups = count($modules);
$total_groups = ($modules !== false) ? count($modules) : 0;
if ($total_groups === 0) {
include_once $config['homedir'].'/include/functions_graph.php';
return graph_nodata_image(['width' => '400']);
}

View File

@ -156,13 +156,15 @@ class ScheduledDowntime extends Element
'cron_interval_from',
'cron_interval_to',
];
$groups = implode(',', array_keys(users_get_groups($config['user'])));
$columns_str = implode(',', $columns);
$sql = sprintf(
'SELECT %s
FROM tplanned_downtime
WHERE id_group IN (%s)
%s %s',
$columns_str,
$groups,
$order,
$pagination,
);