You are here

function library_get_item_by_barcode in Library 7

Same name and namespace in other branches
  1. 6.2 library.module \library_get_item_by_barcode()
  2. 6 library.module \library_get_item_by_barcode()

Returns the full item from barcode.

Parameters

int $barcode: The barcode for an item.

Return value

object A library object.

1 call to library_get_item_by_barcode()
library_transaction_form_validate in ./library.pages.inc
Handles transaction form submissions.

File

./library.module, line 1175

Code

function library_get_item_by_barcode($barcode) {
  $result = db_query("SELECT id FROM {library} WHERE barcode = :barcode", array(
    ':barcode' => check_plain($barcode . ''),
  ));
  $record = $result
    ->fetchField();
  $item = library_load($record);
  return $item;
}