function library_get_last_transaction_by_item in Library 6
Same name and namespace in other branches
- 5.2 library.module \library_get_last_transaction_by_item()
- 6.2 library.module \library_get_last_transaction_by_item()
- 7 library.module \library_get_last_transaction_by_item()
Parameters
$node : Node object or array
$transaction_type: (optional) Type of transaction to return
Return value
Transaction array or NULL if none found
1 call to library_get_last_transaction_by_item()
- library_load in ./
library.module - Menu callback; loads a library object
File
- ./
library.module, line 1083
Code
function library_get_last_transaction_by_item($item, $type = NULL) {
$transactions = library_get_transactions_by_item($item);
if (isset($transactions)) {
foreach ($transactions as $transaction) {
if ($type && $type == $transaction->status_change) {
return $transaction;
}
else {
//Only return transactions that changed the status of the item
switch ($transaction->status_change) {
case LIBRARY_ACTION_TYPE_UNAVAILABLE:
return $transaction;
case LIBRARY_ACTION_TYPE_AVAILABLE:
return $transaction;
default:
break;
}
}
}
return NULL;
}
}