#209 Some performance tweaks; also use function for rest of page
This commit is contained in:
parent
2b6807137f
commit
05be7d7041
@ -81,9 +81,10 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
$numOfStatusesRS = hesk_dbQuery('SELECT 1 FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
|
$numOfStatusesRS = hesk_dbQuery('SELECT 1 FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
|
||||||
$numberOfStatuses = hesk_dbNumRows($numOfStatusesRS);
|
$numberOfStatuses = hesk_dbNumRows($numOfStatusesRS);
|
||||||
|
|
||||||
$statusesSql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`';
|
$statusesSql = 'SELECT `ID`, `IsAutocloseOption`, `TextColor`, `Closable`, `IsClosed` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`';
|
||||||
$closedStatusesSql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 1';
|
$closedStatusesSql = 'SELECT `ID`, `IsClosedByClient` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 1';
|
||||||
$openStatusesSql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 0';
|
$openStatusesSql = 'SELECT `ID`, `IsNewTicketStatus`, `IsStaffReopenedStatus`, `IsDefaultStaffReplyStatus` FROM
|
||||||
|
`'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 0';
|
||||||
$statusesRS = hesk_dbQuery($statusesSql);
|
$statusesRS = hesk_dbQuery($statusesSql);
|
||||||
?>
|
?>
|
||||||
<form class="form-horizontal" method="post" action="manage_statuses.php" role="form">
|
<form class="form-horizontal" method="post" action="manage_statuses.php" role="form">
|
||||||
@ -135,7 +136,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
if ($row['IsClosed']) {
|
if ($row['IsClosed']) {
|
||||||
echo $hesklang['yes_title_case'];
|
echo '<i class="fa fa-check-circle icon-link" style="color: green;"></i>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
@ -168,7 +169,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
while ($row = $statusesRS->fetch_assoc())
|
while ($row = $statusesRS->fetch_assoc())
|
||||||
{
|
{
|
||||||
$selectedEcho = ($row['IsNewTicketStatus'] == 1) ? 'selected="selected"' : '';
|
$selectedEcho = ($row['IsNewTicketStatus'] == 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>
|
||||||
@ -183,7 +184,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
while ($row = $statusesRS->fetch_assoc())
|
while ($row = $statusesRS->fetch_assoc())
|
||||||
{
|
{
|
||||||
$selectedEcho = ($row['IsClosedByClient'] == 1) ? 'selected="selected"' : '';
|
$selectedEcho = ($row['IsClosedByClient'] == 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>
|
||||||
@ -198,7 +199,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
while ($row = $statusesRS->fetch_assoc())
|
while ($row = $statusesRS->fetch_assoc())
|
||||||
{
|
{
|
||||||
$selectedEcho = ($row['IsCustomerReplyStatus'] == 1) ? 'selected="selected"' : '';
|
$selectedEcho = ($row['IsCustomerReplyStatus'] == 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>
|
||||||
@ -213,7 +214,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
while ($row = $statusesRS->fetch_assoc())
|
while ($row = $statusesRS->fetch_assoc())
|
||||||
{
|
{
|
||||||
$selectedEcho = ($row['IsStaffClosedOption'] == 1) ? 'selected="selected"' : '';
|
$selectedEcho = ($row['IsStaffClosedOption'] == 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>
|
||||||
@ -228,7 +229,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
while ($row = $statusesRS->fetch_assoc())
|
while ($row = $statusesRS->fetch_assoc())
|
||||||
{
|
{
|
||||||
$selectedEcho = ($row['IsStaffReopenedStatus'] == 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>
|
||||||
@ -243,7 +244,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
while ($row = $statusesRS->fetch_assoc())
|
while ($row = $statusesRS->fetch_assoc())
|
||||||
{
|
{
|
||||||
$selectedEcho = ($row['IsDefaultStaffReplyStatus'] == 1) ? 'selected="selected"' : '';
|
$selectedEcho = ($row['IsDefaultStaffReplyStatus'] == 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>
|
||||||
@ -258,7 +259,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
while ($row = $statusesRS->fetch_assoc())
|
while ($row = $statusesRS->fetch_assoc())
|
||||||
{
|
{
|
||||||
$selectedEcho = ($row['LockedTicketStatus'] == 1) ? 'selected="selected"' : '';
|
$selectedEcho = ($row['LockedTicketStatus'] == 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>
|
||||||
@ -273,7 +274,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
while ($row = $statusesRS->fetch_assoc())
|
while ($row = $statusesRS->fetch_assoc())
|
||||||
{
|
{
|
||||||
$selectedEcho = ($row['IsAutocloseOption'] == 1) ? 'selected' : '';
|
$selectedEcho = ($row['IsAutocloseOption'] == 1) ? 'selected' : '';
|
||||||
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.$hesklang[$row['Key']].'</option>';
|
echo '<option value="'.$row['ID'].'" '.$selectedEcho.'>'.mfh_getDisplayTextForStatusId($row['ID']).'</option>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@ -1952,17 +1952,16 @@ function hesk_getFeatureArray() {
|
|||||||
function mfh_getDisplayTextForStatusId($statusId) {
|
function mfh_getDisplayTextForStatusId($statusId) {
|
||||||
global $hesklang, $hesk_settings;
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
$xrefRs = hesk_dbQuery("SELECT `text` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref`
|
$statusRs = hesk_dbQuery("SELECT `text`, `Key`, `language` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` AS `statuses`
|
||||||
WHERE `status_id` = ".intval($statusId)."
|
LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` ON `status_id` = `statuses`.`ID`
|
||||||
AND `language` = '".hesk_dbEscape($hesk_settings['language'])."'");
|
WHERE `statuses`.`ID` = ".intval($statusId));
|
||||||
if (hesk_dbNumRows($xrefRs) == 1) {
|
|
||||||
|
$statusRec = hesk_dbFetchAssoc($statusRs);
|
||||||
|
if ($statusRec['language'] == $hesk_settings['language'] && $statusRec['text'] != NULL) {
|
||||||
// We found a record. Use the text field
|
// We found a record. Use the text field
|
||||||
$xrefRecord = hesk_dbFetchAssoc($xrefRs);
|
return $statusRec['text'];
|
||||||
return $xrefRecord['text'];
|
|
||||||
} else {
|
} else {
|
||||||
// Fallback to the language key
|
// Fallback to the language key
|
||||||
$statusRs = hesk_dbQuery("SELECT `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `ID` = ".intval($statusId));
|
|
||||||
$statusRec = hesk_dbFetchAssoc($statusRs);
|
|
||||||
return $hesklang[$statusRec['Key']];
|
return $hesklang[$statusRec['Key']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user