function library_load in Library 6
Same name and namespace in other branches
- 5.2 library.module \library_load()
- 6.2 library.module \library_load()
- 7 library.module \library_load()
Menu callback; loads a library object
6 calls to library_load()
- library_get_item_by_barcode in ./
library.module - library_get_overdue_items in ./
library.module - Returns a list of overdue library items
- library_get_transactions_by_patron in ./
library.module - library_load_items in ./
library.module - Load Library Item Data for a given node
- library_renew_action in ./
library.actions.inc - Implementation of a Drupal action. Renews a library item if it is checked out and due dates are enabled.
File
- ./
library.module, line 442
Code
function library_load($item_id) {
if (!is_numeric($item_id)) {
return FALSE;
}
else {
$item = db_fetch_object(db_query_range("SELECT * FROM {library} l, {node} n WHERE n.nid = l.nid AND id = %d", $item_id, 0, 1));
if ($item->in_circulation == LIBRARY_CIRCULATION && $item->library_status == LIBRARY_ITEM_UNAVAILABLE) {
$last = library_get_last_transaction_by_item($item, LIBRARY_ACTION_TYPE_UNAVAILABLE);
if ($last) {
$item->last_patron_id = $last->patron_id;
$item->last_transaction_id = $last->tid;
$item->last_transaction_name = $last->action_name;
if (!empty($last->duedate)) {
$item->last_due_date = $last->duedate;
}
}
}
}
return $item;
}