diff --git a/.gitignore b/.gitignore
index 49494f83..c56ef81c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -193,7 +193,6 @@ inc/posting_functions.inc.php
inc/prepare_ticket_export.inc.php
inc/prepare_ticket_search.inc.php
inc/print_group.inc.php
-inc/print_tickets.inc.php
inc/recaptcha/LICENSE
inc/recaptcha/index.htm
inc/recaptcha/recaptchalib.php
diff --git a/inc/print_tickets.inc.php b/inc/print_tickets.inc.php
new file mode 100644
index 00000000..a28dcc24
--- /dev/null
+++ b/inc/print_tickets.inc.php
@@ -0,0 +1,160 @@
+0,2=>0);
+$s_my = array(1=>1,2=>1);
+$s_ot = array(1=>1,2=>1);
+$s_un = array(1=>1,2=>1);
+
+// --> TICKET CATEGORY
+$category = intval( hesk_GET('category', 0) );
+
+// Make sure user has access to this category
+if ($category && hesk_okCategory($category, 0) )
+{
+ $sql .= " `category`='{$category}' ";
+}
+// No category selected, show only allowed categories
+else
+{
+ $sql .= hesk_myCategories();
+}
+
+// Show only tagged tickets?
+if ( ! empty($_GET['archive']) )
+{
+ $archive[1]=1;
+ $sql .= " AND `archive`='1' ";
+}
+
+// Ticket owner preferences
+$fid = 1;
+require(HESK_PATH . 'inc/assignment_search.inc.php');
+
+// --> TICKET STATUS
+$statusSql = "SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`";
+$totalStatuses = 0;
+$possible_status = array();
+$results = hesk_dbQuery($statusSql);
+while ($row = $results->fetch_assoc())
+{
+ array_push($possible_status, $row['ID']);
+ $totalStatuses++;
+}
+$status = $possible_status;
+
+foreach ($status as $k => $v)
+{
+ if (empty($_GET['s'.$k]))
+ {
+ unset($status[$k]);
+ }
+}
+
+// How many statuses are we pulling out of the database?
+$tmp = count($status);
+
+// Do we need to search by status?
+if ( $tmp < $totalStatuses )
+{
+ // If no statuses selected, show default (all except RESOLVED)
+ if ($tmp == 0)
+ {
+ $status = $possible_status;
+ unset($status[3]);
+ }
+
+ // Add to the SQL
+ $sql .= " AND `status` IN ('" . implode("','", array_keys($status) ) . "') ";
+}
+
+// --> TICKET PRIORITY
+$possible_priority = array(
+0 => 'CRITICAL',
+1 => 'HIGH',
+2 => 'MEDIUM',
+3 => 'LOW',
+);
+
+$priority = $possible_priority;
+
+foreach ($priority as $k => $v)
+{
+ if (empty($_GET['p'.$k]))
+ {
+ unset($priority[$k]);
+ }
+}
+
+// How many priorities are we pulling out of the database?
+$tmp = count($priority);
+
+// Create the SQL based on the number of priorities we need
+if ($tmp == 0 || $tmp == 4)
+{
+ // Nothing or all selected, no need to modify the SQL code
+ $priority = $possible_priority;
+}
+else
+{
+ // A custom selection of priorities
+ $sql .= " AND `priority` IN ('" . implode("','", array_keys($priority) ) . "') ";
+}
+
+// That's all the SQL we need for count
+$sql_count .= $sql;
+$sql = $sql_final . $sql;
+
+// Prepare variables used in search and forms
+require(HESK_PATH . 'inc/prepare_ticket_search.inc.php');
+
+// List tickets?
+if (!isset($_SESSION['hide']['ticket_list']))
+{
+ $href = 'show_tickets.php';
+ require(HESK_PATH . 'inc/ticket_list.inc.php');
+}
diff --git a/inc/ticket_list.inc.php b/inc/ticket_list.inc.php
index 503e8e63..ac6e43e2 100644
--- a/inc/ticket_list.inc.php
+++ b/inc/ticket_list.inc.php
@@ -289,26 +289,8 @@ if ($total > 0)
$tagged = ' ';
}
- switch ($ticket['status'])
- {
- case 0:
- $ticket['status']=''.$hesklang['open'].'';
- break;
- case 1:
- $ticket['status']=''.$hesklang['wait_reply'].'';
- break;
- case 2:
- $ticket['status']=''.$hesklang['replied'].'';
- break;
- case 4:
- $ticket['status']=''.$hesklang['in_progress'].'';
- break;
- case 5:
- $ticket['status']=''.$hesklang['on_hold'].'';
- break;
- default:
- $ticket['status']=''.$hesklang['closed'].'';
- }
+ $status = hesk_dbFetchAssoc(hesk_dbQuery("SELECT `ShortNameContentKey`, `TextColor` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE ID = ".$ticket['status']));
+ $ticket['status']=''.$hesklang[$status['ShortNameContentKey']].'';
switch ($ticket['priority'])
{