Custom fields are not allowed to have a null value, since NULL is skipped by backend

Fixes bug where it was impossible to clear date cfs
This commit is contained in:
Nathan Gray 2014-05-05 22:19:54 +00:00
parent c99f0ee32d
commit 33594b565d

View File

@ -323,6 +323,9 @@ class etemplate_widget_customfields extends etemplate_widget_transformer
$valid =& self::get_array($validated, $this->id ? $form_name : $field, true); $valid =& self::get_array($validated, $this->id ? $form_name : $field, true);
if (is_array($valid)) $valid = implode(',', $valid); if (is_array($valid)) $valid = implode(',', $valid);
// NULL is valid for most fields, but not custom fields due to backend handling
// See so_sql_cf->save()
if (is_null($valid)) $valid = false;
//error_log(__METHOD__."() $form_name $field: ".array2string($value).' --> '.array2string($valid)); //error_log(__METHOD__."() $form_name $field: ".array2string($value).' --> '.array2string($valid));
} }
} elseif ($this->type == 'customfields-types') { } elseif ($this->type == 'customfields-types') {