You are here

function farm_inventory_individual in farmOS 7

Check whether or not an asset is treated as an individual by default.

Parameters

FarmAsset $asset: The asset to check.

Return value

bool Returns TRUE or FALSE.

1 call to farm_inventory_individual()
farm_inventory_entity_view_alter in modules/farm/farm_inventory/farm_inventory.module
Implements hook_entity_view_alter().

File

modules/farm/farm_inventory/farm_inventory.module, line 372

Code

function farm_inventory_individual(FarmAsset $asset) {

  // If the asset type is not set, bail.
  if (empty($asset->type)) {
    return FALSE;
  }

  // Check the database to see if the asset is treated as an individual.
  $result = db_query('SELECT individual FROM {farm_inventory_asset_type} WHERE type = :type', array(
    ':type' => $asset->type,
  ))
    ->fetchField();

  // Return TRUE or FALSE.
  if (!empty($result)) {
    return TRUE;
  }
  return FALSE;
}