From c6843787e90e871358a753141ef9207404d61b05 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 25 Jun 2014 09:07:41 -0400 Subject: [PATCH] Now the ticket export honors the database --- admin/export.php | 82 +++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 54 deletions(-) diff --git a/admin/export.php b/admin/export.php index a32cec47..3644aac6 100644 --- a/admin/export.php +++ b/admin/export.php @@ -242,14 +242,13 @@ $fid = 1; require(HESK_PATH . 'inc/assignment_search.inc.php'); // --> TICKET STATUS -$possible_status = array( -0 => 'NEW', -1 => 'WAITING REPLY', -2 => 'REPLIED', -3 => 'RESOLVED (CLOSED)', -4 => 'IN PROGRESS', -5 => 'ON HOLD', -); +$possibleStatusSql = 'SELECT `ID`, `ShortNameContentKey` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`'; +$possibleStatusRS = hesk_dbQuery($possibleStatusSql); +$possible_status = array(); +while ($row = $possibleStatusRS->fetch_assoc()) +{ + $possible_status[$row['ID']] = $hesklang[$row['ShortNameContentKey']]; +} $status = $possible_status; @@ -262,10 +261,13 @@ foreach ($status as $k => $v) } // How many statuses are we pulling out of the database? +$allStatusCountSql = 'SELECT COUNT(*) AS `Count` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`'; +$allStatusCountRow = hesk_dbQuery($allStatusCountSql)->fetch_assoc(); +$allStatusCount = $allStatusCountRow['Count']; $tmp = count($status); // Do we need to search by status? -if ( $tmp < 6 ) +if ( $tmp < $allStatusCount ) { // If no statuses selected, show all if ($tmp == 0) @@ -498,27 +500,9 @@ if (isset($_GET['w'])) $result = hesk_dbQuery($sql); while ($ticket=hesk_dbFetchAssoc($result)) { - - 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']; - } + $statusContentKeySql = 'SELECT `ShortNameContentKey` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `ID` = '.$ticket['status']; + $statusContentKeyRow = hesk_dbQuery($statusContentKeySql)->fetch_assoc(); + $ticket['status'] = $hesklang[$statusContentKeyRow['ShortNameContentKey']]; switch ($ticket['priority']) { @@ -787,30 +771,20 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
+ fetch_assoc()) + { + ?> +
+
+ +
+
+