Skip to content
Snippets Groups Projects
Commit 100e67f2 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 830ead71
No related branches found
No related tags found
No related merge requests found
...@@ -1045,9 +1045,7 @@ SQL; ...@@ -1045,9 +1045,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);
} }
} }
...@@ -1104,9 +1102,8 @@ SQL; ...@@ -1104,9 +1102,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.
Finish editing this message first!
Please register or to comment