--- support.module	2009-06-19 16:48:03.000000000 +0200
+++ supportNew.module	2009-07-02 14:13:21.000000000 +0200
@@ -98,6 +98,18 @@ function support_menu() {
       );
     }
   }
+  $states = array('all' => 'all', 'all open' => 'all open', 'my open' => 'my open') + _support_states();
+  foreach ($states as $sid => $state) {
+    $items["support/all/$state"] = array(
+      'title' => "$state",
+      'page callback' => 'support_page',
+      'page arguments' => array("all", $state),
+      'access callback' => 'support_access_clients',
+      'access arguments' => array("all"),
+      'weight' => $sid,
+      'type' => $sid == 'all open' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
+    );
+  }
   $items['support/user/%user'] = array(
     'page callback' => 'support_page_user',
     'page arguments' => array(2),
@@ -1873,19 +1885,14 @@ function support_page($client = NULL, $s
     if (isset($_SESSION['support_client']) && $client = support_client_load($_SESSION['support_client'])) {
       drupal_goto("support/$client->path");
     }
-    $clients = _support_available_clients();
-    if (sizeof($clients)) {
-      foreach ($clients as $key => $name) {
-        $client = support_client_load($key);
-        drupal_goto("support/$client->path");
-      }
-    }
+	// changed to show all tickets by default 
+	$client = "all";
   }
   else {
     if (is_numeric($client)) {
       $_SESSION['support_client'] = $client;
     }
-    else {
+    elseif ($client != "all") {
       drupal_set_message(t('Client does not exist or is not enabled.'), 'error');
       if (isset($_SESSION['support_client'])) {
         unset($_SESSION['support_client']);
@@ -1926,13 +1933,21 @@ function support_page($client = NULL, $s
     $state = $state ? "AND t.state = $state" : '';
   }
 
-  $sql = "SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count, t.state, t.priority, t.assigned FROM {node} n LEFT JOIN {support_ticket} t ON n.nid = t.nid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid WHERE (c.status = ". COMMENT_PUBLISHED ." OR c.status IS NULL) AND n.status = 1 AND n.type = 'support_ticket' AND client = $client $state $my_open";
+  $sql = "SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count, t.state, t.priority, t.assigned FROM {node} n LEFT JOIN {support_ticket} t ON n.nid = t.nid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid WHERE (c.status = ". COMMENT_PUBLISHED ." OR c.status IS NULL) AND n.status = 1 AND n.type = 'support_ticket' ";
+  // Only filter on client if client is not all
+  if ($client != "all")
+	  $sql .= " AND client = $client ";
+  $sql .= " $state $my_open ";
   if (!user_access('view other users tickets') && !user_access('administer support') && !user_access('edit any ticket') && !user_access('delete any ticket')) {
     $sql .= " AND n.uid = $user->uid";
   }
   $sql = db_rewrite_sql($sql);
   $sql .= tablesort_sql($header);
-  $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) LEFT JOIN {support_ticket} t ON n.nid = t.nid WHERE n.status = 1 AND client = $client $state $my_open";
+  $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) LEFT JOIN {support_ticket} t ON n.nid = t.nid WHERE n.status = 1 ";
+  // Only filter on client if client is not all
+  if ($client != "all")
+  	$sql_count .= " AND client = $client ";
+  $sql_count .= " $state $my_open ";
   $sql_count = db_rewrite_sql($sql_count);
   $result = pager_query($sql, 50, 0, $sql_count);
   $rows = array();
