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