You are here

function pmtimetracking_update in Drupal PM (Project Management) 7

Implements hook_update().

File

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

Code

function pmtimetracking_update($node) {
  _pmtimetracking_beforesave($node);

  // If this is a new revision, then it is actually an insert operation
  if ($node->revision) {
    pmtimetracking_insert($node);
  }
  else {
    db_update('pmtimetracking')
      ->fields(array(
      'vid' => $node->vid,
      'nid' => $node->nid,
      'organization_nid' => $node->organization_nid,
      'organization_title' => $node->organization_title,
      'project_nid' => $node->project_nid,
      'project_title' => $node->project_title,
      'task_nid' => $node->task_nid,
      'task_title' => $node->task_title,
      'task_stepno' => $node->task_stepno,
      'ticket_nid' => $node->ticket_nid,
      'ticket_title' => $node->ticket_title,
      'duration' => $node->duration,
      'billing_duration' => $node->billing_duration,
    ))
      ->condition('vid', $node->vid)
      ->execute();
  }
}