From da4bf7ffc687137d27cf4ee4ac2477e1673b0174 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 14 Jan 2019 15:00:39 +0100 Subject: [PATCH] NodeMoveAction: Don't allow to accidentally override the placement of nodes --- .../Businessprocess/Modification/NodeMoveAction.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/Businessprocess/Modification/NodeMoveAction.php b/library/Businessprocess/Modification/NodeMoveAction.php index c25bafb..1da93ae 100644 --- a/library/Businessprocess/Modification/NodeMoveAction.php +++ b/library/Businessprocess/Modification/NodeMoveAction.php @@ -103,6 +103,12 @@ class NodeMoveAction extends NodeAction if ($this->newParent !== null) { if (! $config->hasBpNode($this->newParent)) { $this->error('New parent process "%s" missing', $this->newParent); + } elseif ($config->getBpNode($this->newParent)->hasChild($name)) { + $this->error( + 'New parent process "%s" already has a node with the name "%s"', + $this->newParent, + $name + ); } $childrenCount = $config->getBpNode($this->newParent)->countChildren(); @@ -114,6 +120,10 @@ class NodeMoveAction extends NodeAction ); } } else { + if ($config->hasRootNode($name)) { + $this->error('Process "%s" is already a toplevel process', $name); + } + $childrenCount = $config->countChildren(); if ($this->to > 0 && $childrenCount < $this->to) { $this->error(