function merci_checked_out_reservations_for_item_nid in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.2
Same name and namespace in other branches
- 6.2 includes/database.inc \merci_checked_out_reservations_for_item_nid()
1 call to merci_checked_out_reservations_for_item_nid()
- merci_validate_status in includes/
api.inc
File
- includes/
database.inc, line 253 - MERCI - Managed Equipment Reservation Checkout and Inventory
Code
function merci_checked_out_reservations_for_item_nid($nid, $exclude_nid) {
// Pull any incomplete reservations that use the item in question
$reservations = db_query("SELECT n.nid, n.title FROM {node} n INNER JOIN {merci_reservation_detail} md ON n.vid = md.vid WHERE n.nid != :exclude_nid AND md.merci_item_nid = :nid AND (md.merci_item_status = :merci_item_status)", array(
':exclude_nid' => $exclude_nid,
':nid' => $nid,
':merci_item_status' => MERCI_ITEM_STATUS_CHECKED_OUT,
));
$bad_reservations = array();
foreach ($reservations as $reservation) {
$bad_reservations[] = l($reservation->title, "node/{$reservation->nid}/edit", array(
'query' => drupal_get_destination(),
));
}
return $bad_reservations;
}