function merci_delete in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6.2
Same name and namespace in other branches
- 6 merci.module \merci_delete()
- 7.2 merci.module \merci_delete()
Implementation of hook_delete().
File
- ./
merci.module, line 260 - MERCI - Managed Equipment Reservation Checkout and Inventory
Code
function merci_delete($node) {
foreach ($node->merci_reservation_items as $item) {
// Set the checked out item back to checked in.
if ($node->merci_reservation_status == MERCI_STATUS_CHECKED_OUT) {
$update = array(
'nid' => $item['merci_item_nid'],
'merci_item_status' => MERCI_ITEM_STATUS_AVAILABLE,
);
drupal_write_record('merci_reservation_item_node', $update, 'nid');
}
// Remove the placeholder node.
node_delete($item['merci_placeholder_nid']);
}
merci_delete_record('merci_reservation', $node, 'nid');
merci_delete_record('merci_reservation_detail', $node, 'nid');
}