fix : contact detail not processed
This commit is contained in:
parent
30c4e47304
commit
7b2c65ac9a
@ -22,14 +22,14 @@ if (!function_exists('convert_array_to_utc')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('is_datetime_string')) {
|
if (!function_exists('is_datetime_string')) {
|
||||||
function is_datetime_string(string $value): bool {
|
function is_datetime_string(string $value): bool {
|
||||||
return preg_match(
|
return preg_match(
|
||||||
'/^\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:[\+\-]\d{2}:?\d{2}|Z)?)?$/',
|
'/^\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:[\+\-]\d{2}:?\d{2}|Z)?)?$/',
|
||||||
$value
|
$value
|
||||||
) === 1;
|
) === 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('convert_array_to_utc_iso')) {
|
if (!function_exists('convert_array_to_utc_iso')) {
|
||||||
function convert_array_to_utc_iso($data) {
|
function convert_array_to_utc_iso($data) {
|
||||||
|
|||||||
@ -86,12 +86,16 @@ class ContactModel extends BaseModel {
|
|||||||
$details = $data['Details'] ?? [];
|
$details = $data['Details'] ?? [];
|
||||||
unset($data['Details']);
|
unset($data['Details']);
|
||||||
|
|
||||||
|
$contactData = array_intersect_key($data, array_flip($this->allowedFields));
|
||||||
|
|
||||||
if (!empty($data['ContactID'])) {
|
if (!empty($data['ContactID'])) {
|
||||||
$contactId = $data['ContactID'];
|
$contactId = $data['ContactID'];
|
||||||
$this->update($contactId, $data);
|
if (!empty($contactData)) {
|
||||||
|
$this->update($contactId, $contactData);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$contactId = $this->insert($data, true);
|
$contactId = $this->insert($data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$contactId) {
|
if (!$contactId) {
|
||||||
throw new \RuntimeException('Failed to save contact');
|
throw new \RuntimeException('Failed to save contact');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user