From ccb68ea839aa2781843e29b35a8cf7f090edf994 Mon Sep 17 00:00:00 2001
From: aydreeihn <adriane@enhancesoft.com>
Date: Fri, 16 Jun 2017 09:38:43 -0500
Subject: [PATCH] Make sure you cannot reopen tickets with archived Help
 Topics. Change radio buttons to Dropdown for status.

---
 include/class.ticket.php                           | 3 ++-
 include/i18n/en_US/help/tips/manage.helptopic.yaml | 2 +-
 include/i18n/en_US/help/tips/staff.department.yaml | 5 +++++
 include/staff/department.inc.php                   | 9 ++++++---
 include/staff/helptopic.inc.php                    | 8 +++++---
 5 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 3b4920f71..00d08bd08 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -298,7 +298,8 @@ implements RestrictedAccess, Threadable {
 
     function isReopenable() {
         return ($this->getStatus()->isReopenable()
-          && $this->getDept()->allowsReopen());
+          && $this->getDept()->allowsReopen()
+        && $this->getTopic()->allowsReopen());
     }
 
     function isClosed() {
diff --git a/include/i18n/en_US/help/tips/manage.helptopic.yaml b/include/i18n/en_US/help/tips/manage.helptopic.yaml
index 0297f1cee..e13ae5eaf 100644
--- a/include/i18n/en_US/help/tips/manage.helptopic.yaml
+++ b/include/i18n/en_US/help/tips/manage.helptopic.yaml
@@ -27,7 +27,7 @@ topic:
 status:
     title: Status
     content: >
-        If disabled, this <span class="doc-desc-title">Help Topic</span>
+        If disabled or archived, this <span class="doc-desc-title">Help Topic</span>
         will not be available.
 
 type:
diff --git a/include/i18n/en_US/help/tips/staff.department.yaml b/include/i18n/en_US/help/tips/staff.department.yaml
index 015c9b122..96ff9e16b 100644
--- a/include/i18n/en_US/help/tips/staff.department.yaml
+++ b/include/i18n/en_US/help/tips/staff.department.yaml
@@ -13,6 +13,11 @@
 # must match the HTML #ids put into the page template.
 #
 ---
+status:
+    title: Status
+    content: >
+        If disabled or archived, this <span class="doc-desc-title">Department</span>
+        will not be available.
 type:
     title: Type
     content: >
diff --git a/include/staff/department.inc.php b/include/staff/department.inc.php
index 19364945b..ed0297422 100644
--- a/include/staff/department.inc.php
+++ b/include/staff/department.inc.php
@@ -98,9 +98,12 @@ $info = Format::htmlchars(($errors && $_POST) ? $_POST : $info);
                 <?php echo __('Status');?>:
             </td>
             <td>
-                <input type="radio" name="status" value="Active" <?php echo $info['status'] == 'Active'?'checked="checked"':''; ?>> <?php echo __('Active'); ?>
-                <input type="radio" name="status" value="Disabled" <?php echo $info['status'] == 'Disabled'?'checked="checked"':''; ?>> <?php echo __('Disabled'); ?>
-                <input type="radio" name="status" value="Archived" <?php echo $info['status'] == 'Archived'?'checked="checked"':''; ?>> <?php echo __('Archived'); ?>
+                <select name="status">
+                  <option value="Active"<?php echo ($info['status'] == __('Active'))?'selected="selected"':'';?>><?php echo __('Active'); ?></option>
+                  <option value="Disabled"<?php echo ($info['status'] == __('Disabled'))?'selected="selected"':'';?>><?php echo __('Disabled'); ?></option>
+                  <option value="Archived"<?php echo ($info['status'] == __('Archived'))?'selected="selected"':'';?>><?php echo __('Archived'); ?></option>
+                </select>
+                &nbsp;<span class="error">&nbsp;</span> <i class="help-tip icon-question-sign" href="#status"></i>
             </td>
         </tr>
         <tr>
diff --git a/include/staff/helptopic.inc.php b/include/staff/helptopic.inc.php
index 15a7cb217..b67836669 100644
--- a/include/staff/helptopic.inc.php
+++ b/include/staff/helptopic.inc.php
@@ -60,9 +60,11 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                 <?php echo __('Status');?>:
             </td>
             <td>
-                <input type="radio" name="status" value="Active" <?php echo $info['status'] == 'Active'?'checked="checked"':''; ?>> <?php echo __('Active'); ?>
-                <input type="radio" name="status" value="Disabled" <?php echo $info['status'] == 'Disabled'?'checked="checked"':''; ?>> <?php echo __('Disabled'); ?>
-                <input type="radio" name="status" value="Archived" <?php echo $info['status'] == 'Archived'?'checked="checked"':''; ?>> <?php echo __('Archived'); ?>
+                <select name="status">
+                  <option value="Active"<?php echo ($info['status'] == __('Active'))?'selected="selected"':'';?>><?php echo __('Active'); ?></option>
+                  <option value="Disabled"<?php echo ($info['status'] == __('Disabled'))?'selected="selected"':'';?>><?php echo __('Disabled'); ?></option>
+                  <option value="Archived"<?php echo ($info['status'] == __('Archived'))?'selected="selected"':'';?>><?php echo __('Archived'); ?></option>
+                </select>
                 &nbsp;<span class="error">*&nbsp;</span> <i class="help-tip icon-question-sign" href="#status"></i>
             </td>
         </tr>
-- 
GitLab