Просмотр исходного кода

Merge branch 'hotfix/dolibarr_sync_cmf_cmf_parent' into develop

Olivier Massot 3 лет назад
Родитель
Сommit
59612c89c6
1 измененных файлов с 9 добавлено и 7 удалено
  1. 9 7
      src/Service/Dolibarr/DolibarrSyncService.php

+ 9 - 7
src/Service/Dolibarr/DolibarrSyncService.php

@@ -130,13 +130,15 @@ class DolibarrSyncService
             $newSocietyData['phone'] = $this->getOrganizationPhone($organization);
 
             // Sync Network
-            $newSocietyData['parent'] = '' . match (
-                $this->getOrganizationNetworkId($organization)
-            ) {
-                NetworkEnum::CMF()->getValue() => $cmfDolibarrId,
-                NetworkEnum::FFEC()->getValue() => $ffecDolibarrId,
-                default => null
-            };
+            if (!in_array($organization->getId(), [NetworkEnum::CMF()->getValue(), NetworkEnum::FFEC()->getValue()], true)) {
+                $newSocietyData['parent'] = '' . match (
+                    $this->getOrganizationNetworkId($organization)
+                    ) {
+                        NetworkEnum::CMF()->getValue() => $cmfDolibarrId,
+                        NetworkEnum::FFEC()->getValue() => $ffecDolibarrId,
+                        default => null
+                    };
+            }
 
             // More infos
             $infos = [];