You are here

function _support_comment_update_node in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support.module \_support_comment_update_node()

Helper function.

2 calls to _support_comment_update_node()
support_comment_delete in ./support.module
Implementation of hook_comment_delete().
_support_comment_insert_update in ./support.module

File

./support.module, line 2120
support.module

Code

function _support_comment_update_node($nid) {
  $cid = db_query('SELECT MAX(cid) FROM {comment} WHERE nid = :nid', array(
    ':nid' => $nid,
  ))
    ->fetchField();
  if ($cid) {
    $comment = db_select('support_ticket_comment', 't')
      ->condition('t.cid', $cid)
      ->fields('t')
      ->execute()
      ->fetchObject();
    if ($comment) {
      db_update('support_ticket')
        ->fields(array(
        'state' => $comment->state,
        'priority' => $comment->priority,
        'client' => $comment->client,
        'assigned' => $comment->assigned,
      ))
        ->condition('nid', $nid)
        ->execute();
    }
  }
}