function library_get_overdue_items in Library 6
Same name and namespace in other branches
- 5.2 library.module \library_get_overdue_items()
- 6.2 library.module \library_get_overdue_items()
- 7 library.module \library_get_overdue_items()
Returns a list of overdue library items
3 calls to library_get_overdue_items()
- library_cron in ./
library.module - Implementation of hook_cron().
- library_notify_overdue in ./
library.admin.inc - library_overdue_items in ./
library.pages.inc
File
- ./
library.module, line 931
Code
function library_get_overdue_items() {
//Select all the nodes that have ever had an item made unavailable
$items = db_query("SELECT id FROM {library} WHERE library_status = %d", LIBRARY_ITEM_UNAVAILABLE);
$overdueitems = array();
while ($result = db_fetch_object($items)) {
$item = library_load($result->id);
if (!empty($item->last_patron_id) && !empty($item->last_due_date) && time() > $item->last_due_date) {
$patron = node_load($item->last_patron_id);
if (!isset($overdueitems[$item->last_patron_id]['patron']['patron_email'])) {
$overdueitems[$item->last_patron_id]['patron']['patron_email'] = $patron->email;
$overdueitems[$item->last_patron_id]['patron']['patron_name'] = $patron->name_first . ' ' . $patron->name_last;
}
$overdueitems[$item->last_patron_id]['items'][$item->id] = array(
'item_name' => $item->title,
'nid' => $item->nid,
'due_date' => $item->last_due_date,
'in_circulation' => $item->in_circulation,
);
}
}
return $overdueitems;
}