Fix setting value when not empty
This commit is contained in:
parent
78c5531357
commit
cbd8b22efb
|
@ -188,6 +188,7 @@ class ZM_Object {
|
|||
$this->{$field} = implode(',', $value);
|
||||
} else if (is_string($value)) {
|
||||
if (array_key_exists($field, $this->defaults)) {
|
||||
# Need filtering
|
||||
if (is_array($this->defaults[$field]) && isset($this->defaults[$field]['filter_regexp'])) {
|
||||
if (is_array($this->defaults[$field]['filter_regexp'])) {
|
||||
foreach ($this->defaults[$field]['filter_regexp'] as $regexp) {
|
||||
|
@ -205,6 +206,8 @@ class ZM_Object {
|
|||
} else {
|
||||
$this->{$field} = $this->defaults[$field];
|
||||
}
|
||||
} else {
|
||||
$this->{$field} = $value;
|
||||
} # need a default
|
||||
} else {
|
||||
$this->{$field} = $value;
|
||||
|
@ -230,10 +233,7 @@ class ZM_Object {
|
|||
|
||||
if ($defaults) {
|
||||
foreach ($defaults as $field => $type) {
|
||||
if ( isset($new_values[$field]) ) {
|
||||
# Will have already been handled above
|
||||
continue;
|
||||
}
|
||||
if (isset($new_values[$field])) continue;
|
||||
|
||||
if (isset($this->defaults[$field])) {
|
||||
if (is_array($this->defaults[$field])) {
|
||||
|
@ -246,9 +246,7 @@ class ZM_Object {
|
|||
} # end if defaults
|
||||
|
||||
foreach ($new_values as $field => $value) {
|
||||
|
||||
if (method_exists($this, $field)) {
|
||||
|
||||
if (array_key_exists($field, $this->defaults) && is_array($this->defaults[$field]) && isset($this->defaults[$field]['filter_regexp'])) {
|
||||
if (is_array($this->defaults[$field]['filter_regexp'])) {
|
||||
foreach ($this->defaults[$field]['filter_regexp'] as $regexp) {
|
||||
|
|
Loading…
Reference in New Issue