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

Merge branch 'develop' into 'master'

Develop

See merge request !425
parents 0ddbbc55 8d6809ad
Pipeline #7008 failed with stages
...@@ -672,34 +672,27 @@ class digitalResource ...@@ -672,34 +672,27 @@ class digitalResource
} }
$handler = $digitalResource->getHandler(); $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)) { $tempdir = str_replace("/", DIRECTORY_SEPARATOR, \laabs\tempdir());
$srcfile = $tempdir.DIRECTORY_SEPARATOR.$digitalResource->fileName;
} else {
$srcfile = $tempdir.DIRECTORY_SEPARATOR.$digitalResource->resId;
}
$tgtfp = fopen($srcfile, 'w'); if (isset($digitalResource->fileName)) {
stream_copy_to_stream($handler, $tgtfp); $srcfile = $tempdir.DIRECTORY_SEPARATOR.$digitalResource->fileName;
rewind ($handler); } else {
fclose($tgtfp); $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)); $conversionRule = $this->sdoFactory->read("digitalResource/conversionRule", array('puid' => $digitalResource->puid));
$converter = \laabs::newService($conversionRule->conversionService); $converter = \laabs::newService($conversionRule->conversionService);
$tgtfile = $converter->convert($srcfile, $outputFormats[$conversionRule->targetPuid]); $tgtfile = $converter->convert($srcfile, $outputFormats[$conversionRule->targetPuid]);
// Is tempdir was set, delete temp file unlink($srcfile);
if (isset($tempdir)) {
unlink($srcfile);
}
if (!file_exists($tgtfile)) { if (!file_exists($tgtfile)) {
return false; return false;
......
...@@ -209,11 +209,6 @@ class ArchiveRestitutionRequest extends abstractMessage ...@@ -209,11 +209,6 @@ class ArchiveRestitutionRequest extends abstractMessage
$this->generate($message); $this->generate($message);
$this->save($message); $this->save($message);
} }
$operationResult = true;
$message->object->unitIdentifier = $message->unitIdentifier;
$this->create($message);
} catch (\Exception $e) { } catch (\Exception $e) {
$message->status = "invalid"; $message->status = "invalid";
$this->create($message); $this->create($message);
...@@ -223,12 +218,14 @@ class ArchiveRestitutionRequest extends abstractMessage ...@@ -223,12 +218,14 @@ class ArchiveRestitutionRequest extends abstractMessage
throw $e; throw $e;
} }
$this->create($message);
$this->lifeCycleJournalController->logEvent( $this->lifeCycleJournalController->logEvent(
'medona/sending', 'medona/sending',
'medona/message', 'medona/message',
$message->messageId, $message->messageId,
$message, $message,
$operationResult true
); );
return $message; return $message;
...@@ -354,7 +351,7 @@ class ArchiveRestitutionRequest extends abstractMessage ...@@ -354,7 +351,7 @@ class ArchiveRestitutionRequest extends abstractMessage
); );
$archiveRestitutionRequestReplyController = \laabs::newController('medona/ArchiveRestitutionRequestReply'); $archiveRestitutionRequestReplyController = \laabs::newController('medona/ArchiveRestitutionRequestReply');
$replyMessage = $archiveRestitutionRequestReplyController->send($messageId, "400", $comment); $replyMessage = $archiveRestitutionRequestReplyController->send($message, "400", $comment);
return $replyMessage; return $replyMessage;
} }
......
...@@ -163,19 +163,4 @@ class conversionRule ...@@ -163,19 +163,4 @@ class conversionRule
return $this->json->save(); 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() { ...@@ -42,6 +42,9 @@ $("#archiveList").on('click', ".viewDocument", function() {
// view the archive description // view the archive description
$('#archiveList').on('click', '.viewArchive', function () { $('#archiveList').on('click', '.viewArchive', function () {
if ($(this).closest('tr').attr('id') == undefined) {
return;
}
archiveInfoModal.load($(this).closest('tr').attr('id')); archiveInfoModal.load($(this).closest('tr').attr('id'));
}); });
......
Supports Markdown
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