You are here

function GLExchange::uploadReference in GlobalLink Connect for Drupal 7.7

* * Upload reference file for submission * *

Parameters

* $referenceDocument: * PDReferenceDocument

File

gl_ws/glc/GLExchange.php, line 891

Class

GLExchange

Code

function uploadReference($referenceDocument) {
  if (!isset($referenceDocument) || !isset($referenceDocument->data)) {
    throw new Exception("Document is empty");
  }
  if (!isset($referenceDocument->name)) {
    throw new Exception("Document name not set");
  }
  if (!isset($this->submission) || !isset($this->submission->ticket)) {
    throw new Exception("Submission not initialized.");
  }
  if ($this->submission->ticket == "") {
    throw new Exception("Invalid submission ticket. Please upload a translatable document before attempting to upload reference documents.");
  }
  $uploadReferenceRequest = new uploadReference();
  $uploadReferenceRequest->data = $referenceDocument->data;
  $uploadReferenceRequest->submissionId = $this->submission->ticket;
  $uploadReferenceRequest->resourceInfo = $referenceDocument
    ->getResourceInfo();
  return $this->submissionService
    ->uploadReference($uploadReferenceRequest)->return;
}