You are here

function library_notify_overdue in Library 6

Same name and namespace in other branches
  1. 5.2 library.admin.inc \library_notify_overdue()
  2. 6.2 library.admin.inc \library_notify_overdue()
  3. 7 library.admin.inc \library_notify_overdue()
1 string reference to 'library_notify_overdue'
library_menu in ./library.module
Implementation of hook_menu().

File

./library.admin.inc, line 403
Administrative settings for the library module

Code

function library_notify_overdue() {
  if (library_duedates_enabled()) {
    $records = library_get_overdue_items();
    if (empty($records)) {
      drupal_set_message(t('No patrons with overdue items at this time.'));
    }
    else {
      $num_emails = 0;
      foreach ($records as $patron_id => $record) {
        $params = $record;
        drupal_mail('library', 'notify_overdue', $params['patron']['patron_email'], language_default(), $params);
        $num_emails++;
      }
      drupal_set_message(t($num_emails . ' email(s) sent successfully.'));
      watchdog('library', '%number overdue email notifications sent successfully.', array(
        '%number' => $num_emails,
      ));
    }
  }
  else {
    drupal_set_message(t('Library due dates are not enabled.'));
  }
  drupal_goto('library-items/overdue');
}