From 830ee556a5ec75d1560c5924685c2c351e4ad70c Mon Sep 17 00:00:00 2001 From: aydreeihn <adriane@enhancesoft.com> Date: Wed, 28 Mar 2018 10:09:48 -0500 Subject: [PATCH] make sure dashboard stats dont include deleted topics/agents --- include/class.report.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/class.report.php b/include/class.report.php index 999ae22fe..5e1ac94b9 100644 --- a/include/class.report.php +++ b/include/class.report.php @@ -211,9 +211,10 @@ class OverviewReport { $headers = array(__('Help Topic')); $header = function($row) { return Topic::getLocalNameById($row['topic_id'], $row['topic__topic']); }; $pk = 'topic_id'; + $topics = Topic::getHelpTopics(); $stats = $stats ->values('topic_id', 'topic__topic', 'topic__flags') - ->filter(array('dept_id__in' => $thisstaff->getDepts(), 'topic_id__gt' => 0)); + ->filter(array('dept_id__in' => $thisstaff->getDepts(), 'topic_id__gt' => 0, 'topic_id__in' => array_keys($topics))); $times = $times ->values('topic_id') ->filter(array('topic_id__gt' => 0)); @@ -223,7 +224,10 @@ class OverviewReport { $header = function($row) { return new AgentsName(array( 'first' => $row['staff__firstname'], 'last' => $row['staff__lastname'])); }; $pk = 'staff_id'; - $stats = $stats->values('staff_id', 'staff__firstname', 'staff__lastname'); + $staff = Staff::getStaffMembers(); + $stats = $stats + ->values('staff_id', 'staff__firstname', 'staff__lastname') + ->filter(array('staff_id__in' => array_keys($staff))); $times = $times->values('staff_id'); $depts = $thisstaff->getManagedDepartments(); if ($thisstaff->hasPerm(ReportModel::PERM_AGENTS)) -- GitLab