|
|
@@ -160,8 +160,11 @@ class DolibarrSyncService
|
|
|
}
|
|
|
|
|
|
// Sync contact
|
|
|
- $newSocietyData['email'] = $this->getOrganizationEmail($organization);
|
|
|
- $newSocietyData['phone'] = $this->getOrganizationPhone($organization);
|
|
|
+ $organizationEmail = $this->getOrganizationEmail($organization);
|
|
|
+ $newSocietyData['email'] = !empty($organizationEmail) ? $organizationEmail : $dolibarrSociety['email'];
|
|
|
+
|
|
|
+ $organizationPhone = $this->getOrganizationPhone($organization);
|
|
|
+ $newSocietyData['phone'] = !empty($organizationPhone) ? $organizationPhone : $dolibarrSociety['phone'];
|
|
|
|
|
|
// Sync Network
|
|
|
if (!in_array($organization->getId(), [NetworkEnum::CMF, NetworkEnum::FFEC], true)) {
|
|
|
@@ -253,10 +256,10 @@ class DolibarrSyncService
|
|
|
'civility_code' => $person->getGender() ? $this->translator->trans($person->getGender()->value) : null,
|
|
|
'lastname' => trim($person->getName()),
|
|
|
'firstname' => trim($person->getGivenName()),
|
|
|
- 'email' => $contact?->getEmail(),
|
|
|
- 'phone_pro' => $contact?->getTelphone() ? $this->formatPhoneNumber($contact->getTelphone()) : null,
|
|
|
- 'phone_mobile' => $contact?->getMobilPhone() ? $this->formatPhoneNumber($contact->getMobilPhone()) : null,
|
|
|
- 'poste' => $this->formatContactPosition($missions, $person->getGender()?->value),
|
|
|
+ 'email' => $contact?->getEmail() ?? $dolibarrContact['email'] ?? null,
|
|
|
+ 'phone_pro' => $contact?->getTelphone() ? $this->formatPhoneNumber($contact->getTelphone()) : $dolibarrContact['phone_pro'] ?? null,
|
|
|
+ 'phone_mobile' => $contact?->getMobilPhone() ? $this->formatPhoneNumber($contact->getMobilPhone()) : $dolibarrContact['phone_mobile'] ?? null,
|
|
|
+ 'poste' => !empty($missions) ? $this->formatContactPosition($missions, $person->getGender()?->value) : $dolibarrContact['poste'] ?? null,
|
|
|
'statut' => '1',
|
|
|
];
|
|
|
|