Skip to content
Snippets Groups Projects
Commit 00cef8e1 authored by Ron Lucke's avatar Ron Lucke Committed by Elmar Ludwig
Browse files

refs #312

parent 3386b69f
No related branches found
No related tags found
No related merge requests found
...@@ -303,14 +303,17 @@ abstract class BlockType ...@@ -303,14 +303,17 @@ abstract class BlockType
protected function copyFileById(string $fileId, string $rangeId): string protected function copyFileById(string $fileId, string $rangeId): string
{ {
$user = \User::findCurrent(); $user = \User::findCurrent();
if ($file_ref = \FileRef::find($fileId)) {
$copiedFile = \FileManager::copyFile(
$file_ref->getFiletype(),
$this->getDestinationFolder($user, $rangeId),
$user
);
$copiedFile = \FileManager::copyFile( return $copiedFile->id;
\FileRef::find($fileId)->getFiletype(), }
$this->getDestinationFolder($user, $rangeId),
$user
);
return $copiedFile->id; return '';
} }
/** /**
...@@ -325,14 +328,17 @@ abstract class BlockType ...@@ -325,14 +328,17 @@ abstract class BlockType
{ {
$user = \User::findCurrent(); $user = \User::findCurrent();
$destinationFolder = $this->getDestinationFolder($user, $rangeId); $destinationFolder = $this->getDestinationFolder($user, $rangeId);
$sourceFolder = \Folder::find($folderId)->getTypedFolder(); if ($sourceFolder = \Folder::find($folderId)) {
$copiedFolder = \FileManager::copyFolder( $copiedFolder = \FileManager::copyFolder(
$sourceFolder, $sourceFolder->getTypedFolder(),
$destinationFolder, $destinationFolder,
$user $user
); );
return $copiedFolder->id;
}
return $copiedFolder->id; return '';
} }
private function getDestinationFolder(\User $user, string $rangeId): \StandardFolder private function getDestinationFolder(\User $user, string $rangeId): \StandardFolder
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment