Browse Source

Add option for default status for when tickets are autoclosed

merge-requests/2/head
Mike Koch 7 years ago
parent
commit
6d01eebb5e
  1. 19
      admin/admin_settings.php
  2. 6
      admin/admin_settings_save.php
  3. 2
      admin/index.php
  4. 5
      install/mods-for-hesk/sql/installSql.php
  5. 1
      language/en/text.php

19
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') )
</select>
</div>
</div>
<div class="form-group">
<label for="autocloseTicketOption" class="col-sm-8 col-xs-12 control-label"><?php echo $hesklang['autoclose_ticket_status']; ?></label>
<div class="col-sm-4 col-xs-12">
<select name="autocloseTicketOption" class="form-control" id="autocloseTicketOption">
<?php
$statusesRS = hesk_dbQuery($statusesSql);
while ($row = $statusesRS->fetch_assoc())
{
$selectedEcho = ($row['IsAutocloseOption'] == 1) ? 'selected' : '';
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['ShortNameContentKey']].'</option>';
}
?>
</select>
</div>
</div>
</div>
<!-- Mods For Hesk: Color settings -->
<div class="tab-pane fade in" id="colors">

6
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

2
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) . "' ");
}

5
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'");

1
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';

Loading…
Cancel
Save