mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
recursion taken in mind in group report
This commit is contained in:
parent
6b25ae6004
commit
5d69ca3126
@ -2972,7 +2972,11 @@ function reporting_group_report($report, $content)
|
|||||||
|
|
||||||
$return['data']['count_events'] = count($events);
|
$return['data']['count_events'] = count($events);
|
||||||
|
|
||||||
$return['data']['group_stats'] = reporting_get_group_stats($content['id_group']);
|
$return['data']['group_stats'] = reporting_get_group_stats(
|
||||||
|
$content['id_group'],
|
||||||
|
'AR',
|
||||||
|
(bool) $content['recursion']
|
||||||
|
);
|
||||||
|
|
||||||
if ($config['metaconsole']) {
|
if ($config['metaconsole']) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
@ -8969,7 +8973,7 @@ function reporting_get_agents_detailed_event(
|
|||||||
*
|
*
|
||||||
* @return array Group statistics
|
* @return array Group statistics
|
||||||
*/
|
*/
|
||||||
function reporting_get_group_stats($id_group=0, $access='AR')
|
function reporting_get_group_stats($id_group=0, $access='AR', $recursion=true)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -9071,16 +9075,19 @@ function reporting_get_group_stats($id_group=0, $access='AR')
|
|||||||
// Store the groups where we are quering
|
// Store the groups where we are quering
|
||||||
$covered_groups = [];
|
$covered_groups = [];
|
||||||
$group_array = [];
|
$group_array = [];
|
||||||
foreach ($id_group as $group) {
|
|
||||||
$children = groups_get_children($group);
|
|
||||||
|
|
||||||
// Show empty groups only if they have children with agents
|
foreach ($id_group as $group) {
|
||||||
// $group_array = array();
|
if ($recursion === true) {
|
||||||
foreach ($children as $sub) {
|
$children = groups_get_children($group);
|
||||||
// If the group is quering previously, we ingore it
|
|
||||||
if (!in_array($sub['id_grupo'], $covered_groups)) {
|
// Show empty groups only if they have children with agents
|
||||||
array_push($covered_groups, $sub['id_grupo']);
|
// $group_array = array();
|
||||||
array_push($group_array, $sub['id_grupo']);
|
foreach ($children as $sub) {
|
||||||
|
// If the group is quering previously, we ingore it
|
||||||
|
if (!in_array($sub['id_grupo'], $covered_groups)) {
|
||||||
|
array_push($covered_groups, $sub['id_grupo']);
|
||||||
|
array_push($group_array, $sub['id_grupo']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user