Explorar el Código

dolibarr-sync - do not set parent for cmf and ffec

Olivier Massot hace 3 años
padre
commit
ad5ab82fd6
Se han modificado 1 ficheros con 9 adiciones y 7 borrados
  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 = [];