You are here

function casetracker_node_load in Case Tracker 7

Implements hook_node_load().

File

./casetracker.module, line 231
Enables the handling of projects and their cases.

Code

function casetracker_node_load($nodes, $types) {
  foreach ($nodes as $node) {
    if (casetracker_is_case($node->type)) {
      $casetracker = db_select('casetracker_case', 'c')
        ->fields('c', array(
        'pid',
        'case_priority_id',
        'case_type_id',
        'assign_to',
        'case_status_id',
      ))
        ->condition('c.nid', $node->nid)
        ->condition('c.vid', $node->vid)
        ->execute()
        ->fetchObject();
      if ($casetracker) {
        if ($casetracker->pid == '0') {
          $casetracker->pid = $node->nid;
        }
        $nodes[$node->nid]->casetracker = $casetracker;
      }
    }
  }
}