You are here

function support_comment_view in Support Ticketing System 6

Same name and namespace in other branches
  1. 7 support.module \support_comment_view()

Display state, priority and client when viewing comments for support nodes.

1 call to support_comment_view()
support_comment in ./support.module
Implementation of hook_comment().

File

./support.module, line 1023
support.module

Code

function support_comment_view(&$comment) {
  static $state = 0;
  static $priority = 0;
  static $client = 0;
  static $assigned = 0;
  $current = db_fetch_object(db_query('SELECT state, priority, client, assigned FROM {support_ticket_comment} WHERE cid = %d', $comment->cid));
  if (!empty($current) && $assigned != $current->assigned) {
    $previous_account = user_load(array(
      'uid' => $assigned,
    ));
    $current_account = user_load(array(
      'uid' => $current->assigned,
    ));
    $comment->comment = '<div class="support-assigned">' . t('Assigned') . ': ' . ($previous_account->name ? check_plain($previous_account->name) : '<em>' . t('unassigned') . '</em>') . ' -> ' . ($current_account->name ? check_plain($current_account->name) : '<em>' . t('unassigned') . '</em>') . "</div>\n" . $comment->comment;
    $assigned = $current->assigned;
  }
  if (!empty($current) && $client != $current->client) {
    $comment->comment = '<div class="support-client">' . t('Client') . ': ' . check_plain(_support_client($client)) . ' -> ' . check_plain(_support_client($current->client)) . "</div>\n" . $comment->comment;
    $client = $current->client;
  }
  if (!empty($current) && $state != $current->state) {
    $comment->comment = '<div class="support-state">' . t('State') . ': ' . check_plain(_support_state($state)) . ' -> ' . check_plain(_support_state($current->state)) . "</div>\n" . $comment->comment;
    $state = $current->state;
  }
  if (!empty($current) && $priority != $current->priority) {
    $comment->comment = '<div class="support-priority">' . t('Priority') . ': ' . check_plain(_support_priorities($priority)) . ' -> ' . check_plain(_support_priorities($current->priority)) . "</div>\n" . $comment->comment;
    $priority = $current->priority;
  }
}