You are here

function pmexpense_update in Drupal PM (Project Management) 7

Implements hook_update().

File

pmexpense/pmexpense.module, line 561
Hook implementations and main functions for PM Expense.

Code

function pmexpense_update($node) {
  _pmexpense_beforesave($node);
  if ($node->revision) {
    pmexpense_insert($node);
  }
  else {
    db_update('pmexpense')
      ->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' => isset($node->project_title) ? $node->project_title : NULL,
      'task_nid' => $node->task_nid,
      'task_title' => isset($node->task_title) ? $node->task_title : NULL,
      'task_stepno' => isset($node->task_stepno) ? $node->task_stepno : NULL,
      'ticket_nid' => $node->ticket_nid,
      'ticket_title' => isset($node->ticket_title) ? $node->ticket_title : NULL,
      'provider_nid' => isset($node->provider_nid) ? $node->provider_nid : NULL,
      'provider_title' => $node->provider_title,
      'amount' => $node->amount,
      'tax1app' => $node->tax1app,
      'tax1percent' => $node->tax1percent,
      'tax1' => $node->tax1,
      'subtotal' => $node->subtotal,
      'tax2app' => $node->tax2app,
      'tax2percent' => $node->tax2percent,
      'tax2' => $node->tax2,
      'total' => $node->total,
    ))
      ->condition('vid', $node->vid)
      ->execute();
  }
}