NoDuplicateChildrenValidator: Don't detect a no-change as duplicate

This commit is contained in:
Johannes Meyer 2020-06-26 11:20:14 +02:00
parent 67a7687606
commit 8f868d79c9

View file

@ -4,6 +4,7 @@ namespace Icinga\Module\Businessprocess\Web\Form\Validator;
use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\Forms\EditNodeForm;
use Icinga\Module\Businessprocess\Web\Form\QuickForm; use Icinga\Module\Businessprocess\Web\Form\QuickForm;
use Zend_Validate_Abstract; use Zend_Validate_Abstract;
@ -39,6 +40,8 @@ class NoDuplicateChildrenValidator extends Zend_Validate_Abstract
{ {
if ($this->parent === null) { if ($this->parent === null) {
$found = $this->bp->hasRootNode($value); $found = $this->bp->hasRootNode($value);
} elseif ($this->form instanceof EditNodeForm && $this->form->getNode()->getName() === $value) {
$found = false;
} else { } else {
$found = $this->parent->hasChild($value); $found = $this->parent->hasChild($value);
} }