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
39c73698e7
commit
92a469487e
|
@ -671,6 +671,20 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) {
|
|||
if ($data["total_agents"] > 0)
|
||||
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'>";
|
||||
|
||||
//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 "</a>";
|
||||
|
||||
|
|
|
@ -868,7 +868,24 @@ function reporting_get_group_stats ($id_group = 0) {
|
|||
|
||||
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"]) {
|
||||
case "mysql":
|
||||
$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(*)
|
||||
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)
|
||||
FROM tagente_estado, tagente, tagente_modulo
|
||||
|
|
Loading…
Reference in New Issue