Skip to content
Snippets Groups Projects
Commit cb57dbc5 authored by aydreeihn's avatar aydreeihn
Browse files

bug fixes v2

parent 3944b51d
No related branches found
No related tags found
No related merge requests found
......@@ -192,7 +192,7 @@ class OverviewReport {
$pk = 'dept_id';
$stats = $stats
->filter(array('dept_id__in' => $thisstaff->getDepts()))
->values('dept__id', 'dept__name');
->values('dept__id', 'dept__name', 'dept__flags');
$times = $times
->filter(array('dept_id__in' => $thisstaff->getDepts()))
->values('dept__id');
......@@ -202,7 +202,7 @@ class OverviewReport {
$header = function($row) { return Topic::getLocalNameById($row['topic_id'], $row['topic__topic']); };
$pk = 'topic_id';
$stats = $stats
->values('topic_id', 'topic__topic')
->values('topic_id', 'topic__topic', 'topic__flags')
->filter(array('topic_id__gt' => 0));
$times = $times
->values('topic_id')
......@@ -237,8 +237,25 @@ class OverviewReport {
$rows = array();
foreach ($stats as $R) {
if (isset($R['dept__flags'])) {
if ($R['dept__flags'] & Dept::FLAG_ARCHIVED)
$status = ' - '.__('Archived');
elseif ($R['dept__flags'] & Dept::FLAG_ACTIVE)
$status = '';
else
$status = ' - '.__('Disabled');
}
if (isset($R['topic__flags'])) {
if ($R['topic__flags'] & Topic::FLAG_ARCHIVED)
$status = ' - '.__('Archived');
elseif ($R['topic__flags'] & Topic::FLAG_ACTIVE)
$status = '';
else
$status = ' - '.__('Disabled');
}
$T = $timings[$R[$pk]];
$rows[] = array($header($R), $R['Opened'], $R['Assigned'],
$rows[] = array($header($R) . $status, $R['Opened'], $R['Assigned'],
$R['Overdue'], $R['Closed'], $R['Reopened'],
number_format($T['ServiceTime'], 1),
number_format($T['ResponseTime'], 1));
......
......@@ -1003,7 +1003,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
$errors['role_id']=__('Role for primary department is required');
$dept = Dept::lookup($vars['dept_id']);
if(!$dept->isActive())
if($dept && !$dept->isActive())
$errors['dept_id'] = sprintf(__('%s selected must be active'), __('Department'));
// Ensure we will still have an administrator with access
......
......@@ -418,7 +418,7 @@ implements TemplateVariable {
$errors['topic']=__('Topic already exists');
$dept = Dept::lookup($vars['dept_id']);
if(!$dept->isActive())
if($dept && !$dept->isActive())
$errors['dept_id'] = sprintf(__('%s selected must be active'), __('Department'));
if (!is_numeric($vars['dept_id']))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment