You are here

function merci_delete in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6

Same name and namespace in other branches
  1. 6.2 merci.module \merci_delete()
  2. 7.2 merci.module \merci_delete()

Implementation of hook_delete().

File

./merci.module, line 1853
MERCI - Managed Equipment Reservation Checkout and Inventory

Code

function merci_delete($node) {
  if ($node->type == 'merci_reservation') {

    // Delete all reservation placeholder nodes for the reservation.
    $placeholders = db_query("SELECT DISTINCT(placeholder_nid) AS nid FROM {merci_reservation_detail} WHERE nid = %d", $node->nid);
    while ($placeholder = db_fetch_object($placeholders)) {
      node_delete($placeholder->nid);
    }
    db_query("DELETE FROM {merci_reservation} WHERE nid = %d", $node->nid);
    db_query("DELETE FROM {merci_reservation_detail} WHERE nid = %d", $node->nid);
  }
}