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,9 +303,9 @@ abstract class BlockType ...@@ -303,9 +303,9 @@ 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( $copiedFile = \FileManager::copyFile(
\FileRef::find($fileId)->getFiletype(), $file_ref->getFiletype(),
$this->getDestinationFolder($user, $rangeId), $this->getDestinationFolder($user, $rangeId),
$user $user
); );
...@@ -313,6 +313,9 @@ abstract class BlockType ...@@ -313,6 +313,9 @@ abstract class BlockType
return $copiedFile->id; return $copiedFile->id;
} }
return '';
}
/** /**
* Copies a folder to a specified range. * Copies a folder to a specified range.
* *
...@@ -325,9 +328,9 @@ abstract class BlockType ...@@ -325,9 +328,9 @@ 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
); );
...@@ -335,6 +338,9 @@ abstract class BlockType ...@@ -335,6 +338,9 @@ abstract class BlockType
return $copiedFolder->id; return $copiedFolder->id;
} }
return '';
}
private function getDestinationFolder(\User $user, string $rangeId): \StandardFolder private function getDestinationFolder(\User $user, string $rangeId): \StandardFolder
{ {
$rootFolder = \Folder::findTopFolder($rangeId); $rootFolder = \Folder::findTopFolder($rangeId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment