function lingotek_bulk_grid_query_add_keys in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.bulk_grid.inc \lingotek_bulk_grid_query_add_keys()
1 call to lingotek_bulk_grid_query_add_keys()
File
- ./
lingotek.bulk_grid.inc, line 1385
Code
function lingotek_bulk_grid_query_add_keys($query, $entity_type, $eid) {
// left joins are necessary here because some lingotek table keys might not exist
// Lingotek Document ID
$query
->leftJoin('lingotek_entity_metadata', 'lingo_document_id', 'lingo_document_id.entity_type =\'' . $entity_type . '\' AND lingo_document_id.entity_id = ' . $eid . ' and lingo_document_id.entity_key = \'document_id\'');
$query
->addField('lingo_document_id', 'value', 'document_id');
// Entity Upload Status
$query
->leftJoin('lingotek_entity_metadata', 'lingo_upload_status', 'lingo_upload_status.entity_type =\'' . $entity_type . '\' AND lingo_upload_status.entity_id = ' . $eid . ' and lingo_upload_status.entity_key = \'upload_status\' and lingo_upload_status.value <> \'' . LingotekSync::STATUS_TARGET . '\'');
$query
->addField('lingo_upload_status', 'value', 'upload_status');
// Profile Settings
$query
->leftJoin('lingotek_entity_metadata', 'lingo_profile', 'lingo_profile.entity_type =\'' . $entity_type . '\' AND lingo_profile.entity_id = ' . $eid . ' and lingo_profile.entity_key = \'profile\'');
$query
->addField('lingo_profile', 'value', 'profile');
// Last Uploaded Timestamp
$query
->leftJoin('lingotek_entity_metadata', 'lingo_last_uploaded', 'lingo_last_uploaded.entity_type =\'' . $entity_type . '\' AND lingo_last_uploaded.entity_id = ' . $eid . ' and lingo_last_uploaded.entity_key = \'last_uploaded\'');
$query
->addField('lingo_last_uploaded', 'value', 'last_uploaded');
// Any Upload Errors
$query
->leftJoin('lingotek_entity_metadata', 'lingo_last_sync_error', 'lingo_last_sync_error.entity_type =\'' . $entity_type . '\' AND lingo_last_sync_error.entity_id = ' . $eid . ' and lingo_last_sync_error.entity_key = \'last_sync_error\'');
$query
->addField('lingo_last_sync_error', 'value', 'last_sync_error');
// Any specifically defined workflow
$query
->leftJoin('lingotek_entity_metadata', 'lingo_workflow', '' . $eid . ' = lingo_workflow.entity_id and lingo_workflow.entity_type =\'' . $entity_type . '\' and lingo_workflow.entity_key = \'workflow_id\'');
$query
->addField('lingo_workflow', 'value', 'workflow');
// Original source language of the entity, in case of source overwriting option
if ($entity_type == 'node') {
$query
->leftJoin('lingotek_entity_metadata', 'lingo_orig_lang', $eid . ' = lingo_orig_lang.entity_id and lingo_orig_lang.entity_type =\'' . $entity_type . '\' and lingo_orig_lang.entity_key = \'original_language\'');
$query
->addField('lingo_orig_lang', 'value', 'original_lang');
}
}