#209 Add ability get status text based on xref or fallback

This commit is contained in:
Mike Koch 2015-07-25 22:08:07 -04:00
parent 03718e2632
commit 2b6807137f
2 changed files with 19 additions and 1 deletions

View File

@ -117,7 +117,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
?> ?>
<tr id="s<?php echo $row['ID']; ?>_row"> <tr id="s<?php echo $row['ID']; ?>_row">
<td style="color: <?php echo $row['TextColor']; ?>; font-weight: bold"> <td style="color: <?php echo $row['TextColor']; ?>; font-weight: bold">
<?php echo $hesklang[$row['Key']]; ?> <?php echo mfh_getDisplayTextForStatusId($row['ID']); ?>
</td> </td>
<td> <td>
<?php <?php

View File

@ -1947,4 +1947,22 @@ function hesk_getFeatureArray() {
'can_man_settings', /* User can manage helpdesk settings */ 'can_man_settings', /* User can manage helpdesk settings */
'can_change_notification_settings', /* User can change notification settings */ 'can_change_notification_settings', /* User can change notification settings */
); );
}
function mfh_getDisplayTextForStatusId($statusId) {
global $hesklang, $hesk_settings;
$xrefRs = hesk_dbQuery("SELECT `text` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref`
WHERE `status_id` = ".intval($statusId)."
AND `language` = '".hesk_dbEscape($hesk_settings['language'])."'");
if (hesk_dbNumRows($xrefRs) == 1) {
// We found a record. Use the text field
$xrefRecord = hesk_dbFetchAssoc($xrefRs);
return $xrefRecord['text'];
} else {
// 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']];
}
} }