Commit 2b7f6e75 authored by Alexandre Morin's avatar Alexandre Morin

Merge branch 'develop' into 'master'

Develop

See merge request !425
parents 0ddbbc55 8d6809ad
Pipeline #7008 failed with stages
......@@ -672,34 +672,27 @@ class digitalResource
}
$handler = $digitalResource->getHandler();
$metadata = stream_get_meta_data($handler);
if ($metadata['wrapper_type'] == 'plainfile') {
$srcfile = $metadata['uri'];
} else {
$tempdir = str_replace("/", DIRECTORY_SEPARATOR, \laabs\tempdir());
if (isset($digitalResource->fileName)) {
$srcfile = $tempdir.DIRECTORY_SEPARATOR.$digitalResource->fileName;
} else {
$srcfile = $tempdir.DIRECTORY_SEPARATOR.$digitalResource->resId;
}
$tempdir = str_replace("/", DIRECTORY_SEPARATOR, \laabs\tempdir());
$tgtfp = fopen($srcfile, 'w');
stream_copy_to_stream($handler, $tgtfp);
rewind ($handler);
fclose($tgtfp);
if (isset($digitalResource->fileName)) {
$srcfile = $tempdir.DIRECTORY_SEPARATOR.$digitalResource->fileName;
} else {
$srcfile = $tempdir.DIRECTORY_SEPARATOR.$digitalResource->resId;
}
$tgtfp = fopen($srcfile, 'w');
stream_copy_to_stream($handler, $tgtfp);
rewind($handler);
fclose($tgtfp);
$conversionRule = $this->sdoFactory->read("digitalResource/conversionRule", array('puid' => $digitalResource->puid));
$converter = \laabs::newService($conversionRule->conversionService);
$tgtfile = $converter->convert($srcfile, $outputFormats[$conversionRule->targetPuid]);
// Is tempdir was set, delete temp file
if (isset($tempdir)) {
unlink($srcfile);
}
unlink($srcfile);
if (!file_exists($tgtfile)) {
return false;
......
......@@ -209,11 +209,6 @@ class ArchiveRestitutionRequest extends abstractMessage
$this->generate($message);
$this->save($message);
}
$operationResult = true;
$message->object->unitIdentifier = $message->unitIdentifier;
$this->create($message);
} catch (\Exception $e) {
$message->status = "invalid";
$this->create($message);
......@@ -223,12 +218,14 @@ class ArchiveRestitutionRequest extends abstractMessage
throw $e;
}
$this->create($message);
$this->lifeCycleJournalController->logEvent(
'medona/sending',
'medona/message',
$message->messageId,
$message,
$operationResult
true
);
return $message;
......@@ -354,7 +351,7 @@ class ArchiveRestitutionRequest extends abstractMessage
);
$archiveRestitutionRequestReplyController = \laabs::newController('medona/ArchiveRestitutionRequestReply');
$replyMessage = $archiveRestitutionRequestReplyController->send($messageId, "400", $comment);
$replyMessage = $archiveRestitutionRequestReplyController->send($message, "400", $comment);
return $replyMessage;
}
......
......@@ -163,19 +163,4 @@ class conversionRule
return $this->json->save();
}
/**
* Cluster exception
* @param digitalResource/Exception/conversionRuleException $conversionRuleException
*
* @return string
*/
public function conversionRuleException($conversionRuleException)
{
$this->json->message = $conversionRuleException->getMessage();
$this->json->message = $this->translator->getText($this->json->message);
$this->json->status = false;
return $this->json->save();
}
}
......@@ -42,6 +42,9 @@ $("#archiveList").on('click', ".viewDocument", function() {
// view the archive description
$('#archiveList').on('click', '.viewArchive', function () {
if ($(this).closest('tr').attr('id') == undefined) {
return;
}
archiveInfoModal.load($(this).closest('tr').attr('id'));
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment