You are here

function library_get_due_date in Library 6

Same name and namespace in other branches
  1. 5.2 library.module \library_get_due_date()
  2. 6.2 library.module \library_get_due_date()
  3. 7 library.module \library_get_due_date()

Get the due date given a check out date

@returns a UNIX TIMESTAMP if due dates are enabled else it returns NULL

Parameters

$checkout_date: The date an item was made unavailable

$action: The clean name of the action performed

$type: The node type

2 calls to library_get_due_date()
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.
library_transaction_form_submit in ./library.pages.inc
Handles transaction form submissions.

File

./library.module, line 960

Code

function library_get_due_date($checkout_date = NULL, $action, $type) {
  if (empty($checkout_date)) {
    $checkout_date = time();
  }
  $allowed = variable_get('library_period_for_' . $type . '_' . $action, 0);
  if ($allowed > 0) {
    return $checkout_date + $allowed;
  }
  else {
    return NULL;
  }
}