You are here

function tmgmt_job_check_finished in Translation Management Tool 7

Same name and namespace in other branches
  1. 8 tmgmt.module \tmgmt_job_check_finished()

Checks whether a job is finished by querying the job item table for unfinished job items.

Parameters

$tjid: The identifier of the job.

Return value

bool TRUE if the job is finished, FALSE otherwise.

Related topics

2 calls to tmgmt_job_check_finished()
TMGMTJobItem::accepted in entity/tmgmt.entity.job_item.inc
Sets the state of the job item to 'accepted'.
TMGMTJobItemController::invoke in controller/tmgmt.controller.job_item.inc
Implements EntityAPIControllerInterface.

File

./tmgmt.module, line 468
Main module file for the Translation Management module.

Code

function tmgmt_job_check_finished($tjid) {
  $query = new EntityFieldQuery();
  return !(bool) $query
    ->entityCondition('entity_type', 'tmgmt_job_item')
    ->propertyCondition('tjid', $tjid)
    ->propertyCondition('state', TMGMT_JOB_ITEM_STATE_ACCEPTED, '<>')
    ->range(0, 1)
    ->count()
    ->execute();
}