+
+fetch_assoc())
+ {
+ //-- If the status is marked for deletion, delete it and skip everything below.
+ if (isset($_POST['s'.$row['ID'].'_delete']))
+ {
+ $delete = "DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($delete);
+ $stmt->bind_param('i', $row['ID']);
+ $stmt->execute();
+ $wasStatusDeleted = true;
+ } else
+ {
+ //-- Update the information in the database with what is on the page
+ $query = "UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `Key` = ?, `TextColor` = ?, `IsClosed` = ?, `Closable` = ? WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($query);
+ $isStatusClosed = (isset($_POST['s'.$row['ID'].'_isClosed']) ? 1 : 0);
+ $stmt->bind_param('sssisi', $_POST['s'.$row['ID'].'_key'], $_POST['s'.$row['ID'].'_textColor'], $isStatusClosed, $_POST['s'.$row['ID'].'_closable'], $row['ID']);
+ $stmt->execute();
+ }
+ }
+
+ //-- If any statuses were deleted, re-index them before adding a new one
+ if ($wasStatusDeleted) {
+ //-- First drop and re-add the ID column
+ hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` DROP COLUMN `ID`");
+ hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ADD `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST");
+
+ //-- Since statuses should be zero-based, but are now one-based, subtract one from each ID
+ hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `ID` = `ID`-1");
+ }
+
+ //-- Insert the addition if there is anything to add
+ if ($_POST['sN_key'] != null && $_POST['sN_textColor'] != null)
+ {
+ //-- The next ID is equal to the number of rows, since the IDs are zero-indexed.
+ $nextValue = hesk_dbQuery('SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`')->num_rows;
+ $isClosed = isset($_POST['sN_isClosed']) ? 1 : 0;
+ $insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`ID`, `Key`, `TextColor`, `IsClosed`, `Closable`)
+ VALUES (".$nextValue.", '".hesk_dbEscape($_POST['sN_key'])."', '".hesk_dbEscape($_POST['sN_textColor'])."', ".$isClosed.", '".hesk_dbEscape($_POST['sN_closable'])."')";
+ hesk_dbQuery($insert);
+ }
+
+ //-- Update default status for actions
+ $defaultQuery = "UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET ";
+
+ hesk_dbConnect()->query($defaultQuery . "`IsNewTicketStatus` = 0");
+ $updateQuery = $defaultQuery . "`IsNewTicketStatus` = 1 WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($updateQuery);
+ $stmt->bind_param('i', $_POST['newTicket']);
+ $stmt->execute();
+
+
+ hesk_dbConnect()->query($defaultQuery . "`IsClosedByClient` = 0");
+ $updateQuery = $defaultQuery . "`IsClosedByClient` = 1 WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($updateQuery);
+ $stmt->bind_param('i', $_POST['closedByClient']);
+ $stmt->execute();
+
+ hesk_dbConnect()->query($defaultQuery . "`IsCustomerReplyStatus` = 0");
+ $updateQuery = $defaultQuery . "`IsCustomerReplyStatus` = 1 WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($updateQuery);
+ $stmt->bind_param('i', $_POST['replyFromClient']);
+ $stmt->execute();
+
+ hesk_dbConnect()->query($defaultQuery . "`IsStaffClosedOption` = 0");
+ $updateQuery = $defaultQuery . "`IsStaffClosedOption` = 1 WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($updateQuery);
+ $stmt->bind_param('i', $_POST['staffClosedOption']);
+ $stmt->execute();
+
+ hesk_dbConnect()->query($defaultQuery . "`IsStaffReopenedStatus` = 0");
+ $updateQuery = $defaultQuery . "`IsStaffReopenedStatus` = 1 WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($updateQuery);
+ $stmt->bind_param('i', $_POST['staffReopenedStatus']);
+ $stmt->execute();
+
+ hesk_dbConnect()->query($defaultQuery . "`IsDefaultStaffReplyStatus` = 0");
+ $updateQuery = $defaultQuery . "`IsDefaultStaffReplyStatus` = 1 WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($updateQuery);
+ $stmt->bind_param('i', $_POST['defaultStaffReplyStatus']);
+ $stmt->execute();
+
+ hesk_dbConnect()->query($defaultQuery . "`LockedTicketStatus` = 0");
+ $updateQuery = $defaultQuery . "`LockedTicketStatus` = 1 WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($updateQuery);
+ $stmt->bind_param('i', $_POST['lockedTicketStatus']);
+ $stmt->execute();
+
+ hesk_dbConnect()->query($defaultQuery . "`IsAutocloseOption` = 0");
+ $updateQuery = $defaultQuery . "`IsAutocloseOption` = 1 WHERE `ID` = ?";
+ $stmt = hesk_dbConnect()->prepare($updateQuery);
+ $stmt->bind_param('i', $_POST['autocloseTicketOption']);
+ $stmt->execute();
+
+ hesk_process_messages($hesklang['statuses_saved'],'manage_statuses.php','SUCCESS');
+}
\ No newline at end of file
diff --git a/inc/email_functions.inc.php b/inc/email_functions.inc.php
index 35f36d77..1aa7597f 100644
--- a/inc/email_functions.inc.php
+++ b/inc/email_functions.inc.php
@@ -608,9 +608,9 @@ function hesk_getEmailSubject($eml_file, $ticket='', $is_ticket=1, $strip=0)
}
/* Set status */
- $statusRs = hesk_dbQuery("SELECT `ShortNameContentKey` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `ID` = ".$ticket['status']);
+ $statusRs = hesk_dbQuery("SELECT `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `ID` = ".$ticket['status']);
$row = hesk_dbFetchAssoc($statusRs);
- $ticket['status'] = $hesklang[$row['ShortNameContentKey']];
+ $ticket['status'] = $hesklang[$row['Key']];
/* Replace all special tags */
$msg = str_replace('%%SUBJECT%%', $ticket['subject'], $msg);
@@ -778,9 +778,9 @@ function hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message
$ticket['owner'] = hesk_msgToPlain( hesk_getOwnerName($ticket['owner']), 1);
/* Set status */
- $statusRs = hesk_dbQuery("SELECT `ShortNameContentKey` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `ID` = ".$ticket['status']);
+ $statusRs = hesk_dbQuery("SELECT `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `ID` = ".$ticket['status']);
$row = hesk_dbFetchAssoc($statusRs);
- $ticket['status'] = $hesklang[$row['ShortNameContentKey']];
+ $ticket['status'] = $hesklang[$row['Key']];
/* Replace all special tags */
$msg = str_replace('%%NAME%%', $ticket['name'] ,$msg);
diff --git a/inc/show_search_form.inc.php b/inc/show_search_form.inc.php
index d775550a..16499df6 100644
--- a/inc/show_search_form.inc.php
+++ b/inc/show_search_form.inc.php
@@ -38,10 +38,10 @@ if ( ! isset($status) )
{
$status = array();
//-- We don't want to check statuses that are considered "closed"
- $statusRS = hesk_dbQuery('SELECT `ID`, `ShortNameContentKey` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 0');
+ $statusRS = hesk_dbQuery('SELECT `ID`, `Key` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 0');
while ($row = $statusRS->fetch_assoc())
{
- $status[$row['ID']] = $row['ShortNameContentKey'];
+ $status[$row['ID']] = $row['Key'];
}
}
@@ -131,7 +131,7 @@ $more2 = empty($_GET['more2']) ? 0 : 1;
fetch_assoc())
{
if ($rowCounter > 3)
@@ -149,7 +149,7 @@ $more2 = empty($_GET['more2']) ? 0 : 1;
}
echo '';
+ echo '/> '.$hesklang[$row['Key']].'';
$rowCounter++;
}
diff --git a/inc/ticket_list.inc.php b/inc/ticket_list.inc.php
index d24cea03..04f4030e 100644
--- a/inc/ticket_list.inc.php
+++ b/inc/ticket_list.inc.php
@@ -386,8 +386,8 @@ if ($total > 0)
// Print ticket status
if ( hesk_show_column('status') )
{
- $statusName = hesk_dbFetchAssoc(hesk_dbQuery("SELECT `ShortNameContentKey`, `TextColor` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE ID = ".$ticket['status']));
- $ticket['status']=''.$hesklang[$statusName['ShortNameContentKey']].'';
+ $statusName = hesk_dbFetchAssoc(hesk_dbQuery("SELECT `Key`, `TextColor` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE ID = ".$ticket['status']));
+ $ticket['status']=''.$hesklang[$statusName['Key']].'';
echo '
'.$ticket['status'].'
';
}
diff --git a/index.php b/index.php
index f36dc325..d73403d1 100644
--- a/index.php
+++ b/index.php
@@ -1194,11 +1194,11 @@ function forgot_tid()
}
/* Prepare ticket statuses */
- $myStatusSQL = hesk_dbQuery("SELECT `ID`, `TicketViewContentKey` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`");
+ $myStatusSQL = hesk_dbQuery("SELECT `ID`, `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`");
$my_status = array();
while ($myStatusRow = hesk_dbFetchAssoc($myStatusSQL))
{
- $my_status[$myStatusRow['ID']] = $hesklang[$myStatusRow['TicketViewContentKey']];
+ $my_status[$myStatusRow['ID']] = $hesklang[$myStatusRow['Key']];
}
// Get tickets from the database
diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php
index ce61e4a9..059f1264 100644
--- a/install/mods-for-hesk/sql/installSql.php
+++ b/install/mods-for-hesk/sql/installSql.php
@@ -444,6 +444,10 @@ function execute230Scripts() {
hesk_dbConnect();
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` ADD COLUMN `icon` VARCHAR(150)");
+ executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ADD COLUMN `Key` TEXT");
+ executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `Key` = `ShortNameContentKey`");
+ executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` DROP COLUMN `ShortNameContentKey`");
+ executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` DROP COLUMN `TicketViewContentKey`");
executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.3.0' WHERE `Key` = 'modsForHeskVersion'");
}
// END Version 2.3.0
\ No newline at end of file
diff --git a/language/en/text.php b/language/en/text.php
index cff0606c..6dd8e9ab 100644
--- a/language/en/text.php
+++ b/language/en/text.php
@@ -29,6 +29,10 @@ $hesklang['sm_search_icon'] = 'Search Icon';
$hesklang['sm_iconpicker_footer_label'] = '{0} - {1} of {2}'; // {0}: lower bound of page, {1}: upper bound of page, {2}: total number of icons
$hesklang['mods_for_hesk_acronym'] = 'MFH'; // THIS SHOULD NOT BE TRANSLATED
$hesklang['added_in_mods_for_hesk'] = 'Added in Mods for HESK';
+$hesklang['statuses_intro'] = 'Here you can add, remove, and modify ticket statuses, as well as changing the default status for particular actions.';
+$hesklang['statuses_saved'] = 'Ticket statuses have been updated!';
+$hesklang['language_key'] = 'Language Key';
+$hesklang['language_key_description'] = 'This is the language file \'key\' that contains the text you want to display';
// ADDED OR MODIFIED IN Mods for HESK 2.2.1
$hesklang['popart_no_colon']='Top Knowledgebase Articles'; // same as $hesklang['popart'] but without a colon (:)
@@ -226,10 +230,6 @@ $hesklang['changeLanguage'] = 'Change language to';
// ADDED OR MODIFIED IN Mods For HESK 1.2
$hesklang['statuses'] = 'Statuses';
$hesklang['basicProperties'] = 'Basic Properties';
-$hesklang['shortNameKey'] = 'Short Name Key';
-$hesklang['shortNameKeyDescr'] = "This is the language file 'key' that contains the text you want to display on all pages that have statuses, except for the ticket view pages (ticket.php, admin_ticket.php, and print.php)";
-$hesklang['longNameKey'] = 'Long Name Key';
-$hesklang['longNameKeyDescr'] = "This is the language file 'key' that contains the text you want to display on ticket.php, print.php, and admin_ticket.php";
$hesklang['textColor'] = 'Text Color';
$hesklang['textColorDescr'] = 'This is the hex color code for the status that will be used on the ticket search page and export search page';
$hesklang['closedQuestionMark'] = 'Closed?';
diff --git a/print.php b/print.php
index d4d26795..05ee7bcc 100644
--- a/print.php
+++ b/print.php
@@ -60,7 +60,7 @@ if ( empty($_SESSION['id']) )
}
/* Get ticket info */
-$res = hesk_dbQuery("SELECT `t1`.* , `ticketStatus`.`IsClosed` AS `isClosed`, `ticketStatus`.`TicketViewContentKey` AS `statusKey`, `t2`.name AS `repliername`
+$res = hesk_dbQuery("SELECT `t1`.* , `ticketStatus`.`IsClosed` AS `isClosed`, `ticketStatus`.`Key` AS `statusKey`, `t2`.name AS `repliername`
FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` AS `t1` LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."users` AS `t2` ON `t1`.`replierid` = `t2`.`id`
INNER JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` AS `ticketStatus` ON `t1`.`status` = `ticketStatus`.`ID`
WHERE `trackid`='".hesk_dbEscape($trackingID)."' LIMIT 1");
diff --git a/ticket.php b/ticket.php
index 8c0668ae..24c94315 100644
--- a/ticket.php
+++ b/ticket.php
@@ -106,7 +106,7 @@ hesk_dbConnect();
hesk_limitBfAttempts();
/* Get ticket info */
-$res = hesk_dbQuery( "SELECT `t1`.* , `t2`.name AS `repliername`, `ticketStatus`.`IsClosed` AS `isClosed`, `ticketStatus`.`TicketViewContentKey` AS `statusKey` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` AS `t1` INNER JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` AS `ticketStatus` ON `t1`.`status` = `ticketStatus`.`ID` LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."users` AS `t2` ON `t1`.`replierid` = `t2`.`id` WHERE `trackid`='".hesk_dbEscape($trackingID)."' LIMIT 1");
+$res = hesk_dbQuery( "SELECT `t1`.* , `t2`.name AS `repliername`, `ticketStatus`.`IsClosed` AS `isClosed`, `ticketStatus`.`Key` AS `statusKey` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` AS `t1` INNER JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` AS `ticketStatus` ON `t1`.`status` = `ticketStatus`.`ID` LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."users` AS `t2` ON `t1`.`replierid` = `t2`.`id` WHERE `trackid`='".hesk_dbEscape($trackingID)."' LIMIT 1");
/* Ticket found? */
if (hesk_dbNumRows($res) != 1)
@@ -299,7 +299,7 @@ require_once(HESK_PATH . 'inc/header.inc.php');
$repliesColumnWidth = 3;
}
echo '