mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
2012-02-10 Dario Rodriguez <dario.rodriguez@artica.es>
* include/functions_reporting.php, include/functions_groups.php: Fixed a problem in Group View that hide empty parent groups when their children has agents. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5558 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b17519d2a0
commit
2ff05eb3b3
@ -671,6 +671,20 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) {
|
|||||||
if ($data["total_agents"] > 0)
|
if ($data["total_agents"] > 0)
|
||||||
echo "<a style='font-weight: bold; font-size: 18px; text-align: center;'
|
echo "<a style='font-weight: bold; font-size: 18px; text-align: center;'
|
||||||
href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$id_group'>";
|
href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$id_group'>";
|
||||||
|
|
||||||
|
//Total agent field given by function reporting_get_group_stats return the number of agents
|
||||||
|
//of this groups and its children. It was done to print empty fathers of children groups.
|
||||||
|
//We need to recalculate the total agents for this group here to get only the total agents
|
||||||
|
//for this group. Of course the group All (0) is a special case.
|
||||||
|
|
||||||
|
$data["total_agents"];
|
||||||
|
|
||||||
|
if($id_group != 0) {
|
||||||
|
|
||||||
|
$data["total_agents"] = db_get_sql ("SELECT COUNT(*) FROM tagente
|
||||||
|
WHERE id_grupo = $id_group AND disabled = 0");
|
||||||
|
}
|
||||||
|
|
||||||
echo $data["total_agents"];
|
echo $data["total_agents"];
|
||||||
echo "</a>";
|
echo "</a>";
|
||||||
|
|
||||||
|
@ -868,7 +868,24 @@ function reporting_get_group_stats ($id_group = 0) {
|
|||||||
|
|
||||||
foreach ($id_group as $group){
|
foreach ($id_group as $group){
|
||||||
|
|
||||||
|
$children = groups_get_childrens($group);
|
||||||
|
|
||||||
|
//Show empty groups only if they have children with agents
|
||||||
|
$group_array = array();
|
||||||
|
|
||||||
|
foreach($children as $sub) {
|
||||||
|
|
||||||
|
array_push($group_array, $sub['id_grupo']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add id of this group to create the clause
|
||||||
|
array_push($group_array, $group);
|
||||||
|
|
||||||
|
$group_clause = implode(",",$group_array);
|
||||||
|
|
||||||
|
$group_clause = "(".$group_clause.")";
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$data["agents_unknown"] += db_get_sql ("SELECT COUNT(*)
|
$data["agents_unknown"] += db_get_sql ("SELECT COUNT(*)
|
||||||
@ -888,7 +905,7 @@ function reporting_get_group_stats ($id_group = 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data["total_agents"] += db_get_sql ("SELECT COUNT(*)
|
$data["total_agents"] += db_get_sql ("SELECT COUNT(*)
|
||||||
FROM tagente WHERE id_grupo = $group AND disabled = 0");
|
FROM tagente WHERE id_grupo IN $group_clause AND disabled = 0");
|
||||||
|
|
||||||
$data["monitor_checks"] += db_get_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
$data["monitor_checks"] += db_get_sql ("SELECT COUNT(tagente_estado.id_agente_estado)
|
||||||
FROM tagente_estado, tagente, tagente_modulo
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user