diff --git a/application/forms/IcingaCloneObjectForm.php b/application/forms/IcingaCloneObjectForm.php index b104c087..0de41cfd 100644 --- a/application/forms/IcingaCloneObjectForm.php +++ b/application/forms/IcingaCloneObjectForm.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Director\Forms; +use Icinga\Exception\IcingaException; use Icinga\Module\Director\Acl; use Icinga\Module\Director\Objects\IcingaHost; use Icinga\Module\Director\Objects\IcingaObject; @@ -87,6 +88,12 @@ class IcingaCloneObjectForm extends DirectorForm $object->getObjectName() ); + if ($object->isTemplate() && $object->getObjectName() === $newName) { + throw new IcingaException( + $this->translate('Name needs to be changed when cloning a Template') + ); + } + $new = $object::fromPlainObject( $object->toPlainObject($resolve), $connection