function merci_get_reservation_count in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.2
Same name and namespace in other branches
- 6.2 includes/database.inc \merci_get_reservation_count()
merci_get_reservation_count($content_type[string]) returns total number of checked out items for content type. @ $content_type resource to be counted
2 calls to merci_get_reservation_count()
- MerciUserTestCase::testMerciCheckedOutCase in tests/
merci_user.test - theme_merci_current_inventory in theme/
theme.inc - returns the number of items currently checked out for each content type TODO: change this to a views view.
File
- includes/
database.inc, line 175 - MERCI - Managed Equipment Reservation Checkout and Inventory
Code
function merci_get_reservation_count($content_type) {
return db_query("SELECT COUNT(n.nid) as total FROM {node} n\n JOIN {merci_reservation_detail} mrin ON mrin.vid = n.vid\n JOIN {node} ctn ON mrin.merci_item_nid = ctn.nid\n WHERE ctn.type = :type and mrin.merci_item_status = :merci_item_status", array(
':type' => $content_type,
':merci_item_status' => MERCI_ITEM_STATUS_CHECKED_OUT,
))
->fetchField();
}