Skip to content
Snippets Groups Projects
Commit 704d702b authored by Thomas Hackl's avatar Thomas Hackl
Browse files

Resolve "Veranstaltungshierarchie: Fehler beim Anlegen von Unterelementen"

Closes #4257

Merge request studip/studip!3087
parent 10ba379d
No related branches found
No related tags found
No related merge requests found
......@@ -130,12 +130,15 @@ class Admin_TreeController extends AuthenticatedController
$node->parent_id = Request::option('parent_id');
$parent = $classname::getNode(Request::option('parent_id'));
$maxprio = max(array_map(
function ($c) {
return $c->priority;
},
$parent->getChildNodes()
));
$children = $parent->getChildNodes();
$maxprio = !empty($children)
? max(array_map(
function ($c) {
return $c->priority;
},
$children
))
: 0;
$node->priority = $maxprio + 1;
if (Request::option('studip_object_id')) {
......
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