From 79cf812934af5d4663eb893d8dd1e5805dd626e8 Mon Sep 17 00:00:00 2001
From: Jared Hancock <gravydish@gmail.com>
Date: Mon, 18 Jun 2012 15:44:42 -0500
Subject: [PATCH] Show zero open tickets with a nice message

Rather than defaulting to either showing answered tickets or closed tickets
if there are no open tickets.
---
 include/staff/tickets.inc.php |  4 +++-
 scp/tickets.php               | 10 +---------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php
index bd4801c44..2c0118049 100644
--- a/include/staff/tickets.inc.php
+++ b/include/staff/tickets.inc.php
@@ -402,7 +402,7 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting..
             <?php
             } //end of while.
         else: //not tickets found!! set fetch error.
-            $ferror='Query returned 0 results.';  
+            $ferror='There are no tickets here. (Leave a little early today).';  
         endif; ?>
     </tbody>
     <tfoot>
@@ -414,7 +414,9 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting..
             <a href="#" onclick="return reset_all(document.forms['tickets'])">None</a>&nbsp;&nbsp;
             <a href="#" onclick="return toogle_all(document.forms['tickets'],true)">Toggle</a>&nbsp;&nbsp;
             <?php }else{
+                echo '<i>';
                 echo $ferror?Format::htmlchars($ferror):'Query returned 0 results.';
+                echo '</i>';
             } ?>
         </td>
      </tr>
diff --git a/scp/tickets.php b/scp/tickets.php
index 801fe2425..7cc7740bb 100644
--- a/scp/tickets.php
+++ b/scp/tickets.php
@@ -378,14 +378,6 @@ endif;
 /*... Quick stats ...*/
 $stats= $thisstaff->getTicketsStats();
 
-// Switch queues on the fly! depending on stats
-if(!$stats['open'] && $_REQUEST['a']!='search' && (!$_REQUEST['status'] || $_REQUEST['status']=='open')) {
-    if(!$cfg->showAnsweredTickets() && $stats['answered'])
-        $_REQUEST['status']= 'answered';
-    else
-        $_REQUEST['status']= 'closed';
-}
-
 //Navigation
 $nav->setTabActive('tickets');
 if($cfg->showAnsweredTickets()) {
@@ -396,7 +388,7 @@ if($cfg->showAnsweredTickets()) {
                         (!$_REQUEST['status'] || $_REQUEST['status']=='open'));
 } else {
 
-    if(!$stats || $stats['open']) {
+    if($stats) {
         $nav->addSubMenu(array('desc'=>'Open ('.$stats['open'].')',
                                'title'=>'Open Tickets',
                                'href'=>'tickets.php',
-- 
GitLab