You are here

function merci_get_count in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6.2

Same name and namespace in other branches
  1. 7.2 includes/database.inc \merci_get_count()

merci_get_count ($content_type, $default_availability) returns total number of items available for check out. @ $content_type resource to be counted @ $default_availability

1 call to merci_get_count()
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 642
MERCI - Managed Equipment Reservation Checkout and Inventory

Code

function merci_get_count($type, $default_availability = MERCI_AVA_F) {
  return db_result(db_query("SELECT COUNT(n.nid) as total FROM {node} n\n      LEFT JOIN {merci_" . $type['merci_type_setting'] . "_node} mbn ON n.vid = mbn.vid\n      WHERE n.type = '%s'\n      AND mbn.merci_default_availability = %d\n      AND mbn.merci_sub_type = %d", $type['type'], $default_availability, MERCI_SUB_TYPE_ITEM));
}