From f1fddeb01c8f77b4e8e2c232bc2b7a010fd9d7d3 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 24 Mar 2014 08:38:02 -0500
Subject: [PATCH] Deprecate 'show_related_tickets'

Client accounts now that the user is verified either via staff or the
client's email mailbox, there's a much lower risk to showing a verified user
other tickets and virtually no reason that an administrator should have to
turn the feature on.
---
 include/class.config.php                                  | 4 ----
 include/class.nav.php                                     | 2 +-
 include/client/header.inc.php                             | 4 ----
 include/client/tickets.inc.php                            | 2 +-
 include/staff/settings-tickets.inc.php                    | 7 -------
 include/upgrader/streams/core/f5692e24-4323a6a8.patch.sql | 3 +++
 tickets.php                                               | 2 +-
 7 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/include/class.config.php b/include/class.config.php
index 7d1a90136..5d9301cf8 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -296,10 +296,6 @@ class OsticketConfig extends Config {
         return $this->get('passwd_reset_period');
     }
 
-    function showRelatedTickets() {
-        return $this->get('show_related_tickets');
-    }
-
     function isHtmlThreadEnabled() {
         return $this->get('enable_html_thread');
     }
diff --git a/include/class.nav.php b/include/class.nav.php
index 4cdd222fc..50cfb3b1e 100644
--- a/include/class.nav.php
+++ b/include/class.nav.php
@@ -282,7 +282,7 @@ class UserNav {
 
             $navs['new']=array('desc'=>'Open&nbsp;New&nbsp;Ticket','href'=>'open.php','title'=>'');
             if($user && $user->isValid()) {
-                if(!$user->isGuest() && $cfg && $cfg->showRelatedTickets()) {
+                if(!$user->isGuest()) {
                     $navs['tickets']=array('desc'=>sprintf('Tickets&nbsp;(%d)',$user->getNumTickets()),
                                            'href'=>'tickets.php',
                                             'title'=>'Show all tickets');
diff --git a/include/client/header.inc.php b/include/client/header.inc.php
index 707c50241..7826f442f 100644
--- a/include/client/header.inc.php
+++ b/include/client/header.inc.php
@@ -48,11 +48,7 @@ header("Content-Type: text/html; charset=UTF-8\r\n");
                  echo Format::htmlchars($thisclient->getName()).'&nbsp;|';
                  ?>
                 <a href="<?php echo ROOT_PATH; ?>account.php">Profile</a> |
-                <?php
-                if($cfg->showRelatedTickets()) {?>
                 <a href="<?php echo ROOT_PATH; ?>tickets.php">Tickets <b>(<?php echo $thisclient->getNumTickets(); ?>)</b></a> -
-                <?php
-                } ?>
                 <a href="<?php echo ROOT_PATH; ?>logout.php?auth=<?php echo $ost->getLinkToken(); ?>">Log Out</a>
              <?php
              }elseif($nav){ ?>
diff --git a/include/client/tickets.inc.php b/include/client/tickets.inc.php
index 1c227ba4c..b355e2265 100644
--- a/include/client/tickets.inc.php
+++ b/include/client/tickets.inc.php
@@ -1,5 +1,5 @@
 <?php
-if(!defined('OSTCLIENTINC') || !is_object($thisclient) || !$thisclient->isValid() || !$cfg->showRelatedTickets()) die('Access Denied');
+if(!defined('OSTCLIENTINC') || !is_object($thisclient) || !$thisclient->isValid()) die('Access Denied');
 
 $qstr='&'; //Query string collector
 $status=null;
diff --git a/include/staff/settings-tickets.inc.php b/include/staff/settings-tickets.inc.php
index c3d204328..796ffcdd1 100644
--- a/include/staff/settings-tickets.inc.php
+++ b/include/staff/settings-tickets.inc.php
@@ -76,13 +76,6 @@ if(!($maxfileuploads=ini_get('max_file_uploads')))
                 <em>(Minutes to lock a ticket on activity - enter 0 to disable locking)</em>
             </td>
         </tr>
-        <tr>
-            <td width="180">Show Related Tickets:</td>
-            <td>
-                <input type="checkbox" name="show_related_tickets" value="1" <?php echo $config['show_related_tickets'] ?'checked="checked"':''; ?> >
-                <em>(Show all related tickets on user login - otherwise access is restricted to one ticket view per login)</em>
-            </td>
-        </tr>
         <tr>
             <td>Human Verification:</td>
             <td>
diff --git a/include/upgrader/streams/core/f5692e24-4323a6a8.patch.sql b/include/upgrader/streams/core/f5692e24-4323a6a8.patch.sql
index 0a31b1a0e..aa672ccc9 100644
--- a/include/upgrader/streams/core/f5692e24-4323a6a8.patch.sql
+++ b/include/upgrader/streams/core/f5692e24-4323a6a8.patch.sql
@@ -85,6 +85,9 @@ CREATE TABLE `%TABLE_PREFIX%organization` (
   PRIMARY KEY (`id`)
 ) DEFAULT CHARSET=utf8;
 
+DELETE FROM `%TABLE_PREFIX%config` where `namespace`='core'
+    AND `key` = 'show_related_tickets';
+
 -- Finished with patch
 UPDATE `%TABLE_PREFIX%config`
     SET `value` = '4323a6a81c35efbf7722b7fc4e475440'
diff --git a/tickets.php b/tickets.php
index 158011983..35bf1a0cf 100644
--- a/tickets.php
+++ b/tickets.php
@@ -102,7 +102,7 @@ if($ticket && $ticket->checkUserAccess($thisclient)) {
     }
     else
         $inc='view.inc.php';
-} elseif($cfg->showRelatedTickets() && $thisclient->getNumTickets()) {
+} elseif($thisclient->getNumTickets()) {
     $inc='tickets.inc.php';
 } else {
     $nav->setActiveNav('new');
-- 
GitLab