You are here

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

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

@todo Please document this function.

See also

http://drupal.org/node/1354

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 719
MERCI - Managed Equipment Reservation Checkout and Inventory

Code

function merci_get_count($type, $default_availability = MERCI_AVA_F) {

  // TODO Please convert this statement to the D7 database API syntax.
  return 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 = :type \n      AND mbn.merci_default_availability = :merci_default_availability\n      AND mbn.merci_sub_type = :merci_sub_type", array(
    ':type' => $type['type'],
    ':merci_default_availability' => $default_availability,
    ':merci_sub_type' => MERCI_SUB_TYPE_ITEM,
  ))
    ->fetchField();
}