|
|
@@ -30,6 +30,10 @@ class DolibarrAccountBuilder
|
|
|
$accountData = $this->dolibarrApiService->getSociety($id);
|
|
|
$dolibarrAccount = $this->createDolibarrAccount($id, $accountData);
|
|
|
|
|
|
+ if ($dolibarrAccount->getSocId() === null) {
|
|
|
+ return $dolibarrAccount;
|
|
|
+ }
|
|
|
+
|
|
|
// Get active contract and services
|
|
|
$contractData = $this->dolibarrApiService->getActiveContract($dolibarrAccount->getSocId());
|
|
|
|
|
|
@@ -48,10 +52,14 @@ class DolibarrAccountBuilder
|
|
|
return $dolibarrAccount;
|
|
|
}
|
|
|
|
|
|
- public function createDolibarrAccount(int $organizationId, array $accountData): DolibarrAccount {
|
|
|
+ public function createDolibarrAccount(int $organizationId, ?array $accountData): DolibarrAccount {
|
|
|
$dolibarrAccount = new DolibarrAccount();
|
|
|
- $dolibarrAccount->setOrganizationId($organizationId)
|
|
|
- ->setSocId((int)$accountData['id'])
|
|
|
+ $dolibarrAccount->setOrganizationId($organizationId);
|
|
|
+ if ($accountData === null) {
|
|
|
+ return $dolibarrAccount;
|
|
|
+ }
|
|
|
+
|
|
|
+ $dolibarrAccount->setSocId((int)$accountData['id'])
|
|
|
->setClientNumber($accountData['code_client']);
|
|
|
|
|
|
if (
|