|
|
@@ -128,10 +128,10 @@ class DolibarrSyncService
|
|
|
$dolibarrSociety = $this->sanitizeDolibarrData($dolibarrSociety);
|
|
|
|
|
|
$organization = $this->organizationRepository->find($organizationId);
|
|
|
- if (null === $organization) {
|
|
|
+ if ($organization === null) {
|
|
|
$this->logger->error('Organization '.$organizationId.' not found in the Opentalent DB');
|
|
|
++$i;
|
|
|
- if (null !== $progressionCallback) {
|
|
|
+ if ($progressionCallback !== null) {
|
|
|
$progressionCallback($i, $total);
|
|
|
}
|
|
|
continue;
|
|
|
@@ -150,9 +150,9 @@ class DolibarrSyncService
|
|
|
|
|
|
// Sync contact data of the client
|
|
|
$mainAddress = $this->getOrganizationPostalAddress($organization);
|
|
|
- if (null !== $mainAddress) {
|
|
|
+ if ($mainAddress !== null) {
|
|
|
$streetAddress = $this->addressPostalUtils->getFullStreetAddress($mainAddress);
|
|
|
- if ('' !== trim($mainAddress->getAddressOwner() ?? '')) {
|
|
|
+ if (trim($mainAddress->getAddressOwner() ?? '') !== '') {
|
|
|
$streetAddress = $mainAddress->getAddressOwner()."\n".$streetAddress;
|
|
|
}
|
|
|
$newSocietyData['address'] = $streetAddress;
|
|
|
@@ -264,14 +264,14 @@ class DolibarrSyncService
|
|
|
];
|
|
|
|
|
|
// The person's id may be missing if the contact is new or if it was found through its name
|
|
|
- if (null !== $dolibarrContact && !(empty($dolibarrContact['array_options'] ?? []))) {
|
|
|
+ if ($dolibarrContact !== null && !(empty($dolibarrContact['array_options'] ?? []))) {
|
|
|
$newContactData['array_options'] = $dolibarrContact['array_options'];
|
|
|
} else {
|
|
|
$newContactData['array_options'] = [];
|
|
|
}
|
|
|
$newContactData['array_options']['options_2iopen_person_id'] = (string) $person->getId();
|
|
|
|
|
|
- if (null === $dolibarrContact) {
|
|
|
+ if ($dolibarrContact === null) {
|
|
|
// New contact
|
|
|
$newContactData['socid'] = $dolibarrSocietyId;
|
|
|
|
|
|
@@ -308,7 +308,7 @@ class DolibarrSyncService
|
|
|
continue;
|
|
|
}
|
|
|
$personId = (int) $contactData['array_options']['options_2iopen_person_id'];
|
|
|
- if (0 === (int) $contactData['statut']) {
|
|
|
+ if ((int) $contactData['statut'] === 0) {
|
|
|
// contact is already disabled
|
|
|
continue;
|
|
|
}
|
|
|
@@ -359,7 +359,7 @@ class DolibarrSyncService
|
|
|
|
|
|
// Next society
|
|
|
++$i;
|
|
|
- if (null !== $progressionCallback) {
|
|
|
+ if ($progressionCallback !== null) {
|
|
|
$progressionCallback($i, $total);
|
|
|
}
|
|
|
}
|
|
|
@@ -397,7 +397,7 @@ class DolibarrSyncService
|
|
|
// operation has already been treated
|
|
|
$this->logger->warning('Tried to execute an operation that was not marked as ready : '.$operation);
|
|
|
++$i;
|
|
|
- if (null !== $progressionCallback) {
|
|
|
+ if ($progressionCallback !== null) {
|
|
|
$progressionCallback($i, $total);
|
|
|
}
|
|
|
continue;
|
|
|
@@ -436,7 +436,7 @@ class DolibarrSyncService
|
|
|
}
|
|
|
|
|
|
++$i;
|
|
|
- if (null !== $progressionCallback) {
|
|
|
+ if ($progressionCallback !== null) {
|
|
|
$progressionCallback($i, $total);
|
|
|
}
|
|
|
}
|
|
|
@@ -550,8 +550,8 @@ class DolibarrSyncService
|
|
|
foreach ($dolibarrContacts as $contactData) {
|
|
|
if (
|
|
|
!($contactData['array_options']['options_2iopen_person_id'] ?? null)
|
|
|
- && null !== $person->getName()
|
|
|
- && null !== $person->getGivenName()
|
|
|
+ && $person->getName() !== null
|
|
|
+ && $person->getGivenName() !== null
|
|
|
&& strtolower($person->getName()) === strtolower($contactData['lastname'] ?? '')
|
|
|
&& strtolower($person->getGivenName()) === strtolower($contactData['firstname'] ?? '')
|
|
|
) {
|
|
|
@@ -575,14 +575,14 @@ class DolibarrSyncService
|
|
|
*/
|
|
|
protected function sanitizeDolibarrData(?array $data): ?array
|
|
|
{
|
|
|
- if (null === $data) {
|
|
|
+ if ($data === null) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
foreach ($data as $field => $value) {
|
|
|
if (is_array($value)) {
|
|
|
$data[$field] = $this->sanitizeDolibarrData($value);
|
|
|
- } elseif ('' === $value) {
|
|
|
+ } elseif ($value === '') {
|
|
|
$data[$field] = null;
|
|
|
}
|
|
|
}
|
|
|
@@ -633,10 +633,10 @@ class DolibarrSyncService
|
|
|
foreach ($contactPriorities as $contactType) {
|
|
|
foreach ($contactPoints as $contactPoint) {
|
|
|
if ($contactPoint->getContactType() === $contactType) {
|
|
|
- if (null !== $contactPoint->getTelphone()) {
|
|
|
+ if ($contactPoint->getTelphone() !== null) {
|
|
|
return $this->formatPhoneNumber($contactPoint->getTelphone());
|
|
|
}
|
|
|
- if (null !== $contactPoint->getMobilPhone()) {
|
|
|
+ if ($contactPoint->getMobilPhone() !== null) {
|
|
|
return $this->formatPhoneNumber($contactPoint->getMobilPhone());
|
|
|
}
|
|
|
}
|
|
|
@@ -662,7 +662,7 @@ class DolibarrSyncService
|
|
|
|
|
|
foreach ($contactPriorities as $contactType) {
|
|
|
foreach ($contactPoints as $contactPoint) {
|
|
|
- if ($contactPoint->getContactType() === $contactType && null !== $contactPoint->getEmail()) {
|
|
|
+ if ($contactPoint->getContactType() === $contactType && $contactPoint->getEmail() !== null) {
|
|
|
return $contactPoint->getEmail();
|
|
|
}
|
|
|
}
|
|
|
@@ -677,7 +677,7 @@ class DolibarrSyncService
|
|
|
protected function getOrganizationNetworkId(Organization $organization): ?int
|
|
|
{
|
|
|
foreach ($organization->getNetworkOrganizations() as $networkOrganization) {
|
|
|
- if (null !== $networkOrganization->getEndDate() && $networkOrganization->getEndDate() < new \DateTime()) {
|
|
|
+ if ($networkOrganization->getEndDate() !== null && $networkOrganization->getEndDate() < new \DateTime()) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -792,20 +792,20 @@ class DolibarrSyncService
|
|
|
$product = $organization->getSettings()->getProduct();
|
|
|
|
|
|
// Association, school or school premium
|
|
|
- if (LegalEnum::ASSOCIATION_LAW_1901 === $organization->getLegalStatus()) {
|
|
|
- if (SettingsProductEnum::SCHOOL === $product) {
|
|
|
+ if ($organization->getLegalStatus() === LegalEnum::ASSOCIATION_LAW_1901) {
|
|
|
+ if ($product === SettingsProductEnum::SCHOOL) {
|
|
|
$expectedTags[] = self::ASSOCIATION_SCHOOL_TAG_ID;
|
|
|
}
|
|
|
- if (SettingsProductEnum::SCHOOL_PREMIUM === $product) {
|
|
|
+ if ($product === SettingsProductEnum::SCHOOL_PREMIUM) {
|
|
|
$expectedTags[] = self::ASSOCIATION_PREMIUM_TAG_ID;
|
|
|
}
|
|
|
}
|
|
|
// Local authorities, school or school premium
|
|
|
- if (LegalEnum::LOCAL_AUTHORITY === $organization->getLegalStatus()) {
|
|
|
- if (SettingsProductEnum::SCHOOL === $product) {
|
|
|
+ if ($organization->getLegalStatus() === LegalEnum::LOCAL_AUTHORITY) {
|
|
|
+ if ($product === SettingsProductEnum::SCHOOL) {
|
|
|
$expectedTags[] = self::LOCAL_AUTH_SCHOOL_TAG_ID;
|
|
|
}
|
|
|
- if (SettingsProductEnum::SCHOOL_PREMIUM === $product) {
|
|
|
+ if ($product === SettingsProductEnum::SCHOOL_PREMIUM) {
|
|
|
$expectedTags[] = self::LOCAL_AUTH_PREMIUM_TAG_ID;
|
|
|
}
|
|
|
}
|