|
|
@@ -71,10 +71,10 @@ class DolibarrSyncService
|
|
|
*
|
|
|
* Returns an array of DolibarrSyncOperations
|
|
|
*
|
|
|
+ * @param callable | null $progressionCallback A callback method for indicating the current progression of the process;
|
|
|
+ * Shall accept two integer arguments: current progression, and total.
|
|
|
* @return array<BaseRestOperation>
|
|
|
* @throws Exception
|
|
|
- * @var callable | null $progressionCallback A callback method for indicating the current progression of the process;
|
|
|
- * Shall accept two integer arguments: current progression, and total.
|
|
|
*
|
|
|
* @noinspection NullPointerExceptionInspection
|
|
|
*/
|
|
|
@@ -233,8 +233,8 @@ class DolibarrSyncService
|
|
|
'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,
|
|
|
+ 'phone_pro' => $contact?->getTelphone() ? $this->formatPhoneNumber($contact->getTelphone()) : null,
|
|
|
+ 'phone_mobile' => $contact?->getMobilPhone() ? $this->formatPhoneNumber($contact->getMobilPhone()): null,
|
|
|
'poste' => $this->formatContactPosition($missions, $person->getGender()),
|
|
|
'statut' => '1'
|
|
|
];
|
|
|
@@ -318,10 +318,10 @@ class DolibarrSyncService
|
|
|
* Returns an array of DolibarrSyncOperations
|
|
|
*
|
|
|
* @param array<BaseRestOperation> $operations
|
|
|
+ * @param callable | null $progressionCallback A callback method for indicating the current progression of the process;
|
|
|
+ * Shall accept two integer arguments: current progression, and total.
|
|
|
* @return array<BaseRestOperation>
|
|
|
* @throws Exception
|
|
|
- *@var callable | null $progressionCallback A callback method for indicating the current progression of the process;
|
|
|
- * Shall accept two integer arguments: current progression, and total.
|
|
|
*/
|
|
|
public function execute(array $operations, ?callable $progressionCallback = null): array
|
|
|
{
|
|
|
@@ -361,7 +361,7 @@ class DolibarrSyncService
|
|
|
try {
|
|
|
$this->validateResponse($response, $operation);
|
|
|
} catch (RuntimeException $e) {
|
|
|
- $this->logger->warning($e);
|
|
|
+ $this->logger->warning($e->getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -369,7 +369,7 @@ class DolibarrSyncService
|
|
|
} catch (RuntimeException $e) {
|
|
|
$this->logger->error('Error while executing operation : ' . $operation);
|
|
|
$this->logger->error(implode("\n", $operation->getChangeLog()));
|
|
|
- $this->logger->error($e);
|
|
|
+ $this->logger->error($e->getMessage());
|
|
|
$errors++;
|
|
|
}
|
|
|
|
|
|
@@ -488,8 +488,8 @@ class DolibarrSyncService
|
|
|
!($contactData["array_options"]["options_2iopen_person_id"] ?? null) &&
|
|
|
$person->getName() !== null &&
|
|
|
$person->getGivenName() !== null &&
|
|
|
- strtolower($person->getName() ?? '') === strtolower($contactData["lastname"] ?? '') &&
|
|
|
- strtolower($person->getGivenName() ?? '') === strtolower($contactData["firstname"] ?? '')
|
|
|
+ strtolower($person->getName()) === strtolower($contactData["lastname"] ?? '') &&
|
|
|
+ strtolower($person->getGivenName()) === strtolower($contactData["firstname"] ?? '')
|
|
|
) {
|
|
|
return $contactData;
|
|
|
}
|
|
|
@@ -733,7 +733,7 @@ class DolibarrSyncService
|
|
|
* In the case of a validation error, throw an HttpException
|
|
|
*
|
|
|
* @param ResponseInterface $response
|
|
|
- * @param BaseRestOperation $operation
|
|
|
+ * @param UpdateOperation | CreateOperation $operation
|
|
|
* @throws RuntimeException
|
|
|
*/
|
|
|
protected function validateResponse(ResponseInterface $response, UpdateOperation | CreateOperation $operation): void
|