function globallink_background_import in GlobalLink Connect for Drupal 7.7
Imports the documents
5 calls to globallink_background_import()
- globallink_all_active_form_submit in ./
globallink_workbench_all_active_submissions.inc - Handles submission of active entity form.
- globallink_auto_receive in ./
globallink.module - Automatically receives translated contents.
- globallink_dashboard_active_submissions_page in ./
globallink_workbench_all_active_submissions.inc - globallink_dashboard_active_submissions_page in ./
globallink_workbench_all_submissions.inc - Builds forms on GlobalLink active submissions dashboard.
- globallink_dashboard_active_submit in ./
globallink_workbench_all_submissions.inc - Handles submission of active GlobalLink form.
5 string references to 'globallink_background_import'
- globallink_all_active_form_submit in ./
globallink_workbench_all_active_submissions.inc - Handles submission of active entity form.
- globallink_auto_receive in ./
globallink.module - Automatically receives translated contents.
- globallink_dashboard_active_submissions_page in ./
globallink_workbench_all_active_submissions.inc - globallink_dashboard_active_submissions_page in ./
globallink_workbench_all_submissions.inc - Builds forms on GlobalLink active submissions dashboard.
- globallink_dashboard_active_submit in ./
globallink_workbench_all_submissions.inc - Handles submission of active GlobalLink form.
File
- ./
globallink_background_jobs.inc, line 568 - To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor.
Code
function globallink_background_import($pd4, $sub_rid, $document_rids = NULL) {
sleep(5);
module_load_include('inc', 'globallink', 'gl_ws/gl_ws_receive_translations');
module_load_include('inc', 'globallink', 'globallink');
$count = 0;
$sub_sql = db_select('globallink_submission', 'gs');
$sub_sql
->condition('rid', $sub_rid, '=');
$sub_sql
->fields('gs');
$sub_sql_result = $sub_sql
->execute()
->fetchAll();
$submission_row = $sub_sql_result[0];
watchdog(GLOBALLINK_MODULE, 'Importing submission - [%sub] for target language [%target]', array(
'%sub' => $submission_row->submission,
'%target' => $submission_row->sub_target_lang_name,
), WATCHDOG_INFO);
$submission_ticket = $submission_row->submission_ticket;
$target_locale = $submission_row->sub_target_lang_code;
$sql = db_select('globallink_document', 'gd');
$sql
->fields('gd');
$sql
->condition('gd.submission_rid', $sub_rid, '=');
$sql_results = $sql
->execute()
->fetchAll();
$document_tickets = array();
if ($document_rids != NULL) {
foreach ($sql_results as $row) {
if (in_array($row->rid, $document_rids)) {
if (!in_array($row->document_ticket, $document_tickets)) {
$document_tickets[] = $row->document_ticket;
}
}
}
}
else {
foreach ($sql_results as $row) {
if (!in_array($row->document_ticket, $document_tickets)) {
$document_tickets[] = $row->document_ticket;
}
}
}
$globallink_arr = array();
try {
if (check_if_submission_cancelled_or_deleted($pd4, $submission_ticket)) {
db_update('globallink_document')
->fields(array(
'target_status' => GLOBALLINK_STATUS_TRANSLATION_SOURCE_CANCELLED,
'target_last_updated' => REQUEST_TIME,
))
->condition('submission_rid', $sub_rid, '=')
->condition('target_lang_code', $target_locale, '=')
->execute();
db_update('globallink_submission')
->fields(array(
'status' => GLOBALLINK_STATUS_TRANSLATION_SOURCE_CANCELLED,
'updated' => REQUEST_TIME,
))
->condition('rid', $sub_rid, '=')
->execute();
return;
}
else {
$cancelled_arr = get_cancelled_targets_by_documents($pd4, $document_tickets);
if (!empty($cancelled_arr)) {
foreach ($cancelled_arr as $cancelled_locale => $tickets) {
if ($cancelled_locale == $target_locale) {
foreach ($tickets as $cancelled_doc_ticket) {
db_update('globallink_document')
->fields(array(
'target_status' => GLOBALLINK_STATUS_TRANSLATION_SOURCE_CANCELLED,
'target_last_updated' => REQUEST_TIME,
))
->condition('submission_rid', $sub_rid, '=')
->condition('target_lang_code', $target_locale, '=')
->condition('document_ticket', $cancelled_doc_ticket, '=')
->execute();
}
}
}
$sql = db_select('globallink_document', 'gd');
$sql
->fields('gd');
$sql
->condition('gd.submission_rid', $sub_rid, '=');
$sql
->condition('gd.target_status', GLOBALLINK_STATUS_TRANSLATION_SOURCE_CANCELLED, '<>');
$sql_results = $sql
->execute()
->fetchAll();
if (count($sql_results) == 0) {
$query = db_update('globallink_submission');
$query
->fields(array(
'status' => GLOBALLINK_STATUS_TRANSLATION_SOURCE_CANCELLED,
'updated' => REQUEST_TIME,
));
$query
->condition('rid', $sub_rid, '=');
$query
->execute();
return;
}
}
}
if ($document_rids != NULL) {
$globallink_arr = globallink_get_ready_translations_for_documents($pd4, $document_tickets);
}
else {
$globallink_arr = globallink_get_ready_translations_for_submission($pd4, array(
$submission_ticket,
));
}
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'GlobalLink Array from Project Director - %arr', array(
'%arr' => print_r($globallink_arr, TRUE),
), WATCHDOG_DEBUG);
}
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
return;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
return;
}
$globallink_arr_node = array();
$globallink_arr_entity = array();
$globallink_arr_block = array();
$globallink_arr_fpanel = array();
$globallink_arr_interface = array();
$globallink_arr_menu = array();
$globallink_arr_taxonomy = array();
$globallink_arr_webform = array();
$globallink_arr_bean = array();
$globallink_arr_file_entity = array();
$globallink_arr_commerce = array();
$globallink_arr_eck = array();
foreach ($globallink_arr as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if ($document_rids != NULL) {
if (!in_array($globallink->documentTicket, $document_tickets)) {
continue;
}
}
if ($globallink->type == GLOBALLINK_ENTITY_TYPE_NODE) {
module_load_include('inc', 'globallink', 'globallink_node');
array_push($globallink_arr_node, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_ENTITY) {
module_load_include('inc', 'globallink', 'globallink_entity/globallink_entity');
array_push($globallink_arr_entity, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_BLOCK) {
module_load_include('inc', 'globallink', 'globallink_block/globallink_block');
array_push($globallink_arr_block, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_FPP) {
module_load_include('inc', 'globallink', 'globallink_fieldable_panels/globallink_fieldable_panels');
array_push($globallink_arr_fpanel, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_INTERFACE) {
module_load_include('inc', 'globallink', 'globallink_interface/globallink_interface');
array_push($globallink_arr_interface, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_MENU) {
module_load_include('inc', 'globallink', 'globallink_menu/globallink_menu');
array_push($globallink_arr_menu, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_TAXONOMY) {
module_load_include('inc', 'globallink', 'globallink_taxonomy/globallink_taxonomy');
array_push($globallink_arr_taxonomy, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_WEBFORM) {
module_load_include('inc', 'globallink', 'globallink_webform/globallink_webform');
array_push($globallink_arr_webform, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_BEAN) {
module_load_include('inc', 'globallink', 'globallink_beans/globallink_beans');
array_push($globallink_arr_bean, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_FILE_ENTITY) {
module_load_include('inc', 'globallink', 'globallink_file_entity/globallink_file_entity');
array_push($globallink_arr_file_entity, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_COM) {
module_load_include('inc', 'globallink', 'globallink_commerce/globallink_commerce');
array_push($globallink_arr_commerce, $globallink);
}
elseif ($globallink->type == GLOBALLINK_ENTITY_TYPE_ECK_ENTITY) {
module_load_include('inc', 'globallink', 'globallink_custom_entity/globallink_custom_entity');
array_push($globallink_arr_eck, $globallink);
}
}
}
if (count($globallink_arr_node) > 0) {
foreach ($globallink_arr_node as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing Node - %arr ', array(
'%arr' => print_r($globallink_arr_node, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_import_node($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_entity) > 0) {
foreach ($globallink_arr_entity as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing Entity - %arr ', array(
'%arr' => print_r($globallink_arr_entity, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_entity_update_entity($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_block) > 0) {
foreach ($globallink_arr_block as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing Block - %arr ', array(
'%arr' => print_r($globallink_arr_block, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_block_import($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_fpanel) > 0) {
foreach ($globallink_arr_fpanel as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing FPP - %arr ', array(
'%arr' => print_r($globallink_arr_fpanel, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_fieldable_panels_import($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_interface) > 0) {
foreach ($globallink_arr_interface as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing Interface - %arr ', array(
'%arr' => print_r($globallink_arr_interface, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_interface_import($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_menu) > 0) {
usort($globallink_arr, 'globallink_menu_sort_gl_objects_by_menu_order');
foreach ($globallink_arr_menu as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing Menu - %arr ', array(
'%arr' => print_r($globallink_arr_menu, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_menu_import($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_taxonomy) > 0) {
foreach ($globallink_arr_taxonomy as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing Taxonomy - %arr ', array(
'%arr' => print_r($globallink_arr_taxonomy, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_taxonomy_import($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_webform) > 0) {
foreach ($globallink_arr_webform as $globallink) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing WebForm - %arr ', array(
'%arr' => print_r($globallink_arr_webform, TRUE),
), WATCHDOG_DEBUG);
}
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
$send_confirmation = globallink_webform_import($globallink, $sub_rid, $document_rids);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR && $send_confirmation) {
$parent_id = $globallink->otherObjectId;
$docs = globallink_webform_get_doc_rows_by_parent($sub_rid, $parent_id);
$wf_count = count($docs);
foreach ($docs as $doc) {
if ($doc->submission_rid == $sub_rid && $doc->document_ticket == $globallink->documentTicket && $doc->object_parent_id == $globallink->otherObjectId && $doc->target_lang_code == $globallink->targetLocale) {
if (in_array($doc->object_id, $globallink->lids)) {
$wf_count--;
}
}
}
if ($wf_count == 0) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
}
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_bean) > 0) {
foreach ($globallink_arr_bean as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing beans - %arr ', array(
'%arr' => print_r($globallink_arr_bean, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_beans_import($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_file_entity > 0)) {
foreach ($globallink_arr_file_entity as $globallink_fe) {
if ($globallink_fe->targetLocale == $target_locale && $globallink_fe->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing file enity - %arr ', array(
'%arr' => print_r($globallink_arr_file_entity, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink_fe->targetXML = globallink_download_target_resource($pd4, $globallink_fe->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink_fe->targetXML)) {
globallink_file_entity_import($globallink_fe);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink_fe->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink_fe, $sub_rid);
}
}
}
}
if (count($globallink_arr_commerce) > 0) {
foreach ($globallink_arr_commerce as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing commerce product - %arr ', array(
'%arr' => print_r($globallink_arr_commerce, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_commerce_import($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
if (count($globallink_arr_eck > 0)) {
foreach ($globallink_arr_eck as $globallink) {
if ($globallink->targetLocale == $target_locale && $globallink->submissionTicket == $submission_ticket) {
if (globallink_debug_enabled()) {
watchdog(GLOBALLINK_MODULE, 'Importing custom entity - %arr ', array(
'%arr' => print_r($globallink_arr_eck, TRUE),
), WATCHDOG_DEBUG);
}
try {
$globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
} catch (SoapFault $se) {
watchdog(GLOBALLINK_MODULE, 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
continue;
} catch (Exception $e) {
watchdog(GLOBALLINK_MODULE, 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
continue;
}
if (isset($globallink->targetXML)) {
globallink_eck_import($globallink);
if ($globallink->status != GLOBALLINK_STATUS_TRANSLATION_ERROR) {
globallink_send_download_confirmation($globallink->targetTicket, $pd4);
$count++;
}
globallink_update_status($globallink, $sub_rid);
}
}
}
}
watchdog(GLOBALLINK_MODULE, '%count records updated successfully for submission [%submission_name].', array(
'%count' => $count,
'%submission_name' => $submission_row->submission,
), WATCHDOG_INFO);
return;
}