From 62d19e255e10eb07bff48d5d145e4595b9dcbcad Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 9 Apr 2015 11:37:47 -0400 Subject: [PATCH] #157 Add closable setting to statuses Still need to enforce this though --- admin/admin_settings.php | 23 +++++++++++++++++++++++ admin/admin_settings_save.php | 6 +++--- install/mods-for-hesk/sql/installSql.php | 7 +++++-- language/en/text.php | 12 +++++++++++- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/admin/admin_settings.php b/admin/admin_settings.php index 1a171091..fe2f3165 100644 --- a/admin/admin_settings.php +++ b/admin/admin_settings.php @@ -2186,6 +2186,7 @@ if ( defined('HESK_DEMO') ) + @@ -2204,11 +2205,25 @@ if ( defined('HESK_DEMO') ) $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 ''.$hesklang[$row['ShortNameContentKey']].''; //Name echo ''; // Short Name Language File echo ''; // Long Name Language File echo ''; // Text Color + echo ' + + '; echo ''; // Resolved Status? echo ''; if ($isDisabled) @@ -2228,6 +2243,14 @@ if ( defined('HESK_DEMO') ) echo ''; // Short Name Language File echo ''; // Long Name Language File echo ''; // Text Color + echo ' + + '; echo ''; // Resolved Status? echo ''; //Empty placeholder where the delete row is. echo ''; diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php index 96615491..89e450ea 100644 --- a/admin/admin_settings_save.php +++ b/admin/admin_settings_save.php @@ -529,10 +529,10 @@ while ($row = $results->fetch_assoc()) } else { //-- Update the information in the database with what is on the page - $query = "UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `ShortNameContentKey` = ?, `TicketViewContentKey` = ?, `TextColor` = ?, `IsClosed` = ? WHERE `ID` = ?"; + $query = "UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `ShortNameContentKey` = ?, `TicketViewContentKey` = ?, `TextColor` = ?, `IsClosed` = ?, `Closable` = ? WHERE `ID` = ?"; $stmt = hesk_dbConnect()->prepare($query); $isStatusClosed = (isset($_POST['s'.$row['ID'].'_isClosed']) ? 1 : 0); - $stmt->bind_param('sssii', $_POST['s'.$row['ID'].'_shortName'], $_POST['s'.$row['ID'].'_longName'], $_POST['s'.$row['ID'].'_textColor'], $isStatusClosed, $row['ID']); + $stmt->bind_param('sssisi', $_POST['s'.$row['ID'].'_shortName'], $_POST['s'.$row['ID'].'_longName'], $_POST['s'.$row['ID'].'_textColor'], $isStatusClosed, $_POST['s'.$row['ID'].'_closable'], $row['ID']); $stmt->execute(); } } @@ -555,7 +555,7 @@ if ($_POST['sN_shortName'] != null && $_POST['sN_longName'] != null && $_POST['s $insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`ID`, `ShortNameContentKey`, `TicketViewContentKey`, `TextColor`, `IsClosed`) VALUES (?, ?, ?, ?, ?)"; $stmt = hesk_dbConnect()->prepare($insert); $isClosed = isset($_POST['sN_isClosed']) ? 1 : 0; - $stmt->bind_param('isssi', $nextValue, $_POST['sN_shortName'], $_POST['sN_longName'], $_POST['sN_textColor'], $isClosed); + $stmt->bind_param('isssis', $nextValue, $_POST['sN_shortName'], $_POST['sN_longName'], $_POST['sN_textColor'], $isClosed, $_POST['sN_closable']); $stmt->execute(); } diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 84fddf67..19415b83 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -381,7 +381,7 @@ function execute211Scripts() { } function execute211FileUpdate() { - //-- Add the boostrap theme property to modsForHesk_settings.inc.php + //-- Add the new kb article visibility property to modsForHesk_settings.inc.php $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); //-- Only add the additional settings if they aren't already there. @@ -402,5 +402,8 @@ function execute220Scripts() { global $hesk_settings; hesk_dbConnect(); + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ADD COLUMN `Closable` VARCHAR(10) NOT NULL"); + executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `Closable` = 'yes'"); executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.2.0' WHERE `Key` = 'modsForHeskVersion'"); -} \ No newline at end of file +} +// END Version 2.2.0 \ No newline at end of file diff --git a/language/en/text.php b/language/en/text.php index c08f7f67..d18be663 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -47,7 +47,17 @@ $hesklang['email_template_saved'] = 'The email template %s has been saved $hesklang['error_saving_template'] = 'An error occurred when trying to save the email template!'; $hesklang['can_man_email_tpl'] = 'Edit email templates'; $hesklang['email_template_directory_not_writable'] = 'The email template %s is not writable by HESK. Please CHMOD it to 0666.'; // %s: template file name - +$hesklang['closable_question'] = 'Closable?'; +$hesklang['closable_description'] = 'This setting is ignored if the "Closed?" checkbox is checked for this status. +

Determines if the customer staff is able to close a ticket in this status. +

Yes: Both customers and staff can close a ticket in this status. +
Customers only: Customers can close a ticket in this status, but staff cannot. +
Staff only: Staff can close a ticket in this status, but customers cannot. +
No: No one is allowed to close a ticket in this status.'; // " = " +$hesklang['customers_only'] = 'Customers only'; +$hesklang['staff_only'] = 'Staff only'; +$hesklang['yes_title_case'] = 'Yes'; +$hesklang['no_title_case'] = 'No'; // ADDED OR MODIFIED IN Mods for HESK 2.1.1 $hesklang['new_article_default_type'] = 'Default Type for New Articles';