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

merge-requests/2/head
Mike Koch 9 years ago
parent 03718e2632
commit 2b6807137f

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

@ -1947,4 +1947,22 @@ function hesk_getFeatureArray() {
'can_man_settings', /* User can manage helpdesk 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']];
}
}
Loading…
Cancel
Save