function pminvoice_update in Drupal PM (Project Management) 7
Implements hook_update().
File
- pminvoice/
pminvoice.module, line 543 - 1: Hooks (help, perm, init, menu, theme, node_info) 2: Access functions 3: Load organization and project details 4: Invoice create / edit form 5: Invoice node manipulation functions 6: Admin settings 7: Views hook 8: Project Managementinvoiceitem…
Code
function pminvoice_update($node) {
_pminvoice_beforesave($node);
if ($node->revision) {
pminvoice_insert($node);
}
else {
db_update('pminvoice')
->fields(array(
'number' => $node->number,
'reference' => $node->reference,
'organization_nid' => $node->organization_nid,
'organization_title' => $node->organization_title,
'project_nid' => $node->project_nid,
'project_title' => $node->project_title,
'amount' => $node->amount,
'tax1' => $node->tax1,
'tax2' => $node->tax2,
'total' => $node->total,
'totalcustomercurr' => $node->totalcustomercurr,
'taxexempt' => $node->taxexempt,
'src_nid' => $node->src_nid,
'src_vid' => $node->src_vid,
))
->condition('vid', $node->vid)
->execute();
// Update invoice items
db_delete('pminvoice_items')
->condition('invoice_vid', $node->vid)
->execute();
_pminvoice_insert_items($node);
_pminvoice_aftersave($node);
}
}