You are here

function library_get_transactions_query in Library 7

Retrieves all transactions, not called directly.

Return value

SelectQuery The database base query for all transactions.

4 calls to library_get_transactions_query()
library_get_transactions_by_item in ./library.module
Retrieves all transactions for an item.
library_get_transactions_by_node in ./library.module
Retrieves all transactions for all items on a node.
library_get_transactions_by_single_user in ./library.module
Retrieves all transactions associated with a user.
library_get_transaction_by_tid in ./library.module
Retrieves a transaction by its id.

File

./library.module, line 855

Code

function library_get_transactions_query() {
  $select = db_select('library_transactions', 'lt');
  $select
    ->join('library_actions', 'la', 'la.aid = lt.action_aid');
  $select
    ->join('users', 'u', 'u.uid = lt.uid');
  $select
    ->join('library', 'l', 'l.id = lt.item_id');
  $select
    ->join('node', 'n', 'n.nid = lt.nid');
  $select
    ->addField('lt', 'tid');
  $select
    ->addField('lt', 'item_id');
  $select
    ->addField('lt', 'nid');
  $select
    ->addField('lt', 'uid');
  $select
    ->addField('lt', 'duedate');
  $select
    ->addField('lt', 'notes');
  $select
    ->addField('lt', 'created');
  $select
    ->addField('la', 'aid');
  $select
    ->addField('la', 'name', 'action_name');
  $select
    ->addField('la', 'status_change');
  $select
    ->addField('u', 'name', 'username');
  $select
    ->addField('l', 'barcode');
  $select
    ->addField('l', 'in_circulation');
  $select
    ->addField('l', 'library_status');
  $select
    ->addField('n', 'title', 'item_name');
  $select
    ->orderBy('lt.created', 'DESC');
  return $select;
}