You are here

function lingotek_oneoff_count in Lingotek Translation 7.6

1 call to lingotek_oneoff_count()
lingotek_node_settings_row_oneoffs in ./lingotek.admin.inc

File

./lingotek.admin.inc, line 356

Code

function lingotek_oneoff_count($bundle_name) {
  $target_ids = db_select('lingotek_entity_metadata', 'lem')
    ->fields('lem', array(
    'entity_id',
  ))
    ->condition('entity_key', 'upload_status')
    ->condition('entity_type', 'node')
    ->condition('value', 'TARGET')
    ->execute()
    ->fetchCol();
  $query = db_select('lingotek_entity_metadata', 'lem')
    ->fields('lem')
    ->condition('lem.entity_key', 'profile')
    ->condition('lem.entity_type', 'node');
  if (!empty($target_ids)) {
    $query
      ->condition('lem.entity_id', $target_ids, 'NOT IN');
  }
  $query
    ->join('node', 'n', 'lem.entity_id = n.nid AND n.type = \'' . $bundle_name . '\'');
  $exception_num = $query
    ->execute()
    ->rowCount();
  return $exception_num;
}