You are here

function _lingotek_notification_handle_failed_upload in Lingotek Translation 7.7

2 calls to _lingotek_notification_handle_failed_upload()
update_pending_sources in ./lingotek.sync.inc
_lingotek_notification_handle_import_failure in ./lingotek.sync.inc

File

./lingotek.sync.inc, line 418
Sync and management

Code

function _lingotek_notification_handle_failed_upload(LingotekEntity $ln, $doc_id, $error) {
  $ln
    ->deleteMetadataValue("process_id");
  $ln
    ->setStatus(LingotekSync::STATUS_ERROR);
  if ($ln
    ->getMetadataValue("initial_upload")) {
    $ln
      ->deleteMetadataValue("document_id");
    $ln
      ->deleteMetadataValue("initial_upload");
  }
  else {
    $ln
      ->setMetadataValue("document_id", $ln
      ->getMetadataValue("previous_doc_id"));
  }
  $ln
    ->setExclusiveTargetsStatus(LingotekSync::STATUS_NONE, [
    LingotekSync::STATUS_CURRENT,
    LingotekSync::STATUS_READY,
  ]);
  drupal_set_message(t('Document @id failed to update/upload. Check TMS for details. Given Error: @error', array(
    '@id' => $doc_id,
    '@error' => $error,
  )), 'error');
}