Fix MySQL strict mode error when saving a subscriber without first or last name [MAILPOET-780]

This commit is contained in:
Alexey Stoletniy
2017-01-18 19:06:33 +03:00
parent 63d1fe17a9
commit 8cf918013d

View File

@ -485,6 +485,17 @@ class Subscriber extends Model {
unset($data['segments']);
}
// fields that must exist
$not_null_fields = array(
'first_name' => '',
'last_name' => ''
);
foreach ($not_null_fields as $field => $value) {
if (!isset($data[$field])) {
$data[$field] = $value;
}
}
// custom fields
$custom_fields = array();
foreach($data as $key => $value) {