You are here

function invoice_delete in Invoice 7

Same name and namespace in other branches
  1. 6 invoice.module \invoice_delete()

Implemenation of hook_delete()

File

./invoice.module, line 971
Invoice module

Code

function invoice_delete(&$node) {
  $invoice_number = db_query("SELECT iid FROM {invoice_invoices} WHERE nid = :nid", array(
    ':nid' => $node->nid,
  ))
    ->fetchField();
  db_delete('invoice_invoices')
    ->condition('iid', $invoice_number)
    ->execute();
  db_delete('invoice_customers')
    ->condition('invoice_id', $invoice_number)
    ->execute();
  db_delete('invoice_items')
    ->condition('invoice_id', $invoice_number)
    ->execute();
  unset($_SESSION['invoice_template']);
}