DirectorObjectForm: normalize command field values...

...with special data types even when filled at services level

fixes #12400
fixes #11692
fixes #11477
This commit is contained in:
Thomas Gelf 2016-08-26 13:48:44 +00:00
parent 5355558519
commit 77c915c897
1 changed files with 13 additions and 11 deletions

View File

@ -300,8 +300,9 @@ abstract class DirectorObjectForm extends QuickForm
// Get value through form element. // Get value through form element.
// TODO: reorder the related code. Create elements once // TODO: reorder the related code. Create elements once
if (property_exists($fields, $mykey)) { foreach (array($fields, $checkFields) as $fieldSet) {
$field = $fields->$mykey; if (property_exists($fieldSet, $mykey)) {
$field = $fieldSet->$mykey;
$datafield = DirectorDatafield::load($field->datafield_id, $this->getDb()); $datafield = DirectorDatafield::load($field->datafield_id, $this->getDb());
$name = 'var_' . $datafield->varname; $name = 'var_' . $datafield->varname;
$className = $datafield->datatype; $className = $datafield->datatype;
@ -314,6 +315,7 @@ abstract class DirectorObjectForm extends QuickForm
$value = $el->setValue($value)->getValue(); $value = $el->setValue($value)->getValue();
} }
}
if (property_exists($fields, $mykey) && $fields->$mykey->format === 'json') { if (property_exists($fields, $mykey) && $fields->$mykey->format === 'json') {
$value = json_decode($value); $value = json_decode($value);