Merge pull request #293 from mkoch227/improve-statuses-ui
Improve Statuses UI
This commit is contained in:
commit
03de74dea7
@ -40,8 +40,10 @@ if (is_dir(HESK_PATH . 'install')) {die('Please delete the <b>install</b> folder
|
|||||||
|
|
||||||
/* Get all the required files and functions */
|
/* Get all the required files and functions */
|
||||||
require(HESK_PATH . 'hesk_settings.inc.php');
|
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/common.inc.php');
|
||||||
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/status_functions.inc.php');
|
||||||
hesk_load_database_functions();
|
hesk_load_database_functions();
|
||||||
|
|
||||||
hesk_session_start();
|
hesk_session_start();
|
||||||
|
@ -860,6 +860,27 @@ if ( defined('HESK_DEMO') )
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="statuses_order_column" class="col-sm-6 control-label">
|
||||||
|
<span class="label label-primary"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo $hesklang['added_in_mods_for_hesk']; ?>"><?php echo $hesklang['mods_for_hesk_acronym']; ?></span>
|
||||||
|
<?php echo $hesklang['status_sort']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark" data-toggle="htmlpopover"
|
||||||
|
title="<?php echo $hesklang['status_sort']; ?>"
|
||||||
|
data-content="<?php echo $hesklang['status_sort_help']; ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<?php
|
||||||
|
$on = $modsForHesk_settings['statuses_order_column'] == 'name' ? 'checked' : '';
|
||||||
|
$off = $modsForHesk_settings['statuses_order_column'] == 'name' ? '' : 'checked';
|
||||||
|
echo '
|
||||||
|
<div class="radio"><label><input type="radio" name="statuses_order_column" value="0" '.$off.'>'.$hesklang['sort_by_user_defined_order'].'</label></div>
|
||||||
|
<div class="radio"><label><input type="radio" name="statuses_order_column" value="1" '.$on.'>'.$hesklang['sort_alphabetically'].'</label></div>
|
||||||
|
';
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Second column -->
|
<!-- Second column -->
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@ -516,6 +516,7 @@ $set['mfh_attachments'] = empty($_POST['email_attachments']) ? 0 : 1;
|
|||||||
$set['show_number_merged'] = empty($_POST['show_number_merged']) ? 0 : 1;
|
$set['show_number_merged'] = empty($_POST['show_number_merged']) ? 0 : 1;
|
||||||
$set['request_location'] = empty($_POST['request_location']) ? 0 : 1;
|
$set['request_location'] = empty($_POST['request_location']) ? 0 : 1;
|
||||||
$set['category_order_column'] = empty($_POST['category_order_column']) ? 'cat_order' : 'name';
|
$set['category_order_column'] = empty($_POST['category_order_column']) ? 'cat_order' : 'name';
|
||||||
|
$set['statuses_order_column'] = empty($_POST['statuses_order_column']) ? 'sort' : 'name';
|
||||||
|
|
||||||
if ($set['customer-email-verification-required'])
|
if ($set['customer-email-verification-required'])
|
||||||
{
|
{
|
||||||
@ -584,7 +585,10 @@ $modsForHesk_settings[\'show_number_merged\'] = '.$set['show_number_merged'].';
|
|||||||
$modsForHesk_settings[\'request_location\'] = '.$set['request_location'].';
|
$modsForHesk_settings[\'request_location\'] = '.$set['request_location'].';
|
||||||
|
|
||||||
//-- Column to sort categories by. Can be either \'name\' or \'cat_order\'
|
//-- Column to sort categories by. Can be either \'name\' or \'cat_order\'
|
||||||
$modsForHesk_settings[\'category_order_column\'] = \''.$set['category_order_column'].'\';';
|
$modsForHesk_settings[\'category_order_column\'] = \''.$set['category_order_column'].'\';
|
||||||
|
|
||||||
|
//-- Column to sort statuses by. Can be either \'sort\' or \'name\'
|
||||||
|
$modsForHesk_settings[\'statuses_order_column\'] = \''.$set['statuses_order_column'].'\';';
|
||||||
|
|
||||||
// Write the file
|
// Write the file
|
||||||
if ( ! file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $modsForHesk_file_content) )
|
if ( ! file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $modsForHesk_file_content) )
|
||||||
|
@ -40,6 +40,7 @@ require(HESK_PATH . 'hesk_settings.inc.php');
|
|||||||
require(HESK_PATH . 'modsForHesk_settings.inc.php');
|
require(HESK_PATH . 'modsForHesk_settings.inc.php');
|
||||||
require(HESK_PATH . 'inc/common.inc.php');
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/status_functions.inc.php');
|
||||||
hesk_load_database_functions();
|
hesk_load_database_functions();
|
||||||
|
|
||||||
hesk_session_start();
|
hesk_session_start();
|
||||||
@ -677,9 +678,9 @@ if($ticket['email'] != '') {
|
|||||||
$recentTicketsWithStatuses = array();
|
$recentTicketsWithStatuses = array();
|
||||||
foreach ($recentTickets as $recentTicket) {
|
foreach ($recentTickets as $recentTicket) {
|
||||||
$newRecentTicket = $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);
|
$theStatusRow = hesk_dbFetchAssoc($thisTicketStatusRS);
|
||||||
$newRecentTicket['statusText'] = $hesklang[$theStatusRow['Key']];
|
$newRecentTicket['statusText'] = mfh_getDisplayTextForStatusId($theStatusRow['ID']);
|
||||||
$newRecentTicket['statusColor'] = $theStatusRow['TextColor'];
|
$newRecentTicket['statusColor'] = $theStatusRow['TextColor'];
|
||||||
array_push($recentTicketsWithStatuses, $newRecentTicket);
|
array_push($recentTicketsWithStatuses, $newRecentTicket);
|
||||||
}
|
}
|
||||||
@ -975,11 +976,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<?php
|
<?php
|
||||||
$random=rand(10000,99999);
|
$random=rand(10000,99999);
|
||||||
|
|
||||||
$statusSql = 'SELECT `ID`, `Key`, `IsStaffClosedOption`, `IsStaffReopenedStatus` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsStaffClosedOption` = 1 OR `IsStaffReopenedStatus` = 1';
|
$statusSql = 'SELECT `ID`, `IsStaffClosedOption`, `IsStaffReopenedStatus` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsStaffClosedOption` = 1 OR `IsStaffReopenedStatus` = 1';
|
||||||
$statusRs = hesk_dbQuery($statusSql);
|
$statusRs = hesk_dbQuery($statusSql);
|
||||||
$staffClosedOptionStatus = array();
|
$staffClosedOptionStatus = array();
|
||||||
$staffReopenedStatus = array();
|
$staffReopenedStatus = array();
|
||||||
while ($statusRow = $statusRs->fetch_assoc())
|
while ($statusRow = hesk_dbFetchAssoc($statusRs))
|
||||||
{
|
{
|
||||||
if ($statusRow['IsStaffReopenedStatus'] == 1)
|
if ($statusRow['IsStaffReopenedStatus'] == 1)
|
||||||
{
|
{
|
||||||
@ -1079,11 +1080,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
|
|
||||||
echo '<div class="col-md-3 col-sm-12 ticket-cell-admin"><p class="ticketPropertyTitle">'.$hesklang['status'].'</p>';
|
echo '<div class="col-md-3 col-sm-12 ticket-cell-admin"><p class="ticketPropertyTitle">'.$hesklang['status'].'</p>';
|
||||||
$status_options = array();
|
$status_options = array();
|
||||||
$results = hesk_dbQuery("SELECT `ID`, `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`");
|
$results = mfh_getAllStatuses();
|
||||||
while ($row = $results->fetch_assoc())
|
foreach ($results as $row)
|
||||||
{
|
{
|
||||||
$selected = $ticket['status'] == $row['ID'] ? 'selected' : '';
|
$selected = $ticket['status'] == $row['ID'] ? 'selected' : '';
|
||||||
$status_options[$row['ID']] = '<option value="'.$row['ID'].'" '.$selected.'>'.$hesklang[$row['Key']].'</option>';
|
$status_options[$row['ID']] = '<option value="'.$row['ID'].'" '.$selected.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
@ -1991,11 +1992,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'];
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
<label>
|
<label>
|
||||||
@ -2033,17 +2029,12 @@ function hesk_printReplyForm() {
|
|||||||
</a></li>
|
</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<?php
|
<?php
|
||||||
$allStatusesRs = hesk_dbQuery('SELECT `ID`, `Key`, `TextColor` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
|
$statuses = mfh_getAllStatuses();
|
||||||
$statuses = array();
|
|
||||||
while ($row = hesk_dbFetchAssoc($allStatusesRs)) {
|
|
||||||
array_push($statuses, $row);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($statuses as $status) {
|
foreach ($statuses as $status) {
|
||||||
echo '<li><a>
|
echo '<li><a>
|
||||||
<button class="dropdown-submit" type="submit" name="submit_as_status" value="'.$status['ID'].'"">
|
<button class="dropdown-submit" type="submit" name="submit_as_status" value="'.$status['ID'].'"">
|
||||||
'.$hesklang['submit_reply'].' '.$hesklang['and_change_status_to'].' <b>
|
'.$hesklang['submit_reply'].' '.$hesklang['and_change_status_to'].' <b>
|
||||||
<span style="color:'.$status['TextColor'].'">'.$hesklang[$status['Key']].'</span></b>
|
<span style="color:'.$status['TextColor'].'">'.mfh_getDisplayTextForStatusId($status['ID']).'</span></b>
|
||||||
</button>
|
</button>
|
||||||
</a></li>';
|
</a></li>';
|
||||||
}
|
}
|
||||||
|
@ -58,13 +58,13 @@ hesk_token_check();
|
|||||||
$trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']);
|
$trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']);
|
||||||
|
|
||||||
/* Valid statuses */
|
/* Valid statuses */
|
||||||
$statusSql = "SELECT `ID`, `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`";
|
$statusSql = "SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`";
|
||||||
$status_options = array();
|
$status_options = array();
|
||||||
$results = hesk_dbQuery($statusSql);
|
$results = hesk_dbQuery($statusSql);
|
||||||
|
|
||||||
while ($row = $results->fetch_assoc())
|
while ($row = $results->fetch_assoc())
|
||||||
{
|
{
|
||||||
$status_options[$row['ID']] = $hesklang[$row['Key']];
|
$status_options[$row['ID']] = mfh_getDisplayTextForStatusId($row['ID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* New status */
|
/* New status */
|
||||||
|
@ -40,6 +40,7 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php');
|
|||||||
require(HESK_PATH . 'inc/common.inc.php');
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
||||||
require(HESK_PATH . 'inc/reporting_functions.inc.php');
|
require(HESK_PATH . 'inc/reporting_functions.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/status_functions.inc.php');
|
||||||
hesk_load_database_functions();
|
hesk_load_database_functions();
|
||||||
|
|
||||||
hesk_session_start();
|
hesk_session_start();
|
||||||
@ -243,12 +244,11 @@ $fid = 1;
|
|||||||
require(HESK_PATH . 'inc/assignment_search.inc.php');
|
require(HESK_PATH . 'inc/assignment_search.inc.php');
|
||||||
|
|
||||||
// --> TICKET STATUS
|
// --> TICKET STATUS
|
||||||
$possibleStatusSql = 'SELECT `ID`, `Key` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`';
|
$statuses = mfh_getAllStatuses();
|
||||||
$possibleStatusRS = hesk_dbQuery($possibleStatusSql);
|
|
||||||
$possible_status = array();
|
$possible_status = array();
|
||||||
while ($row = $possibleStatusRS->fetch_assoc())
|
foreach ($statuses as $row)
|
||||||
{
|
{
|
||||||
$possible_status[$row['ID']] = $hesklang[$row['Key']];
|
$possible_status[$row['ID']] = mfh_getDisplayTextForStatusId($row['ID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$status = $possible_status;
|
$status = $possible_status;
|
||||||
@ -262,9 +262,7 @@ foreach ($status as $k => $v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// How many statuses are we pulling out of the database?
|
// How many statuses are we pulling out of the database?
|
||||||
$allStatusCountSql = 'SELECT COUNT(*) AS `Count` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`';
|
$allStatusCount = count($statuses);
|
||||||
$allStatusCountRow = hesk_dbQuery($allStatusCountSql)->fetch_assoc();
|
|
||||||
$allStatusCount = $allStatusCountRow['Count'];
|
|
||||||
$tmp = count($status);
|
$tmp = count($status);
|
||||||
|
|
||||||
// Do we need to search by status?
|
// Do we need to search by status?
|
||||||
@ -507,9 +505,7 @@ if (isset($_GET['w']))
|
|||||||
$result = hesk_dbQuery($sql);
|
$result = hesk_dbQuery($sql);
|
||||||
while ($ticket=hesk_dbFetchAssoc($result))
|
while ($ticket=hesk_dbFetchAssoc($result))
|
||||||
{
|
{
|
||||||
$statusContentKeySql = 'SELECT `Key` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `ID` = '.$ticket['status'];
|
$ticket['status'] = mfh_getDisplayTextForStatusId($ticket['status']);
|
||||||
$statusContentKeyRow = hesk_dbQuery($statusContentKeySql)->fetch_assoc();
|
|
||||||
$ticket['status'] = $hesklang[$statusContentKeyRow['Key']];
|
|
||||||
|
|
||||||
switch ($ticket['priority'])
|
switch ($ticket['priority'])
|
||||||
{
|
{
|
||||||
@ -781,14 +777,13 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<label for="status" class="control-label col-sm-2"><?php echo $hesklang['status']; ?>:</label>
|
<label for="status" class="control-label col-sm-2"><?php echo $hesklang['status']; ?>:</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<?php
|
<?php
|
||||||
$getStatusCheckboxSql = 'SELECT `ID`, `Key`, `TextColor` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`';
|
$statuses = mfh_getAllStatuses();
|
||||||
$getStatusCheckboxRS = hesk_dbQuery($getStatusCheckboxSql);
|
foreach ($statuses as $row)
|
||||||
while ($row = $getStatusCheckboxRS->fetch_assoc())
|
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<div class="col-xs-4">
|
<div class="col-xs-4">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label><input type="checkbox" name="s<?php echo $row['ID']; ?>" value="1" <?php if (isset($status[$row['ID']])) {echo 'checked="checked"';} ?> /> <span style="color: <?php echo $row['TextColor']; ?>"><?php echo $hesklang[$row['Key']]; ?></span></label>
|
<label><input type="checkbox" name="s<?php echo $row['ID']; ?>" value="1" <?php if (isset($status[$row['ID']])) {echo 'checked="checked"';} ?> /> <span style="color: <?php echo $row['TextColor']; ?>"><?php echo $row['text']; ?></span></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
@ -5,8 +5,10 @@ define('HESK_PATH','../');
|
|||||||
|
|
||||||
/* Get all the required files and functions */
|
/* Get all the required files and functions */
|
||||||
require(HESK_PATH . 'hesk_settings.inc.php');
|
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/common.inc.php');
|
||||||
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/status_functions.inc.php');
|
||||||
hesk_load_database_functions();
|
hesk_load_database_functions();
|
||||||
|
|
||||||
hesk_session_start();
|
hesk_session_start();
|
||||||
@ -18,11 +20,14 @@ hesk_checkPermission('can_man_ticket_statuses');
|
|||||||
define('WYSIWYG',1);
|
define('WYSIWYG',1);
|
||||||
|
|
||||||
// Are we performing an action?
|
// Are we performing an action?
|
||||||
if (isset($_POST['action'])) {
|
if (isset($_REQUEST['a'])) {
|
||||||
if ($_POST['action'] == 'save') {
|
if ($_POST['a'] == 'create') { createStatus(); }
|
||||||
save();
|
elseif ($_POST['a'] == 'update') { updateStatus(); }
|
||||||
}
|
elseif ($_GET['a'] == 'delete') { deleteStatus(); }
|
||||||
|
elseif ($_GET['a'] == 'sort') { moveStatus(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Print header */
|
/* Print header */
|
||||||
require_once(HESK_PATH . 'inc/headerAdmin.inc.php');
|
require_once(HESK_PATH . 'inc/headerAdmin.inc.php');
|
||||||
|
|
||||||
@ -77,214 +82,228 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
/* This will handle error, success and notice messages */
|
/* This will handle error, success and notice messages */
|
||||||
hesk_handle_messages();
|
hesk_handle_messages();
|
||||||
|
|
||||||
?>
|
|
||||||
<h6 style="font-weight: bold"><?php echo $hesklang['basicProperties']; ?></h6>
|
|
||||||
<div class="footerWithBorder blankSpace"></div>
|
|
||||||
<?php
|
|
||||||
//-- We need to get all of the statuses and dump the information to the page.
|
//-- We need to get all of the statuses and dump the information to the page.
|
||||||
$statusesSql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`';
|
$numOfStatusesRS = hesk_dbQuery('SELECT 1 FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
|
||||||
$closedStatusesSql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 1';
|
$numberOfStatuses = hesk_dbNumRows($numOfStatusesRS);
|
||||||
$openStatusesSql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 0';
|
|
||||||
$statusesRS = hesk_dbQuery($statusesSql);
|
$statuses = mfh_getAllStatuses();
|
||||||
?>
|
?>
|
||||||
<form class="form-horizontal" method="post" action="manage_statuses.php" role="form">
|
<form class="form-horizontal" method="post" action="manage_statuses.php" role="form">
|
||||||
<div class="table-responsive">
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h4>
|
||||||
|
<?php echo $hesklang['statuses']; ?>
|
||||||
|
<span class="nu-floatRight" style="margin-top: -7px">
|
||||||
|
<button class="btn btn-success" data-toggle="modal" data-target="#modal-status-new">
|
||||||
|
<i class="fa fa-plus-circle"></i>
|
||||||
|
<?php
|
||||||
|
echo $hesklang['new_status'];
|
||||||
|
?>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php echo $hesklang['name']; ?></th>
|
<th><?php echo $hesklang['name']; ?></th>
|
||||||
<th><?php echo $hesklang['language_key']; ?> <i class="fa fa-question-circle settingsquestionmark" data-toggle="popover" title="<?php echo $hesklang['language_key']; ?>" data-content="<?php echo $hesklang['language_key_description']; ?>"></i></th>
|
<th><?php echo $hesklang['closable_question']; ?></th>
|
||||||
<th><?php echo $hesklang['textColor']; ?> <i class="fa fa-question-circle settingsquestionmark" data-toggle="popover" title="<?php echo $hesklang['textColor']; ?>" data-content="<?php echo $hesklang['textColorDescr']; ?>"></i></th>
|
<th><?php echo $hesklang['closedQuestionMark']; ?></th>
|
||||||
<th><?php echo $hesklang['closable_question']; ?> <i class="fa fa-question-circle settingsquestionmark" data-toggle="htmlpopover" data-placement="bottom" title="<?php echo $hesklang['closable_question']; ?>" data-content="<?php echo $hesklang['closable_description']; ?>"></i></th>
|
<th><?php echo $hesklang['actions']; ?></th>
|
||||||
<th><?php echo $hesklang['closedQuestionMark']; ?> <i class="fa fa-question-circle settingsquestionmark" data-toggle="popover" data-placement="top" title="<?php echo $hesklang['closedQuestionMark']; ?>" data-content="<?php echo $hesklang['closedQuestionMarkDescr']; ?>"></i></th>
|
|
||||||
<th><?php echo $hesklang['delete']; ?></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
//Print each status
|
$j = 1;
|
||||||
while ($row = $statusesRS->fetch_assoc())
|
foreach ($statuses as $key => $row):
|
||||||
{
|
|
||||||
$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 '<tr id="s'.$row['ID'].'_row">';
|
|
||||||
echo '<td>'.$hesklang[$row['Key']].'</td>'; //Name
|
|
||||||
echo '<td><input type="text" class="form-control" name="s'.$row['ID'].'_key" value="'.$row['Key'].'" placeholder="'.htmlspecialchars($hesklang['language_key']).'"></td>'; // Language File Key
|
|
||||||
echo '<td><input type="text" class="form-control" name="s'.$row['ID'].'_textColor" value="'.$row['TextColor'].'" placeholder="'.htmlspecialchars($hesklang['textColor']).'"></td>'; // Text Color
|
|
||||||
echo '<td>
|
|
||||||
<select class="form-control" name="s'.$row['ID'].'_closable">
|
|
||||||
<option value="yes" '.$yesSelected.'>'.$hesklang['yes_title_case'].'</option>
|
|
||||||
<option value="conly" '.$customersOnlySelected.'>'.$hesklang['customers_only'].'</option>
|
|
||||||
<option value="sonly" '.$staffOnlySelected.'>'.$hesklang['staff_only'].'</option>
|
|
||||||
<option value="no" '.$noSelected.'>'.$hesklang['no_title_case'].'</option>
|
|
||||||
</select>
|
|
||||||
</td>';
|
|
||||||
echo '<td><input type="checkbox" name="s'.$row['ID'].'_isClosed" value="1" '.$checkedEcho.'></td>'; // Resolved Status?
|
|
||||||
echo '<td>';
|
|
||||||
if ($isDisabled)
|
|
||||||
{
|
|
||||||
echo '<i class="fa fa-ban" style="color: red; font-size: 1.2em; font-weight: bold" data-toggle="popover" data-placement="left" title="'.$hesklang['whyCantIDeleteThisStatus'].'" data-content="'.$hesklang['whyCantIDeleteThisStatusReason'].'"></i>';
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
echo '<input type="checkbox" onclick="toggleRow(\'s'.$row['ID'].'_row\')" name="s'.$row['ID'].'_delete" value="1">';
|
|
||||||
}
|
|
||||||
echo '</td>'; //Delete status?
|
|
||||||
echo '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
//Print out an additional blank space for adding a status
|
|
||||||
echo '<tr class="info">';
|
|
||||||
echo '<td><b>'.$hesklang['addNew'].'</b></td>';
|
|
||||||
echo '<td><input type="text" class="form-control" name="sN_key" value="" placeholder="'.htmlspecialchars($hesklang['language_key']).'"></td>'; // Language File Key
|
|
||||||
echo '<td><input type="text" class="form-control" name="sN_textColor" value="" placeholder="'.htmlspecialchars($hesklang['textColor']).'"></td>'; // Text Color
|
|
||||||
echo '<td>
|
|
||||||
<select class="form-control" name="sN_closable">
|
|
||||||
<option value="yes">'.$hesklang['yes_title_case'].'</option>
|
|
||||||
<option value="conly">'.$hesklang['customers_only'].'</option>
|
|
||||||
<option value="sonly">'.$hesklang['staff_only'].'</option>
|
|
||||||
<option value="no">'.$hesklang['no_title_case'].'</option>
|
|
||||||
</select>
|
|
||||||
</td>';
|
|
||||||
echo '<td><input type="checkbox" name="sN_isClosed" value="1"></td>'; // Resolved Status?
|
|
||||||
echo '<td></td>'; //Empty placeholder where the delete row is.
|
|
||||||
echo '</tr>';
|
|
||||||
?>
|
?>
|
||||||
|
<tr id="s<?php echo $row['ID']; ?>_row">
|
||||||
|
<td style="color: <?php echo $row['TextColor']; ?>; font-weight: bold">
|
||||||
|
<?php echo $row['text']; ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
if ($row['Closable'] == 'yes') {
|
||||||
|
echo $hesklang['yes_title_case'];
|
||||||
|
} elseif ($row['Closable'] == 'conly') {
|
||||||
|
echo $hesklang['customers_only'];
|
||||||
|
} elseif ($row['Closable'] == 'sonly') {
|
||||||
|
echo $hesklang['staff_only'];
|
||||||
|
} elseif ($row['Closable'] == 'no') {
|
||||||
|
echo $hesklang['no_title_case'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
if ($row['IsClosed']) {
|
||||||
|
echo '<i class="fa fa-check-circle icon-link" style="color: green;"></i>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span data-toggle="modal" data-target="#modal-status-<?php echo $row['ID']; ?>" style="cursor: pointer;">
|
||||||
|
<i class="fa fa-pencil icon-link" style="color: orange"
|
||||||
|
data-toggle="tooltip" title="<?php echo $hesklang['edit']; ?>"></i>
|
||||||
|
</span>
|
||||||
|
<?php echoArrows($j, $numberOfStatuses, $row['ID']); ?>
|
||||||
|
<span data-toggle="modal" data-target="#modal-status-delete-<?php echo $row['ID']; ?>" style="cursor: pointer;">
|
||||||
|
<i class="fa fa-times icon-link" style="color: red"
|
||||||
|
data-toggle="tooltip" title="<?php echo $hesklang['delete']; ?>"></i>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
$j++;
|
||||||
|
endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<h6 style="font-weight: bold"><?php echo $hesklang['defaultStatusForAction']; ?></h6>
|
<div class="panel panel-default">
|
||||||
<div class="footerWithBorder blankSpace"></div>
|
<div class="panel-heading">
|
||||||
<div class="form-group">
|
<h4><?php echo $hesklang['defaultStatusForAction']; ?></h4>
|
||||||
<label for="newTicket" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isNewTicketMsg']; ?></label>
|
|
||||||
<div class="col-sm-6 col-xs-12">
|
|
||||||
<select name="newTicket" class="form-control" id="newTicket">
|
|
||||||
<?php
|
|
||||||
$statusesRS = hesk_dbQuery($openStatusesSql);
|
|
||||||
while ($row = $statusesRS->fetch_assoc())
|
|
||||||
{
|
|
||||||
$selectedEcho = ($row['IsNewTicketStatus'] == 1) ? 'selected="selected"' : '';
|
|
||||||
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['Key']].'</option>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="panel-body">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="closedByClient" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isClosedByClientMsg']; ?></label>
|
<label for="newTicket" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isNewTicketMsg']; ?></label>
|
||||||
<div class="col-sm-6 col-xs-12">
|
<div class="col-sm-6 col-xs-12">
|
||||||
<select name="closedByClient" class="form-control" id="closedByClient">
|
<select name="newTicket" class="form-control" id="newTicket">
|
||||||
<?php
|
<?php
|
||||||
$statusesRS = hesk_dbQuery($closedStatusesSql);
|
foreach ($statuses as $key => $row)
|
||||||
while ($row = $statusesRS->fetch_assoc())
|
{
|
||||||
{
|
if ($row['IsClosed'] == 1) {
|
||||||
$selectedEcho = ($row['IsClosedByClient'] == 1) ? 'selected="selected"' : '';
|
continue;
|
||||||
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['Key']].'</option>';
|
}
|
||||||
}
|
|
||||||
?>
|
$selectedEcho = ($row['IsNewTicketStatus'] == 1) ? 'selected="selected"' : '';
|
||||||
</select>
|
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
</div>
|
}
|
||||||
</div>
|
?>
|
||||||
<div class="form-group">
|
</select>
|
||||||
<label for="replyFromClient" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isRepliedByClientMsg']; ?></label>
|
</div>
|
||||||
<div class="col-sm-6 col-xs-12">
|
</div>
|
||||||
<select name="replyFromClient" class="form-control" id="replyFromClient">
|
<div class="form-group">
|
||||||
<?php
|
<label for="closedByClient" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isClosedByClientMsg']; ?></label>
|
||||||
$statusesRS = hesk_dbQuery($openStatusesSql);
|
<div class="col-sm-6 col-xs-12">
|
||||||
while ($row = $statusesRS->fetch_assoc())
|
<select name="closedByClient" class="form-control" id="closedByClient">
|
||||||
{
|
<?php
|
||||||
$selectedEcho = ($row['IsCustomerReplyStatus'] == 1) ? 'selected="selected"' : '';
|
foreach ($statuses as $key => $row)
|
||||||
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['Key']].'</option>';
|
{
|
||||||
}
|
if ($row['IsClosed'] == 0) {
|
||||||
?>
|
continue;
|
||||||
</select>
|
}
|
||||||
</div>
|
|
||||||
</div>
|
$selectedEcho = ($row['IsClosedByClient'] == 1) ? 'selected="selected"' : '';
|
||||||
<div class="form-group">
|
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
<label for="staffClosedOption" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isStaffClosedOptionMsg']; ?></label>
|
}
|
||||||
<div class="col-sm-6 col-xs-12">
|
?>
|
||||||
<select name="staffClosedOption" class="form-control" id="staffClosedOption">
|
</select>
|
||||||
<?php
|
</div>
|
||||||
$statusesRS = hesk_dbQuery($closedStatusesSql);
|
</div>
|
||||||
while ($row = $statusesRS->fetch_assoc())
|
<div class="form-group">
|
||||||
{
|
<label for="replyFromClient" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isRepliedByClientMsg']; ?></label>
|
||||||
$selectedEcho = ($row['IsStaffClosedOption'] == 1) ? 'selected="selected"' : '';
|
<div class="col-sm-6 col-xs-12">
|
||||||
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['Key']].'</option>';
|
<select name="replyFromClient" class="form-control" id="replyFromClient">
|
||||||
}
|
<?php
|
||||||
?>
|
foreach ($statuses as $key => $row)
|
||||||
</select>
|
{
|
||||||
</div>
|
if ($row['IsClosed'] == 1) {
|
||||||
</div>
|
continue;
|
||||||
<div class="form-group">
|
}
|
||||||
<label for="staffReopenedStatus" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isStaffReopenedStatusMsg']; ?></label>
|
|
||||||
<div class="col-sm-6 col-xs-12">
|
$selectedEcho = ($row['IsCustomerReplyStatus'] == 1) ? 'selected="selected"' : '';
|
||||||
<select name="staffReopenedStatus" class="form-control" id="staffReopenedStatus">
|
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
<?php
|
}
|
||||||
$statusesRS = hesk_dbQuery($openStatusesSql);
|
?>
|
||||||
while ($row = $statusesRS->fetch_assoc())
|
</select>
|
||||||
{
|
</div>
|
||||||
$selectedEcho = ($row['IsStaffReopenedStatus'] == 1) ? 'selected="selected"' : '';
|
</div>
|
||||||
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['Key']].'</option>';
|
<div class="form-group">
|
||||||
}
|
<label for="staffClosedOption" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isStaffClosedOptionMsg']; ?></label>
|
||||||
?>
|
<div class="col-sm-6 col-xs-12">
|
||||||
</select>
|
<select name="staffClosedOption" class="form-control" id="staffClosedOption">
|
||||||
</div>
|
<?php
|
||||||
</div>
|
foreach ($statuses as $key => $row)
|
||||||
<div class="form-group">
|
{
|
||||||
<label for="defaultStaffReplyStatus" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isDefaultStaffReplyStatusMsg']; ?></label>
|
if ($row['IsClosed'] == 0) {
|
||||||
<div class="col-sm-6 col-xs-12">
|
continue;
|
||||||
<select name="defaultStaffReplyStatus" class="form-control" id="defaultStaffReplyStatus">
|
}
|
||||||
<?php
|
|
||||||
$statusesRS = hesk_dbQuery($openStatusesSql);
|
$selectedEcho = ($row['IsStaffClosedOption'] == 1) ? 'selected="selected"' : '';
|
||||||
while ($row = $statusesRS->fetch_assoc())
|
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
{
|
}
|
||||||
$selectedEcho = ($row['IsDefaultStaffReplyStatus'] == 1) ? 'selected="selected"' : '';
|
?>
|
||||||
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['Key']].'</option>';
|
</select>
|
||||||
}
|
</div>
|
||||||
?>
|
</div>
|
||||||
</select>
|
<div class="form-group">
|
||||||
</div>
|
<label for="staffReopenedStatus" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isStaffReopenedStatusMsg']; ?></label>
|
||||||
</div>
|
<div class="col-sm-6 col-xs-12">
|
||||||
<div class="form-group">
|
<select name="staffReopenedStatus" class="form-control" id="staffReopenedStatus">
|
||||||
<label for="lockedTicketStatus" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['lockedTicketStatusMsg']; ?></label>
|
<?php
|
||||||
<div class="col-sm-6 col-xs-12">
|
foreach ($statuses as $key => $row)
|
||||||
<select name="lockedTicketStatus" class="form-control" id="lockedTicketStatus">
|
{
|
||||||
<?php
|
if ($row['IsClosed'] == 1) {
|
||||||
$statusesRS = hesk_dbQuery($statusesSql);
|
continue;
|
||||||
while ($row = $statusesRS->fetch_assoc())
|
}
|
||||||
{
|
|
||||||
$selectedEcho = ($row['LockedTicketStatus'] == 1) ? 'selected="selected"' : '';
|
$selectedEcho = ($row['IsStaffReopenedStatus'] == 1) ? 'selected="selected"' : '';
|
||||||
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['Key']].'</option>';
|
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="autocloseTicketOption" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['autoclose_ticket_status']; ?></label>
|
<label for="defaultStaffReplyStatus" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['isDefaultStaffReplyStatusMsg']; ?></label>
|
||||||
<div class="col-sm-6 col-xs-12">
|
<div class="col-sm-6 col-xs-12">
|
||||||
<select name="autocloseTicketOption" class="form-control" id="autocloseTicketOption">
|
<select name="defaultStaffReplyStatus" class="form-control" id="defaultStaffReplyStatus">
|
||||||
<?php
|
<?php
|
||||||
$statusesRS = hesk_dbQuery($closedStatusesSql);
|
foreach ($statuses as $key => $row)
|
||||||
while ($row = $statusesRS->fetch_assoc())
|
{
|
||||||
{
|
if ($row['IsClosed'] == 1) {
|
||||||
$selectedEcho = ($row['IsAutocloseOption'] == 1) ? 'selected' : '';
|
continue;
|
||||||
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['Key']].'</option>';
|
}
|
||||||
}
|
|
||||||
?>
|
$selectedEcho = ($row['IsDefaultStaffReplyStatus'] == 1) ? 'selected="selected"' : '';
|
||||||
</select>
|
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="lockedTicketStatus" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['lockedTicketStatusMsg']; ?></label>
|
||||||
|
<div class="col-sm-6 col-xs-12">
|
||||||
|
<select name="lockedTicketStatus" class="form-control" id="lockedTicketStatus">
|
||||||
|
<?php
|
||||||
|
foreach ($statuses as $key => $row)
|
||||||
|
{
|
||||||
|
$selectedEcho = ($row['LockedTicketStatus'] == 1) ? 'selected="selected"' : '';
|
||||||
|
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="autocloseTicketOption" class="col-sm-6 col-xs-12 control-label"><?php echo $hesklang['autoclose_ticket_status']; ?></label>
|
||||||
|
<div class="col-sm-6 col-xs-12">
|
||||||
|
<select name="autocloseTicketOption" class="form-control" id="autocloseTicketOption">
|
||||||
|
<?php
|
||||||
|
foreach ($statuses as $key => $row)
|
||||||
|
{
|
||||||
|
if ($row['IsClosed'] == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$selectedEcho = ($row['IsAutocloseOption'] == 1) ? 'selected' : '';
|
||||||
|
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6 col-sm-offset-6">
|
<div class="col-sm-6 col-sm-offset-6">
|
||||||
@ -298,140 +317,399 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
foreach ($statuses as $status) {
|
||||||
|
buildEditModal($status['ID']);
|
||||||
|
buildConfirmDeleteModal($status['ID']);
|
||||||
|
}
|
||||||
|
buildCreateModal();
|
||||||
|
|
||||||
require_once(HESK_PATH . 'inc/footer.inc.php');
|
require_once(HESK_PATH . 'inc/footer.inc.php');
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
|
function buildConfirmDeleteModal($statusId) {
|
||||||
|
global $hesklang;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="modal fade" id="modal-status-delete-<?php echo $statusId; ?>" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title"><?php echo $hesklang['confirm_delete_status_question']; ?></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<p><?php echo $hesklang['confirm_delete_status']; ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<input type="hidden" name="a" value="create">
|
||||||
|
<div class="btn-group">
|
||||||
|
<a href="manage_statuses.php?a=delete&id=<?php echo $statusId; ?>" class="btn btn-danger">
|
||||||
|
<?php echo $hesklang['delete']; ?>
|
||||||
|
</a>
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $hesklang['cancel']; ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function echoArrows($index, $numberOfStatuses, $statusId) {
|
||||||
|
global $hesklang, $modsForHesk_settings;
|
||||||
|
|
||||||
|
if ($modsForHesk_settings['statuses_order_column'] == 'name') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($index !== 1) {
|
||||||
|
// Display move up
|
||||||
|
echo '<a href="manage_statuses.php?a=sort&move=-15&id='.$statusId.'">
|
||||||
|
<i class="fa fa-arrow-up icon-link" style="color: green" data-toggle="tooltip"
|
||||||
|
title="'.htmlspecialchars($hesklang['move_up']).'"></i></a> ';
|
||||||
|
} else {
|
||||||
|
echo '<img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;"> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($index !== $numberOfStatuses) {
|
||||||
|
// Display move down
|
||||||
|
echo '<a href="manage_statuses.php?a=sort&move=15&id='.$statusId.'">
|
||||||
|
<i class="fa fa-arrow-down icon-link" style="color: green" data-toggle="tooltip"
|
||||||
|
title="'.htmlspecialchars($hesklang['move_dn']).'"></i></a>';
|
||||||
|
} else {
|
||||||
|
echo '<img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;">';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildCreateModal() {
|
||||||
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
$languages = array();
|
||||||
|
foreach ($hesk_settings['languages'] as $key => $value) {
|
||||||
|
$languages[$key] = $hesk_settings['languages'][$key]['folder'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="modal fade" id="modal-status-new" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form action="manage_statuses.php" role="form" method="post" class="form-horizontal">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title"><?php echo $hesklang['create_new_status_title']; ?></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h4><?php echo $hesklang['status_name_title']; ?></h4>
|
||||||
|
<div class="footerWithBorder blankSpace"></div>
|
||||||
|
<?php foreach ($languages as $language => $languageCode): ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label" for="name[<?php echo $language; ?>]">
|
||||||
|
<?php echo $language; ?>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" placeholder="<?php echo htmlspecialchars($language); ?>"
|
||||||
|
class="form-control" name="name[<?php echo $language; ?>]">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h4><?php echo $hesklang['properties']; ?></h4>
|
||||||
|
<div class="footerWithBorder blankSpace"></div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="text-color" class="col-sm-4 control-label"><?php echo $hesklang['textColor']; ?></label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" name="text-color" class="form-control"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['textColor']); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="closable" class="col-sm-4 control-label"><?php echo $hesklang['closable']; ?></label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<select name="closable" class="form-control">
|
||||||
|
<option value="yes"><?php echo $hesklang['yes_title_case']; ?></option>
|
||||||
|
<option value="conly"><?php echo $hesklang['customers_only']; ?></option>
|
||||||
|
<option value="sonly"><?php echo $hesklang['staff_only']; ?></option>
|
||||||
|
<option value="no"><?php echo $hesklang['no_title_case']; ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="closed" class="col-sm-4 control-label"><?php echo $hesklang['closed_title']; ?></label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<select name="closed" class="form-control">
|
||||||
|
<option value="1"><?php echo $hesklang['yes_title_case']; ?></option>
|
||||||
|
<option value="0"><?php echo $hesklang['no_title_case']; ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<input type="hidden" name="a" value="create">
|
||||||
|
<div class="btn-group">
|
||||||
|
<input type="submit" class="btn btn-success" value="<?php echo $hesklang['save_changes']; ?>">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $hesklang['close_modal_without_saving']; ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildEditModal($statusId) {
|
||||||
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
// Get status information for this status
|
||||||
|
$getStatusRs = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `ID` = ".intval($statusId));
|
||||||
|
$status = hesk_dbFetchAssoc($getStatusRs);
|
||||||
|
|
||||||
|
$textRs = hesk_dbQuery("SELECT `language`, `text` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref`
|
||||||
|
WHERE `status_id` = ".intval($statusId));
|
||||||
|
$textArray = array();
|
||||||
|
while ($row = hesk_dbFetchAssoc($textRs)) {
|
||||||
|
$textArray[$row['language']] = $row['text'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$languages = array();
|
||||||
|
foreach ($hesk_settings['languages'] as $key => $value) {
|
||||||
|
$languages[$key] = $hesk_settings['languages'][$key]['folder'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="modal fade" id="modal-status-<?php echo $statusId; ?>" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form action="manage_statuses.php" role="form" method="post" class="form-horizontal">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title"><?php echo sprintf($hesklang['editing_status_x'], $status['TextColor'], mfh_getDisplayTextForStatusId($statusId)); ?></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h4><?php echo $hesklang['status_name_title']; ?></h4>
|
||||||
|
<div class="footerWithBorder blankSpace"></div>
|
||||||
|
<?php foreach ($languages as $language => $languageCode):
|
||||||
|
$warning = '';
|
||||||
|
if (isset($textArray[$language])) {
|
||||||
|
$text = $textArray[$language];
|
||||||
|
} else {
|
||||||
|
hesk_setLanguage($language);
|
||||||
|
$text = $hesklang[$status['Key']];
|
||||||
|
hesk_resetLanguage();
|
||||||
|
$warning = 'has-warning';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="form-group <?php echo $warning; ?>">
|
||||||
|
<label class="col-sm-3 control-label" for="name[<?php echo $language; ?>]">
|
||||||
|
<?php
|
||||||
|
if ($warning != '') {
|
||||||
|
echoWarningForStatus();
|
||||||
|
}
|
||||||
|
echo $language;
|
||||||
|
?>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" placeholder="<?php echo htmlspecialchars($language); ?>"
|
||||||
|
class="form-control" name="name[<?php echo $language; ?>]"
|
||||||
|
value="<?php echo htmlspecialchars($text); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h4><?php echo $hesklang['properties']; ?></h4>
|
||||||
|
<div class="footerWithBorder blankSpace"></div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="text-color" class="col-sm-4 control-label"><?php echo $hesklang['textColor']; ?></label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" name="text-color" class="form-control"
|
||||||
|
value="<?php echo $status['TextColor']; ?>"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['textColor']); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="closable" class="col-sm-4 control-label"><?php echo $hesklang['closable']; ?></label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<?php
|
||||||
|
$yesSelected = $status['Closable'] == 'yes' ? 'selected' : '';
|
||||||
|
$customersOnlySelected = $status['Closable'] == 'conly' ? 'selected' : '';
|
||||||
|
$staffOnlySelected = $status['Closable'] == 'sonly' ? 'selected' : '';
|
||||||
|
$noSelected = $status['Closable'] == 'no' ? 'selected' : '';
|
||||||
|
?>
|
||||||
|
<select name="closable" class="form-control">
|
||||||
|
<option value="yes" <?php echo $yesSelected; ?>><?php echo $hesklang['yes_title_case']; ?></option>
|
||||||
|
<option value="conly" <?php echo $customersOnlySelected; ?>><?php echo $hesklang['customers_only']; ?></option>
|
||||||
|
<option value="sonly" <?php echo $staffOnlySelected; ?>><?php echo $hesklang['staff_only']; ?></option>
|
||||||
|
<option value="no" <?php echo $noSelected; ?>><?php echo $hesklang['no_title_case']; ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="closed" class="col-sm-4 control-label"><?php echo $hesklang['closed_title']; ?></label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<?php
|
||||||
|
$yes = $status['IsClosed'] == 1 ? 'selected' : '';
|
||||||
|
$no = $status['IsClosed'] == 1 ? '' : 'selected';
|
||||||
|
?>
|
||||||
|
<select name="closed" class="form-control">
|
||||||
|
<option value="1" <?php echo $yes; ?>><?php echo $hesklang['yes_title_case']; ?></option>
|
||||||
|
<option value="0" <?php echo $no; ?>><?php echo $hesklang['no_title_case']; ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<input type="hidden" name="a" value="update">
|
||||||
|
<input type="hidden" name="status-id" value="<?php echo $statusId; ?>">
|
||||||
|
<div class="btn-group">
|
||||||
|
<input type="submit" class="btn btn-success" value="<?php echo $hesklang['save_changes']; ?>">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $hesklang['close_modal_without_saving']; ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function echoWarningForStatus() {
|
||||||
|
global $hesklang;
|
||||||
|
|
||||||
|
echo '<i class="fa fa-exclamation-triangle" data-toggle="tooltip" title="'.htmlspecialchars($hesklang['status_not_in_database']).'"></i> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
function createStatus() {
|
||||||
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
hesk_dbConnect();
|
||||||
|
|
||||||
|
// Create the new status record
|
||||||
|
$isClosed = hesk_POST('closed');
|
||||||
|
$closable = hesk_POST('closable');
|
||||||
|
$textColor = hesk_POST('text-color');
|
||||||
|
$insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`Key`, `TextColor`, `IsClosed`, `Closable`)
|
||||||
|
VALUES ('STORED IN XREF TABLE', '".hesk_dbEscape($textColor)."', ".intval($isClosed).", '".hesk_dbEscape($closable)."')";
|
||||||
|
hesk_dbQuery($insert);
|
||||||
|
|
||||||
|
$newStatusId = hesk_dbInsertID();
|
||||||
|
|
||||||
|
// For each language, create a value in the xref table
|
||||||
|
foreach (hesk_POST_array('name') as $language => $translation) {
|
||||||
|
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` (`language`, `text`, `status_id`)
|
||||||
|
VALUES ('".hesk_dbEscape($language)."', '".hesk_dbEscape($translation)."', ".intval($newStatusId).")");
|
||||||
|
}
|
||||||
|
|
||||||
|
hesk_process_messages($hesklang['new_status_created'],'manage_statuses.php','SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateStatus() {
|
||||||
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
$statusId = hesk_POST('status-id');
|
||||||
|
$isClosed = hesk_POST('closed');
|
||||||
|
$closable = hesk_POST('closable');
|
||||||
|
$textColor = hesk_POST('text-color');
|
||||||
|
$update = "UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`
|
||||||
|
SET `TextColor` = '".hesk_dbEscape($textColor)."',
|
||||||
|
`IsClosed` = ".intval($isClosed).",
|
||||||
|
`Closable` = '".hesk_dbEscape($closable)."'
|
||||||
|
WHERE `ID` = ".intval($statusId);
|
||||||
|
hesk_dbQuery($update);
|
||||||
|
|
||||||
|
// For each language, delete the xref record and insert the new ones
|
||||||
|
hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` WHERE `status_id` = ".intval($statusId));
|
||||||
|
foreach (hesk_POST_array('name') as $language => $translation) {
|
||||||
|
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` (`language`, `text`, `status_id`)
|
||||||
|
VALUES ('".hesk_dbEscape($language)."', '".hesk_dbEscape($translation)."', ".intval($statusId).")");
|
||||||
|
}
|
||||||
|
|
||||||
|
hesk_process_messages($hesklang['ticket_status_updated'],'manage_statuses.php','SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteStatus() {
|
||||||
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
$statusId = hesk_GET('id');
|
||||||
|
|
||||||
|
hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` WHERE `status_id` = ".intval($statusId));
|
||||||
|
hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `ID` = ".intval($statusId));
|
||||||
|
|
||||||
|
hesk_process_messages($hesklang['ticket_status_deleted'],'manage_statuses.php','SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveStatus() {
|
||||||
|
global $hesk_settings, $hesklang;
|
||||||
|
|
||||||
|
$statusId = intval(hesk_GET('id'));
|
||||||
|
$statusMove = intval(hesk_GET('move'));
|
||||||
|
|
||||||
|
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `sort` = `sort`+".intval($statusMove)."
|
||||||
|
WHERE `ID` = '".intval($statusId)."' LIMIT 1");
|
||||||
|
|
||||||
|
/* Update all category fields with new order */
|
||||||
|
$res = hesk_dbQuery("SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `sort` ASC");
|
||||||
|
|
||||||
|
$i = 10;
|
||||||
|
while ($myStatus = hesk_dbFetchAssoc($res))
|
||||||
|
{
|
||||||
|
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `sort`=".intval($i)."
|
||||||
|
WHERE `ID`='".intval($myStatus['ID'])."' LIMIT 1");
|
||||||
|
$i += 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
hesk_process_messages($hesklang['status_sort_updated'],'manage_statuses.php','SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
global $hesklang, $hesk_settings;
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
//-- Before we do anything, make sure the statuses are valid.
|
|
||||||
$rows = hesk_dbQuery('SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
|
|
||||||
while ($row = $rows->fetch_assoc())
|
|
||||||
{
|
|
||||||
if (!isset($_POST['s'.$row['ID'].'_delete']))
|
|
||||||
{
|
|
||||||
validateStatus($_POST['s'.$row['ID'].'_key'], $_POST['s'.$row['ID'].'_textColor']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-- Validate the new one if at least one of the fields are used / checked
|
|
||||||
if ($_POST['sN_key'] != null || $_POST['sN_textColor'] != null || isset($_POST['sN_isClosed']))
|
|
||||||
{
|
|
||||||
validateStatus($_POST['sN_key'], $_POST['sN_textColor']);
|
|
||||||
}
|
|
||||||
|
|
||||||
hesk_dbConnect();
|
|
||||||
$wasStatusDeleted = false;
|
|
||||||
//-- Get all the status IDs
|
|
||||||
$statusesSql = 'SELECT * FROM `'.$hesk_settings['db_pfix'].'statuses`';
|
|
||||||
$results = hesk_dbQuery($statusesSql);
|
|
||||||
while ($row = $results->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
|
//-- Update default status for actions
|
||||||
$defaultQuery = "UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET ";
|
$defaultQuery = "UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET ";
|
||||||
|
|
||||||
hesk_dbConnect()->query($defaultQuery . "`IsNewTicketStatus` = 0");
|
hesk_dbQuery($defaultQuery . "`IsNewTicketStatus` = 0");
|
||||||
$updateQuery = $defaultQuery . "`IsNewTicketStatus` = 1 WHERE `ID` = ?";
|
$updateQuery = $defaultQuery . "`IsNewTicketStatus` = 1 WHERE `ID` = ".intval($_POST['newTicket']);
|
||||||
$stmt = hesk_dbConnect()->prepare($updateQuery);
|
hesk_dbQuery($updateQuery);
|
||||||
$stmt->bind_param('i', $_POST['newTicket']);
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
|
hesk_dbQuery($defaultQuery . "`IsClosedByClient` = 0");
|
||||||
|
$updateQuery = $defaultQuery . "`IsClosedByClient` = 1 WHERE `ID` = ".intval($_POST['closedByClient']);
|
||||||
|
hesk_dbQuery($updateQuery);
|
||||||
|
|
||||||
hesk_dbConnect()->query($defaultQuery . "`IsClosedByClient` = 0");
|
hesk_dbQuery($defaultQuery . "`IsCustomerReplyStatus` = 0");
|
||||||
$updateQuery = $defaultQuery . "`IsClosedByClient` = 1 WHERE `ID` = ?";
|
$updateQuery = $defaultQuery . "`IsCustomerReplyStatus` = 1 WHERE `ID` = ".intval($_POST['replyFromClient']);
|
||||||
$stmt = hesk_dbConnect()->prepare($updateQuery);
|
hesk_dbQuery($updateQuery);
|
||||||
$stmt->bind_param('i', $_POST['closedByClient']);
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
hesk_dbConnect()->query($defaultQuery . "`IsCustomerReplyStatus` = 0");
|
hesk_dbQuery($defaultQuery . "`IsStaffClosedOption` = 0");
|
||||||
$updateQuery = $defaultQuery . "`IsCustomerReplyStatus` = 1 WHERE `ID` = ?";
|
$updateQuery = $defaultQuery . "`IsStaffClosedOption` = 1 WHERE `ID` = ".intval($_POST['staffClosedOption']);
|
||||||
$stmt = hesk_dbConnect()->prepare($updateQuery);
|
hesk_dbQuery($updateQuery);
|
||||||
$stmt->bind_param('i', $_POST['replyFromClient']);
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
hesk_dbConnect()->query($defaultQuery . "`IsStaffClosedOption` = 0");
|
hesk_dbQuery($defaultQuery . "`IsStaffReopenedStatus` = 0");
|
||||||
$updateQuery = $defaultQuery . "`IsStaffClosedOption` = 1 WHERE `ID` = ?";
|
$updateQuery = $defaultQuery . "`IsStaffReopenedStatus` = 1 WHERE `ID` = ".intval($_POST['staffReopenedStatus']);
|
||||||
$stmt = hesk_dbConnect()->prepare($updateQuery);
|
hesk_dbQuery($updateQuery);
|
||||||
$stmt->bind_param('i', $_POST['staffClosedOption']);
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
hesk_dbConnect()->query($defaultQuery . "`IsStaffReopenedStatus` = 0");
|
hesk_dbQuery($defaultQuery . "`IsDefaultStaffReplyStatus` = 0");
|
||||||
$updateQuery = $defaultQuery . "`IsStaffReopenedStatus` = 1 WHERE `ID` = ?";
|
$updateQuery = $defaultQuery . "`IsDefaultStaffReplyStatus` = 1 WHERE `ID` = ".intval($_POST['defaultStaffReplyStatus']);
|
||||||
$stmt = hesk_dbConnect()->prepare($updateQuery);
|
hesk_dbQuery($updateQuery);
|
||||||
$stmt->bind_param('i', $_POST['staffReopenedStatus']);
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
hesk_dbConnect()->query($defaultQuery . "`IsDefaultStaffReplyStatus` = 0");
|
hesk_dbQuery($defaultQuery . "`LockedTicketStatus` = 0");
|
||||||
$updateQuery = $defaultQuery . "`IsDefaultStaffReplyStatus` = 1 WHERE `ID` = ?";
|
$updateQuery = $defaultQuery . "`LockedTicketStatus` = 1 WHERE `ID` = ".intval($_POST['lockedTicketStatus']);
|
||||||
$stmt = hesk_dbConnect()->prepare($updateQuery);
|
hesk_dbQuery($updateQuery);
|
||||||
$stmt->bind_param('i', $_POST['defaultStaffReplyStatus']);
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
hesk_dbConnect()->query($defaultQuery . "`LockedTicketStatus` = 0");
|
hesk_dbQuery($defaultQuery . "`IsAutocloseOption` = 0");
|
||||||
$updateQuery = $defaultQuery . "`LockedTicketStatus` = 1 WHERE `ID` = ?";
|
$updateQuery = $defaultQuery . "`IsAutocloseOption` = 1 WHERE `ID` = ".intval($_POST['autocloseTicketOption']);
|
||||||
$stmt = hesk_dbConnect()->prepare($updateQuery);
|
hesk_dbQuery($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');
|
hesk_process_messages($hesklang['statuses_saved'],'manage_statuses.php','SUCCESS');
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateStatus($key, $textColor)
|
|
||||||
{
|
|
||||||
global $hesklang;
|
|
||||||
|
|
||||||
//-- Validation logic
|
|
||||||
if ($key == '')
|
|
||||||
{
|
|
||||||
hesk_process_messages($hesklang['key_required'], 'manage_statuses.php');
|
|
||||||
} elseif ($textColor == '')
|
|
||||||
{
|
|
||||||
hesk_process_messages($hesklang['textColorRequired'], 'manage_statuses.php');
|
|
||||||
}
|
|
||||||
}
|
|
@ -37,8 +37,10 @@ define('HESK_PATH','../');
|
|||||||
|
|
||||||
/* Get all the required files and functions */
|
/* Get all the required files and functions */
|
||||||
require(HESK_PATH . 'hesk_settings.inc.php');
|
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/common.inc.php');
|
||||||
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/status_functions.inc.php');
|
||||||
hesk_load_database_functions();
|
hesk_load_database_functions();
|
||||||
|
|
||||||
hesk_session_start();
|
hesk_session_start();
|
||||||
|
@ -1948,3 +1948,28 @@ function hesk_getFeatureArray() {
|
|||||||
'can_change_notification_settings', /* User can change notification settings */
|
'can_change_notification_settings', /* User can change notification settings */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mfh_doesStatusHaveXrefRecord($statusId, $language) {
|
||||||
|
global $hesk_settings;
|
||||||
|
|
||||||
|
$rs = hesk_dbQuery("SELECT 1 FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref`
|
||||||
|
WHERE `language` = '".hesk_dbEscape($language)."' AND `status_id` = ".intval($statusId));
|
||||||
|
return hesk_dbNumRows($rs) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mfh_getDisplayTextForStatusId($statusId) {
|
||||||
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
$statusRs = hesk_dbQuery("SELECT `text`, `Key`, `language` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` AS `statuses`
|
||||||
|
LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` ON `status_id` = `statuses`.`ID`
|
||||||
|
WHERE `statuses`.`ID` = ".intval($statusId));
|
||||||
|
|
||||||
|
$statusRec = hesk_dbFetchAssoc($statusRs);
|
||||||
|
if ($statusRec['language'] == $hesk_settings['language'] && $statusRec['text'] != NULL) {
|
||||||
|
// We found a record. Use the text field
|
||||||
|
return $statusRec['text'];
|
||||||
|
} else {
|
||||||
|
// Fallback to the language key
|
||||||
|
return $hesklang[$statusRec['Key']];
|
||||||
|
}
|
||||||
|
}
|
@ -112,23 +112,21 @@ $fid = 1;
|
|||||||
require(HESK_PATH . 'inc/assignment_search.inc.php');
|
require(HESK_PATH . 'inc/assignment_search.inc.php');
|
||||||
|
|
||||||
// --> TICKET STATUS
|
// --> TICKET STATUS
|
||||||
$statusSql = "SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`";
|
$statuses = mfh_getAllStatuses();
|
||||||
$totalStatuses = 0;
|
$totalStatuses = 0;
|
||||||
$possible_status = array();
|
$possible_status = array();
|
||||||
$results = hesk_dbQuery($statusSql);
|
foreach ($statuses as $row)
|
||||||
while ($row = $results->fetch_assoc())
|
|
||||||
{
|
{
|
||||||
array_push($possible_status, $row['ID']);
|
$possible_status[$row['ID']] = $row['ID'];
|
||||||
$totalStatuses++;
|
$totalStatuses++;
|
||||||
}
|
}
|
||||||
$status = $possible_status;
|
$status = $possible_status;
|
||||||
|
|
||||||
// Process statuses unless overridden with "s_all" variable
|
// Process statuses unless overridden with "s_all" variable
|
||||||
if ( ! hesk_GET('s_all') )
|
if ( ! hesk_GET('s_all') )
|
||||||
{
|
{
|
||||||
foreach ($status as $k => $v)
|
foreach ($status as $k => $v)
|
||||||
{
|
{
|
||||||
if (empty($_GET['s' . $k]))
|
if (empty($_GET['s' . $v]))
|
||||||
{
|
{
|
||||||
unset($status[$k]);
|
unset($status[$k]);
|
||||||
}
|
}
|
||||||
@ -145,10 +143,12 @@ if ( $tmp < $totalStatuses )
|
|||||||
if ($tmp == 0)
|
if ($tmp == 0)
|
||||||
{
|
{
|
||||||
$status = $possible_status;
|
$status = $possible_status;
|
||||||
$resolvedSql = "SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `IsClosed` = 1";
|
foreach ($statuses as $row)
|
||||||
$resolvedRS = hesk_dbQuery($resolvedSql);
|
|
||||||
while ($row = $resolvedRS->fetch_assoc())
|
|
||||||
{
|
{
|
||||||
|
if ($row['IsClosed'] == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
unset($status[$row['ID']]);
|
unset($status[$row['ID']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,11 +37,15 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
|
|||||||
if ( ! isset($status) )
|
if ( ! isset($status) )
|
||||||
{
|
{
|
||||||
$status = array();
|
$status = array();
|
||||||
|
$allStatuses = mfh_getAllStatuses();
|
||||||
//-- We don't want to check statuses that are considered "closed"
|
//-- We don't want to check statuses that are considered "closed"
|
||||||
$statusRS = hesk_dbQuery('SELECT `ID`, `Key` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 0');
|
foreach ($allStatuses as $row)
|
||||||
while ($row = $statusRS->fetch_assoc())
|
|
||||||
{
|
{
|
||||||
$status[$row['ID']] = $row['Key'];
|
if ($status['IsClosed'] == 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status[$row['ID']] = mfh_getDisplayTextForStatusId($row['ID']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,8 +135,8 @@ $more2 = empty($_GET['more2']) ? 0 : 1;
|
|||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
$rowCounter = 1;
|
$rowCounter = 1;
|
||||||
$statusRS = hesk_dbQuery('SELECT `ID`, `Key`, `TextColor` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
|
$statuses = mfh_getAllStatuses();
|
||||||
while ($row = $statusRS->fetch_assoc())
|
foreach ($statuses as $row)
|
||||||
{
|
{
|
||||||
if ($rowCounter > 3)
|
if ($rowCounter > 3)
|
||||||
{
|
{
|
||||||
@ -149,7 +153,7 @@ $more2 = empty($_GET['more2']) ? 0 : 1;
|
|||||||
}
|
}
|
||||||
echo '<label><input type="checkbox" name="s'.$row['ID'].'" value="1"';
|
echo '<label><input type="checkbox" name="s'.$row['ID'].'" value="1"';
|
||||||
if (isset($status[$row['ID']])) {echo 'checked="checked"';}
|
if (isset($status[$row['ID']])) {echo 'checked="checked"';}
|
||||||
echo '/> <span style="font-weight: bold;color: '.$row['TextColor'].';">'.$hesklang[$row['Key']].'</span></label></td>';
|
echo '/> <span style="font-weight: bold;color: '.$row['TextColor'].';">'.mfh_getDisplayTextForStatusId($row['ID']).'</span></label></td>';
|
||||||
|
|
||||||
$rowCounter++;
|
$rowCounter++;
|
||||||
}
|
}
|
||||||
|
55
inc/status_functions.inc.php
Normal file
55
inc/status_functions.inc.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/*******************************************************************************
|
||||||
|
* Title: Help Desk Software HESK
|
||||||
|
* Version: 2.6.4 from 22nd June 2015
|
||||||
|
* Author: Klemen Stirn
|
||||||
|
* Website: http://www.hesk.com
|
||||||
|
********************************************************************************
|
||||||
|
* COPYRIGHT AND TRADEMARK NOTICE
|
||||||
|
* Copyright 2005-2015 Klemen Stirn. All Rights Reserved.
|
||||||
|
* HESK is a registered trademark of Klemen Stirn.
|
||||||
|
|
||||||
|
* The HESK may be used and modified free of charge by anyone
|
||||||
|
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
|
||||||
|
* By using this code you agree to indemnify Klemen Stirn from any
|
||||||
|
* liability that might arise from it's use.
|
||||||
|
|
||||||
|
* Selling the code for this program, in part or full, without prior
|
||||||
|
* written consent is expressly forbidden.
|
||||||
|
|
||||||
|
* Using this code, in part or full, to create derivate work,
|
||||||
|
* new scripts or products is expressly forbidden. Obtain permission
|
||||||
|
* before redistributing this software over the Internet or in
|
||||||
|
* any other medium. In all cases copyright and header must remain intact.
|
||||||
|
* This Copyright is in full effect in any country that has International
|
||||||
|
* Trade Agreements with the United States of America or
|
||||||
|
* with the European Union.
|
||||||
|
|
||||||
|
* Removing any of the copyright notices without purchasing a license
|
||||||
|
* is expressly forbidden. To remove HESK copyright notice you must purchase
|
||||||
|
* a license for this script. For more information on how to obtain
|
||||||
|
* a license please visit the page below:
|
||||||
|
* https://www.hesk.com/buy.php
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/* Check if this is a valid include */
|
||||||
|
if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
|
||||||
|
|
||||||
|
|
||||||
|
function mfh_getAllStatuses() {
|
||||||
|
global $hesk_settings, $modsForHesk_settings;
|
||||||
|
|
||||||
|
$statusesSql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` ORDER BY `sort` ASC';
|
||||||
|
$statusesRS = hesk_dbQuery($statusesSql);
|
||||||
|
$statuses = array();
|
||||||
|
while ($row = hesk_dbFetchAssoc($statusesRS)) {
|
||||||
|
$row['text'] = mfh_getDisplayTextForStatusId($row['ID']);
|
||||||
|
$statuses[$row['text']] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($modsForHesk_settings['statuses_order_column'] == 'name') {
|
||||||
|
ksort($statuses);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $statuses;
|
||||||
|
}
|
@ -404,8 +404,9 @@ if ($total > 0)
|
|||||||
// Print ticket status
|
// Print ticket status
|
||||||
if ( hesk_show_column('status') )
|
if ( hesk_show_column('status') )
|
||||||
{
|
{
|
||||||
$statusName = hesk_dbFetchAssoc(hesk_dbQuery("SELECT `Key`, `TextColor` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE ID = ".$ticket['status']));
|
$statusRS = hesk_dbQuery("SELECT `ID`, `TextColor` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE ID = ".$ticket['status']);
|
||||||
$ticket['status']='<span style="color: '.$statusName['TextColor'].'">'.$hesklang[$statusName['Key']].'</span>';
|
$statusName = hesk_dbFetchAssoc($statusRS);
|
||||||
|
$ticket['status']='<span style="color: '.$statusName['TextColor'].'">'.mfh_getDisplayTextForStatusId($statusName['ID']).'</span>';
|
||||||
echo '<td class="'.$color.'">'.$ticket['status'].' </td>';
|
echo '<td class="'.$color.'">'.$ticket['status'].' </td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ if ($task == 'ip-email-bans') {
|
|||||||
print json_encode($jsonToSend);
|
print json_encode($jsonToSend);
|
||||||
} elseif ($task == 'migrate-bans') {
|
} elseif ($task == 'migrate-bans') {
|
||||||
migrateBans($_POST['user']);
|
migrateBans($_POST['user']);
|
||||||
|
} elseif ($task == 'initialize-statuses') {
|
||||||
|
initializeXrefTable();
|
||||||
} else {
|
} else {
|
||||||
$response = 'The task "'.$task.'" was not recognized. Check your spelling and try again.';
|
$response = 'The task "'.$task.'" was not recognized. Check your spelling and try again.';
|
||||||
print $response;
|
print $response;
|
||||||
|
@ -120,6 +120,10 @@ function printRow($version) {
|
|||||||
<td>Migrate IP / Email Bans</td>
|
<td>Migrate IP / Email Bans</td>
|
||||||
<td><i id="spinner-banmigrate" class="fa fa-spinner"></i> <span id="span-banmigrate">Waiting...</span></td>
|
<td><i id="spinner-banmigrate" class="fa fa-spinner"></i> <span id="span-banmigrate">Waiting...</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr id="row-initialize-statuses">
|
||||||
|
<td>Initialize Statuses</td>
|
||||||
|
<td><i id="spinner-initialize-statuses" class="fa fa-spinner"></i> <span id="span-initialize-statuses">Waiting...</span></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -62,7 +62,9 @@ function executeUpdate(version, cssclass, formattedVersion) {
|
|||||||
success: function(data) {
|
success: function(data) {
|
||||||
markUpdateAsSuccess(cssclass, formattedVersion);
|
markUpdateAsSuccess(cssclass, formattedVersion);
|
||||||
if (version == 200) {
|
if (version == 200) {
|
||||||
migrateIpEmailBans('banmigrate', cssclass);
|
migrateIpEmailBans('banmigrate', 'banmigrate');
|
||||||
|
} else if (version == 240) {
|
||||||
|
initializeStatuses('initialize-statuses', 'initialize-statuses');
|
||||||
} else {
|
} else {
|
||||||
processUpdates(version);
|
processUpdates(version);
|
||||||
}
|
}
|
||||||
@ -83,7 +85,6 @@ function migrateIpEmailBans(version, cssclass) {
|
|||||||
data: { task: 'ip-email-bans' },
|
data: { task: 'ip-email-bans' },
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var parsedData = $.parseJSON(data);
|
var parsedData = $.parseJSON(data);
|
||||||
console.info(parsedData);
|
|
||||||
if (parsedData.status == 'ATTENTION') {
|
if (parsedData.status == 'ATTENTION') {
|
||||||
appendToInstallConsole('<tr><td><span class="label label-warning">WARNING</span></td><td>Your response is needed. Please check above.</td></tr>');
|
appendToInstallConsole('<tr><td><span class="label label-warning">WARNING</span></td><td>Your response is needed. Please check above.</td></tr>');
|
||||||
markUpdateAsAttention(version);
|
markUpdateAsAttention(version);
|
||||||
@ -94,11 +95,33 @@ function migrateIpEmailBans(version, cssclass) {
|
|||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
appendToInstallConsole('<tr><td><span class="label label-danger">ERROR</span></td><td>' + data.responseText + '</td></tr>');
|
appendToInstallConsole('<tr><td><span class="label label-danger">ERROR</span></td><td>' + data.responseText + '</td></tr>');
|
||||||
markUpdateAsFailure(cssclass);
|
markUpdateAsFailure(version);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initializeStatuses(version, cssclass) {
|
||||||
|
startVersionUpgrade(version);
|
||||||
|
appendToInstallConsole('<tr><td><span class="label label-info">INFO</span></td><td>Initializing Statuses</td></tr>');
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: 'ajax/task-ajax.php',
|
||||||
|
data: { task: 'initialize-statuses' },
|
||||||
|
success: function(data) {
|
||||||
|
markUpdateAsSuccess(cssclass, 'Initializing Statuses');
|
||||||
|
statusesInitialized();
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
appendToInstallConsole('<tr><td><span class="label label-danger">ERROR</span></td><td>' + data.responseText + '</td></tr>');
|
||||||
|
markUpdateAsFailure(version);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function statusesInitialized() {
|
||||||
|
processUpdates(240);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function runMigration() {
|
function runMigration() {
|
||||||
// Get user ID that is selected
|
// Get user ID that is selected
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
define('IN_SCRIPT', 1);
|
||||||
require(HESK_PATH . 'hesk_settings.inc.php');
|
require(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
echo $hesklang['yes'];
|
||||||
|
|
||||||
function executeQuery($sql) {
|
function executeQuery($sql) {
|
||||||
global $hesk_last_query;
|
global $hesk_last_query;
|
||||||
@ -561,6 +564,39 @@ function execute240Scripts() {
|
|||||||
VALUES ('view_ticket', '1')");
|
VALUES ('view_ticket', '1')");
|
||||||
executeQuery("INSERT INTO `hesk_quick_help_sections` (`location`, `show`)
|
executeQuery("INSERT INTO `hesk_quick_help_sections` (`location`, `show`)
|
||||||
VALUES ('knowledgebase', '1')");
|
VALUES ('knowledgebase', '1')");
|
||||||
|
|
||||||
|
executeQuery("CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`language` VARCHAR(200) NOT NULL,
|
||||||
|
`text` VARCHAR(200) NOT NULL,
|
||||||
|
`status_id` INT NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ADD COLUMN `sort` INT");
|
||||||
|
$statusesRs = executeQuery("SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `ID` ASC");
|
||||||
|
$i = 10;
|
||||||
|
while ($myStatus = hesk_dbFetchAssoc($statusesRs)) {
|
||||||
|
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `sort`=".intval($i)."
|
||||||
|
WHERE `id`='".intval($myStatus['ID'])."' LIMIT 1");
|
||||||
|
$i += 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeXrefTable() {
|
||||||
|
global $hesk_settings, $hesklang;
|
||||||
|
|
||||||
|
$languages = array();
|
||||||
|
foreach ($hesk_settings['languages'] as $key => $value) {
|
||||||
|
$languages[$key] = $hesk_settings['languages'][$key]['folder'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$statusesRs = executeQuery("SELECT `ID`, `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`");
|
||||||
|
while ($row = hesk_dbFetchAssoc($statusesRs)) {
|
||||||
|
foreach ($languages as $language => $languageCode) {
|
||||||
|
$sql = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` (`language`, `text`, `status_id`)
|
||||||
|
VALUES ('".hesk_dbEscape($language)."', '".hesk_dbEscape($hesklang[$row['Key']])."', ".intval($row['ID']).")";
|
||||||
|
executeQuery($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function execute240FileUpdate() {
|
function execute240FileUpdate() {
|
||||||
|
@ -32,6 +32,23 @@ $hesklang['quick_help_sections_help'] = 'Check the checkbox to show the "Quick H
|
|||||||
$hesklang['create_ticket'] = 'Create ticket';
|
$hesklang['create_ticket'] = 'Create ticket';
|
||||||
$hesklang['view_ticket_form'] = 'View ticket form';
|
$hesklang['view_ticket_form'] = 'View ticket form';
|
||||||
$hesklang['knowledgebase'] = 'Knowledgebase section';
|
$hesklang['knowledgebase'] = 'Knowledgebase section';
|
||||||
|
$hesklang['click_to_edit_name'] = 'Click to edit name';
|
||||||
|
$hesklang['new_status'] = 'New Status';
|
||||||
|
$hesklang['create_new_status_title'] = 'Create New Status';
|
||||||
|
$hesklang['status_name_title'] = 'Status Name';
|
||||||
|
$hesklang['properties'] = 'Properties';
|
||||||
|
$hesklang['closable'] = 'Closable'; // Same as $hesklang['closable_question'], but without punctuation
|
||||||
|
$hesklang['new_status_created'] = 'New status successfully created';
|
||||||
|
$hesklang['editing_status_x'] = 'Editing status <span style="color: %s; font-weight: bold">%s</span>'; // 1st %s: text color, 2nd %s: status name
|
||||||
|
$hesklang['status_not_in_database'] = 'The status text for this language was not found in the database, so a suggested translation has been filled for you.
|
||||||
|
Please click "Save Changes" to save this translation to the database and to remove this warning.';
|
||||||
|
$hesklang['ticket_status_updated'] = 'Ticket status successfully updated!';
|
||||||
|
$hesklang['ticket_status_deleted'] = 'Ticket status deleted!';
|
||||||
|
$hesklang['confirm_delete_status_question'] = 'Delete status?';
|
||||||
|
$hesklang['confirm_delete_status'] = 'Are you sure you want to delete this status? This cannot be undone!';
|
||||||
|
$hesklang['status_sort_updated'] = 'Ticket status sort updated!';
|
||||||
|
$hesklang['status_sort'] = 'Status Sorting';
|
||||||
|
$hesklang['status_sort_help'] = 'Determines if statuses shown on the manage statuses page and all dropdowns are sorted by the user-defined order (default), or sorted alphabetically.';
|
||||||
|
|
||||||
// ADDED OR MODIFIED IN Mods for HESK 2.3.0
|
// ADDED OR MODIFIED IN Mods for HESK 2.3.0
|
||||||
$hesklang['sm_icon'] = 'Icon';
|
$hesklang['sm_icon'] = 'Icon';
|
||||||
|
@ -50,3 +50,6 @@ $modsForHesk_settings['request_location'] = 0;
|
|||||||
|
|
||||||
//-- Column to sort categories by. Can be either 'name' or 'cat_order'
|
//-- Column to sort categories by. Can be either 'name' or 'cat_order'
|
||||||
$modsForHesk_settings['category_order_column'] = 'cat_order';
|
$modsForHesk_settings['category_order_column'] = 'cat_order';
|
||||||
|
|
||||||
|
//-- Column to sort statuses by. Can be either 'sort' or 'name'
|
||||||
|
$modsForHesk_settings['statuses_order_column'] = 'sort';
|
@ -315,8 +315,7 @@ if (!$show['show']) {
|
|||||||
$repliesColumnWidth = 3;
|
$repliesColumnWidth = 3;
|
||||||
}
|
}
|
||||||
echo '<div class="col-md-3 col-sm-12 ticket-cell"><p class="ticketPropertyTitle">'.$hesklang['status'].'</p>';
|
echo '<div class="col-md-3 col-sm-12 ticket-cell"><p class="ticketPropertyTitle">'.$hesklang['status'].'</p>';
|
||||||
$ticketStatusKey = $status['Key'];
|
echo '<p class="ticketPropertyText">'.mfh_getDisplayTextForStatusId($status['ID']).'</p>';
|
||||||
echo '<p class="ticketPropertyText">'.$hesklang[$ticketStatusKey].'</p>';
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="col-md-3 col-sm-12 ticket-cell"><p class="ticketPropertyTitle">'.$hesklang['last_replier'].'</p>
|
echo '<div class="col-md-3 col-sm-12 ticket-cell"><p class="ticketPropertyTitle">'.$hesklang['last_replier'].'</p>
|
||||||
<p class="ticketPropertyText">'.$ticket['repliername'].'</p></div>';
|
<p class="ticketPropertyText">'.$ticket['repliername'].'</p></div>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user