diff --git a/.gitignore b/.gitignore index 39da1146..7b12609a 100644 --- a/.gitignore +++ b/.gitignore @@ -269,7 +269,6 @@ attachments img/ban.png img/banned.png img/ico_tools.png -inc/recaptcha/recaptchalib_v2.php ip_whois.php language/en/emails/reset_password.txt language/en/help_files/ticket_list.html diff --git a/admin/admin_main.php b/admin/admin_main.php index bad21451..111ed08a 100644 --- a/admin/admin_main.php +++ b/admin/admin_main.php @@ -40,8 +40,10 @@ if (is_dir(HESK_PATH . 'install')) {die('Please delete the install folder /* 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'); +require(HESK_PATH . 'inc/status_functions.inc.php'); hesk_load_database_functions(); hesk_session_start(); diff --git a/admin/admin_settings.php b/admin/admin_settings.php index 68a1df02..5e578079 100644 --- a/admin/admin_settings.php +++ b/admin/admin_settings.php @@ -860,7 +860,7 @@ if ( defined('HESK_DEMO') ) ?> -
+
+
+ +
+
+
+ '; + ?> +
+
diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php index e749b178..1f2bd635 100644 --- a/admin/admin_settings_save.php +++ b/admin/admin_settings_save.php @@ -517,6 +517,7 @@ $set['show_number_merged'] = empty($_POST['show_number_merged']) ? 0 : 1; $set['request_location'] = empty($_POST['request_location']) ? 0 : 1; $set['category_order_column'] = empty($_POST['category_order_column']) ? 'cat_order' : 'name'; $set['rich_text_for_tickets'] = empty($_POST['rich_text_for_tickets']) ? 0 : 1; +$set['statuses_order_column'] = empty($_POST['statuses_order_column']) ? 'sort' : 'name'; if ($set['customer-email-verification-required']) { @@ -588,7 +589,10 @@ $modsForHesk_settings[\'request_location\'] = '.$set['request_location'].'; $modsForHesk_settings[\'category_order_column\'] = \''.$set['category_order_column'].'\'; //-- Setting for using rich-text editor for tickets. 0 = Disable, 1 = Enable -$modsForHesk_settings[\'rich_text_for_tickets\'] = '.$set['rich_text_for_tickets'].';'; +$modsForHesk_settings[\'rich_text_for_tickets\'] = '.$set['rich_text_for_tickets'].'; + +//-- Column to sort statuses by. Can be either \'sort\' or \'name\' +$modsForHesk_settings[\'statuses_order_column\'] = \''.$set['statuses_order_column'].'\';'; // Write the file if ( ! file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $modsForHesk_file_content) ) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index ffeafc61..d6ebe0b4 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -41,6 +41,7 @@ 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'); +require(HESK_PATH . 'inc/status_functions.inc.php'); hesk_load_database_functions(); hesk_session_start(); @@ -678,9 +679,9 @@ if($ticket['email'] != '') { $recentTicketsWithStatuses = array(); foreach ($recentTickets as $recentTicket) { $newRecentTicket = $recentTicket; - $thisTicketStatusRS = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` WHERE `ID` = " . intval($recentTicket['status'])); + $thisTicketStatusRS = hesk_dbQuery("SELECT `ID`, `TextColor` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` WHERE `ID` = " . intval($recentTicket['status'])); $theStatusRow = hesk_dbFetchAssoc($thisTicketStatusRS); - $newRecentTicket['statusText'] = $hesklang[$theStatusRow['Key']]; + $newRecentTicket['statusText'] = mfh_getDisplayTextForStatusId($theStatusRow['ID']); $newRecentTicket['statusColor'] = $theStatusRow['TextColor']; array_push($recentTicketsWithStatuses, $newRecentTicket); } @@ -976,11 +977,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); fetch_assoc()) + while ($statusRow = hesk_dbFetchAssoc($statusRs)) { if ($statusRow['IsStaffReopenedStatus'] == 1) { @@ -1080,11 +1081,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); echo '

'.$hesklang['status'].'

'; $status_options = array(); - $results = hesk_dbQuery("SELECT `ID`, `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`"); - while ($row = $results->fetch_assoc()) + $results = mfh_getAllStatuses(); + foreach ($results as $row) { $selected = $ticket['status'] == $row['ID'] ? 'selected' : ''; - $status_options[$row['ID']] = ''; + $status_options[$row['ID']] = ''; } echo ' @@ -2024,11 +2025,6 @@ function hesk_printReplyForm() { } } - $statusSql = 'SELECT `ID` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsStaffClosedOption` = 1'; - $statusRow = hesk_dbQuery($statusSql)->fetch_assoc(); - $staffClosedOptionStatus = array(); - $staffClosedOptionStatus['ID'] = $statusRow['ID']; - ?>
diff --git a/admin/manage_statuses.php b/admin/manage_statuses.php index b69aee79..d7d50f5a 100644 --- a/admin/manage_statuses.php +++ b/admin/manage_statuses.php @@ -5,8 +5,10 @@ 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'); +require(HESK_PATH . 'inc/status_functions.inc.php'); hesk_load_database_functions(); hesk_session_start(); @@ -18,11 +20,14 @@ hesk_checkPermission('can_man_ticket_statuses'); define('WYSIWYG',1); // Are we performing an action? -if (isset($_POST['action'])) { - if ($_POST['action'] == 'save') { - save(); - } +if (isset($_REQUEST['a'])) { + if ($_POST['a'] == 'create') { createStatus(); } + elseif ($_POST['a'] == 'update') { updateStatus(); } + elseif ($_GET['a'] == 'delete') { deleteStatus(); } + elseif ($_GET['a'] == 'sort') { moveStatus(); } } + + /* Print header */ require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); @@ -77,361 +82,634 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); /* This will handle error, success and notice messages */ hesk_handle_messages(); - ?> -
-
-
-
+
+
+

+ + + + +

+
- - - - - - + + + + fetch_assoc()) - { - $checkedEcho = ($row['IsClosed'] == 1) ? 'checked="checked"' : ''; - $isDisabled = false; - if ($row['IsNewTicketStatus'] || $row['IsClosedByClient'] || $row['IsCustomerReplyStatus'] || - $row['IsStaffClosedOption'] || $row['IsStaffReopenedStatus'] || $row['IsDefaultStaffReplyStatus'] || - $row['LockedTicketStatus'] || $row['IsAutocloseOption']) - { - $isDisabled = true; - } - - $yesSelected = $customersOnlySelected = $staffOnlySelected = $noSelected = ''; - if ($row['Closable'] == 'yes') { $yesSelected = 'selected'; } - elseif ($row['Closable'] == 'conly') { $customersOnlySelected = 'selected'; } - elseif ($row['Closable'] == 'sonly') { $staffOnlySelected = 'selected'; } - else { $noSelected = 'selected'; } - - echo ''; - echo ''; //Name - echo ''; // Language File Key - echo ''; // Text Color - echo ''; - echo ''; // Resolved Status? - echo ''; //Delete status? - echo ''; - } - - //Print out an additional blank space for adding a status - echo ''; - echo ''; - echo ''; // Language File Key - echo ''; // Text Color - echo ''; - echo ''; // Resolved Status? - echo ''; //Empty placeholder where the delete row is. - echo ''; + $j = 1; + foreach ($statuses as $key => $row): ?> + + + + + + +
'.$hesklang[$row['Key']].' - - '; - if ($isDisabled) - { - echo ''; - } else - { - echo ''; - } - echo '
'.$hesklang['addNew'].' - -
+ + + + + '; + } + ?> + + + + + + + + +
-
-
-
- -
- +
+
+

-
-
- -
- +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
-
- -
- -
+
+ +
-
- -
- + +
+
+
+
+ + +