IcingaServiceForm: fix null modification

This commit is contained in:
Thomas Gelf 2016-09-08 16:19:57 +00:00
parent 2c6afcbd66
commit cc722578b6
1 changed files with 6 additions and 1 deletions

View File

@ -141,6 +141,11 @@ class IcingaServiceForm extends DirectorObjectForm
$this->addHidden('object_type', 'object'); $this->addHidden('object_type', 'object');
$this->addImportsElement(); $this->addImportsElement();
$imports = $this->getSentOrObjectValue('imports'); $imports = $this->getSentOrObjectValue('imports');
if ($this->hasBeenSent()) {
$imports = $this->getElement('imports')->setValue($imports)->getValue();
}
if ($this->isNew() && empty($imports)) { if ($this->isNew() && empty($imports)) {
return $this->groupMainProperties(); return $this->groupMainProperties();
} }
@ -153,7 +158,7 @@ class IcingaServiceForm extends DirectorObjectForm
->setButtons(); ->setButtons();
if ($this->hasBeenSent()) { if ($this->hasBeenSent()) {
$name = $this->getValue('object_name'); $name = $this->getSentOrObjectValue('object_name');
if (!strlen($name)) { if (!strlen($name)) {
$this->setElementValue('object_name', end($imports)); $this->setElementValue('object_name', end($imports));
$this->object->object_name = end($imports); $this->object->object_name = end($imports);