From 510046c51568f336556bce9d379f6d80630f8efb Mon Sep 17 00:00:00 2001
From: aydreeihn <adriane@enhancesoft.com>
Date: Tue, 17 Apr 2018 13:44:34 -0500
Subject: [PATCH] Fixes found while writing test cases:

- function isReopenable needed to check for topic
- getHelpTopics for inline edit needed to include name of disabled Topic if selected
- getHelpTopics for dashboard needed to include disabled/archived Topics
---
 include/class.report.php | 2 +-
 include/class.ticket.php | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/class.report.php b/include/class.report.php
index 5e1ac94b9..c39ec47cc 100644
--- a/include/class.report.php
+++ b/include/class.report.php
@@ -211,7 +211,7 @@ class OverviewReport {
             $headers = array(__('Help Topic'));
             $header = function($row) { return Topic::getLocalNameById($row['topic_id'], $row['topic__topic']); };
             $pk = 'topic_id';
-            $topics = Topic::getHelpTopics();
+            $topics = Topic::getHelpTopics(false, Topic::DISPLAY_DISABLED);
             $stats = $stats
                 ->values('topic_id', 'topic__topic', 'topic__flags')
                 ->filter(array('dept_id__in' => $thisstaff->getDepts(), 'topic_id__gt' => 0, 'topic_id__in' => array_keys($topics)));
diff --git a/include/class.ticket.php b/include/class.ticket.php
index a1147c2cb..cdf4f22e0 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -207,9 +207,8 @@ implements RestrictedAccess, Threadable, Searchable {
     }
 
     function isReopenable() {
-        return ($this->getStatus()->isReopenable()
-          && $this->getDept()->allowsReopen()
-        && $this->getTopic()->allowsReopen());
+        return ($this->getStatus()->isReopenable() && $this->getDept()->allowsReopen()
+        && ($this->getTopic() ? $this->getTopic()->allowsReopen() : null));
     }
 
     function isClosed() {
@@ -968,7 +967,7 @@ implements RestrictedAccess, Threadable, Searchable {
                         'name' => "{$fid}_id",
                         'label' => __('Help Topic'),
                         'default' => $this->getTopicId(),
-                        'choices' => Topic::getHelpTopics()
+                        'choices' => Topic::getHelpTopics(false, Topic::DISPLAY_DISABLED)
                         ));
             break;
         case 'source':
-- 
GitLab