IcingaHostForm: do not ask for missing vars

This commit is contained in:
Thomas Gelf 2015-07-28 17:57:30 +02:00
parent d7f3c596d6
commit 00267a3b4f
1 changed files with 5 additions and 2 deletions

View File

@ -120,10 +120,13 @@ class IcingaHostForm extends DirectorObjectForm
$datatype = new $field->datatype;
$datafield = DirectorDatafield::load($field->datafield_id, $this->getDb());
$datatype->setSettings($datafield->getSettings());
$el = $datatype->getFormElement('var_' . $datafield->varname, $this);
$varname = $datafield->varname;
$el = $datatype->getFormElement('var_' . $varname, $this);
$el->setLabel($field->caption);
$el->setDescription($field->description);
$el->setValue($vars->{$datafield->varname}->getValue());
if (isset($vars->$varname)) {
$el->setValue($vars->{$varname}->getValue());
}
if ($field->is_required === 'y')
{