diff --git a/include/class.report.php b/include/class.report.php index d65fd1cc5a63fac47ff221763c104f148fc71c5d..0601123047c04926f9ed0969a1eb09fdfd969fab 100644 --- a/include/class.report.php +++ b/include/class.report.php @@ -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)); diff --git a/include/class.staff.php b/include/class.staff.php index 5fa5293882b95973f7ed6330712b938dbfd99934..f5b08616d3e5c46cf33ed3b10293ab0c116e3b92 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -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 diff --git a/include/class.topic.php b/include/class.topic.php index fd865acf9e8621e0599ae6a69d4b780c1816ee64..39a03d4df76b5bf30b242b5685e5227fe7ece2d3 100644 --- a/include/class.topic.php +++ b/include/class.topic.php @@ -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']))