Skip to content
Snippets Groups Projects
Commit 90ed4123 authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

fix order during export and linking, fixes #2959 and #1361

Closes #2959 and #1361

Merge request studip/studip!1991
parent 64dea07a
No related branches found
No related tags found
No related merge requests found
...@@ -982,9 +982,7 @@ SQL; ...@@ -982,9 +982,7 @@ SQL;
private function linkChildren(User $user, StructuralElement $newElement): void private function linkChildren(User $user, StructuralElement $newElement): void
{ {
$children = self::findBySQL('parent_id = ?', [$this->id]); foreach ($this->children as $child) {
foreach ($children as $child) {
$child->link($user, $newElement); $child->link($user, $newElement);
} }
} }
...@@ -1041,9 +1039,8 @@ SQL; ...@@ -1041,9 +1039,8 @@ SQL;
private function getChildrenPdfExport(int $depth, bool $with_children, $user, $doc) private function getChildrenPdfExport(int $depth, bool $with_children, $user, $doc)
{ {
$children = self::findBySQL('parent_id = ?', [$this->id]);
$depth++; $depth++;
foreach ($children as $child) { foreach ($this->children as $child) {
$child->getElementPdfExport($depth, $with_children, $user, $doc); $child->getElementPdfExport($depth, $with_children, $user, $doc);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment