function tmgmt_ui_job_needs_checkout_form in Translation Management Tool 7
Check if a job needs a checkout form. The current checks include if there is more than one translator available, if he has settings and if the job has a fixed target language.
Parameters
TMGMTJob $job: The job item
Return value
TRUE if the job needs a checkout form.
1 call to tmgmt_ui_job_needs_checkout_form()
- tmgmt_ui_job_checkout_multiple in ui/
tmgmt_ui.module - Attempts to check out a number of jobs. Performs a number of checks on each job and also allows to alter the behavior through hooks.
File
- ui/
tmgmt_ui.module, line 493 - Common Translation managment UI.
Code
function tmgmt_ui_job_needs_checkout_form(TMGMTJob $job) {
// If the job has no target language (or source language, even though this
// should never be the case in our use case), checkout is mandatory.
if (empty($job->target_language) || empty($job->source_language)) {
return TRUE;
}
// If no translator is pre-selected, try to pick one automatically.
if (empty($job->translator)) {
// If there is more than a single translator available or if there are no
// translators available at all checkout is mandatory.
$translators = tmgmt_translator_load_available($job);
if (empty($translators) || count($translators) > 1) {
return TRUE;
}
$translator = reset($translators);
$job->translator = $translator->name;
}
// If that translator has settings, the checkout is mandatory.
if ($job
->getTranslator()
->hasCheckoutSettings($job)) {
return TRUE;
}
return FALSE;
}