You are here

function pmtimetracking_load in Drupal PM (Project Management) 7

Implements hook_load().

File

pmtimetracking/pmtimetracking.module, line 583
Main module functions for PM Timetracking.

Code

function pmtimetracking_load($nodes) {
  foreach ($nodes as $nid => &$node) {
    $result = db_select('pmtimetracking', 'sta')
      ->fields('sta')
      ->condition('vid', $node->vid)
      ->execute();
    $record = $result
      ->fetchAssoc();
    if (empty($record)) {
      watchdog('PM: Empty entry in table', 'Node was found but corresponding entry in pmtimetracking table was not found.');
      continue;
    }
    foreach ($record as $key => $value) {
      $node->{$key} = $value;
    }
    $node->title_old = $node->title;
  }
}