diff --git a/admin/admin_settings.php b/admin/admin_settings.php
index fe2f3165..be6c3bae 100644
--- a/admin/admin_settings.php
+++ b/admin/admin_settings.php
@@ -2199,8 +2199,8 @@ if ( defined('HESK_DEMO') )
$checkedEcho = ($row['IsClosed'] == 1) ? 'checked="checked"' : '';
$isDisabled = false;
if ($row['IsNewTicketStatus'] || $row['IsClosedByClient'] || $row['IsCustomerReplyStatus'] ||
- $row['IsStaffClosedOption'] || $row['IsStaffReopenedStatus'] || $row['IsDefaultStaffReplyStatus']
- || $row['LockedTicketStatus'])
+ $row['IsStaffClosedOption'] || $row['IsStaffReopenedStatus'] || $row['IsDefaultStaffReplyStatus'] ||
+ $row['LockedTicketStatus'] || $row['IsAutocloseOption'])
{
$isDisabled = true;
}
@@ -2365,6 +2365,21 @@ if ( defined('HESK_DEMO') )
+
diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php
index 89e450ea..00acc2b4 100644
--- a/admin/admin_settings_save.php
+++ b/admin/admin_settings_save.php
@@ -605,6 +605,12 @@ $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();
+
$set['hesk_version'] = $hesk_settings['hesk_version'];
// Save the modsForHesk_settings.inc.php file
diff --git a/admin/index.php b/admin/index.php
index fefc2178..2ddf4be4 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -287,7 +287,7 @@ function do_login()
}
// Update ticket statuses and history in database if we're allowed to do so
- $defaultCloseRs = hesk_dbQuery('SELECT `ID` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsStaffClosedOption` = 1');
+ $defaultCloseRs = hesk_dbQuery('SELECT `ID` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsAutocloseOption` = 1');
$defaultCloseStatus = hesk_dbFetchAssoc($defaultCloseRs);
hesk_dbQuery("UPDATE `" . $hesk_settings['db_pfix'] . "tickets` SET `status`=".intval($defaultCloseStatus['ID']).", `closedat`=NOW(), `closedby`='-1', `history`=CONCAT(`history`,'" . hesk_dbEscape($revision) . "') WHERE `status` = '".$closedStatus['ID']."' AND `lastchange` <= '" . hesk_dbEscape($dt) . "' ");
}
diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php
index 19415b83..4c5b3cad 100644
--- a/install/mods-for-hesk/sql/installSql.php
+++ b/install/mods-for-hesk/sql/installSql.php
@@ -402,6 +402,11 @@ function execute220Scripts() {
global $hesk_settings;
hesk_dbConnect();
+ executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ADD COLUMN `IsAutocloseOption` INT NOT NULL DEFAULT 0");
+
+ // There will only ever be one row
+ executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `IsAutocloseOption` = 1 WHERE `IsStaffClosedOption` = 1");
+
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'");
diff --git a/language/en/text.php b/language/en/text.php
index d18be663..ef5aa220 100644
--- a/language/en/text.php
+++ b/language/en/text.php
@@ -58,6 +58,7 @@ $hesklang['customers_only'] = 'Customers only';
$hesklang['staff_only'] = 'Staff only';
$hesklang['yes_title_case'] = 'Yes';
$hesklang['no_title_case'] = 'No';
+$hesklang['autoclose_ticket_status'] = 'When a ticket is closed automatically, change the status to';
// ADDED OR MODIFIED IN Mods for HESK 2.1.1
$hesklang['new_article_default_type'] = 'Default Type for New Articles';