diff --git a/admin/manage_statuses.php b/admin/manage_statuses.php index 00963f41..de4a728d 100644 --- a/admin/manage_statuses.php +++ b/admin/manage_statuses.php @@ -5,6 +5,7 @@ define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); +require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); @@ -84,15 +85,18 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); $numOfStatusesRS = hesk_dbQuery('SELECT 1 FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`'); $numberOfStatuses = hesk_dbNumRows($numOfStatusesRS); - $statusesSql = 'SELECT `ID`, `IsAutocloseOption`, `TextColor`, `Closable`, `IsClosed` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` ORDER BY `sort` ASC'; - $closedStatusesSql = 'SELECT `ID`, `IsClosedByClient` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 1 ORDER BY `sort` ASC'; - $openStatusesSql = 'SELECT `ID`, `IsNewTicketStatus`, `IsStaffReopenedStatus`, `IsDefaultStaffReplyStatus` FROM - `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 0 ORDER BY `sort` ASC'; + $statusesSql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` ORDER BY `sort` ASC'; $statusesRS = hesk_dbQuery($statusesSql); $statuses = array(); while ($row = hesk_dbFetchAssoc($statusesRS)) { - array_push($statuses, $row); + $row['text'] = mfh_getDisplayTextForStatusId($row['ID']); + $statuses[$row['text']] = $row; } + + if ($modsForHesk_settings['statuses_order_column'] == 'name') { + ksort($statuses); + } + ?>
@@ -121,11 +125,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); $row): ?> - + fetch_assoc()) + foreach ($statuses as $key => $row) { + if ($row['IsClosed'] == 0) { + continue; + } + $selectedEcho = ($row['IsClosedByClient'] == 1) ? 'selected="selected"' : ''; echo ''; } @@ -205,9 +215,12 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
fetch_assoc()) + foreach ($statuses as $key => $row) { + if ($row['IsClosed'] == 0) { + continue; + } + $selectedEcho = ($row['IsStaffClosedOption'] == 1) ? 'selected="selected"' : ''; echo ''; } @@ -235,9 +251,12 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
fetch_assoc()) + foreach ($statuses as $key => $row) { + if ($row['IsClosed'] == 1) { + continue; + } + $selectedEcho = ($row['IsDefaultStaffReplyStatus'] == 1) ? 'selected="selected"' : ''; echo ''; } @@ -265,8 +287,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
fetch_assoc()) + foreach ($statuses as $key => $row) { + if ($row['IsClosed'] == 0) { + continue; + } + $selectedEcho = ($row['IsAutocloseOption'] == 1) ? 'selected' : ''; echo ''; } @@ -346,7 +370,11 @@ function buildConfirmDeleteModal($statusId) { } function echoArrows($index, $numberOfStatuses, $statusId) { - global $hesklang; + global $hesklang, $modsForHesk_settings; + + if ($modsForHesk_settings['statuses_order_column'] == 'name') { + return; + } if ($index !== 1) { // Display move up diff --git a/modsForHesk_settings.inc.php b/modsForHesk_settings.inc.php index 0c68bc26..0e7ea545 100644 --- a/modsForHesk_settings.inc.php +++ b/modsForHesk_settings.inc.php @@ -49,4 +49,7 @@ $modsForHesk_settings['show_number_merged'] = 1; $modsForHesk_settings['request_location'] = 0; //-- Column to sort categories by. Can be either 'name' or 'cat_order' -$modsForHesk_settings['category_order_column'] = 'cat_order'; \ No newline at end of file +$modsForHesk_settings['category_order_column'] = 'cat_order'; + +//-- Column to sort statuses by. Can be either 'sort' or 'name' +$modsForHesk_settings['statuses_order_column'] = 'sort'; \ No newline at end of file