Browse Source

minor fixes

Olivier Massot 1 year ago
parent
commit
6fd4f8e61f
1 changed files with 3 additions and 10 deletions
  1. 3 10
      src/Service/Organization/OrganizationFactory.php

+ 3 - 10
src/Service/Organization/OrganizationFactory.php

@@ -498,8 +498,8 @@ class OrganizationFactory
 
         if ($parent->getSettings()->getProduct() !== SettingsProductEnum::MANAGER) {
             throw new \RuntimeException(
-                "Parent organization must have the product 'manager' (actual product: " .
-                $organizationCreationRequest->getParentId() . ")"
+                "Parent organization must have the product 'manager' (actual product: '" .
+                $parent->getSettings()->getProduct()->value . "')"
             );
         }
 
@@ -515,13 +515,6 @@ class OrganizationFactory
             if (!preg_match("/FR\d{12}/", $organizationCreationRequest->getIdentifier())) {
                 throw new \RuntimeException("CMF identifier is missing or invalid.");
             }
-            if ($this
-                ->organizationRepository
-                ->count(
-                    ['identifier' => $organizationCreationRequest->getIdentifier()]
-                ) > 0) {
-                throw new \RuntimeException("CMF identifier is already registered : '" . $organizationCreationRequest->getIdentifier() ."'");
-            }
         }
 
         $networkOrganization = new NetworkOrganization();
@@ -734,7 +727,7 @@ class OrganizationFactory
         );
 
         if ($response->getStatusCode() !== Response::HTTP_OK) {
-            throw new \RuntimeException('An error happened while updating the adminassos database');
+            throw new \RuntimeException('An error happened while updating the adminassos database: ' . $response->getContent());
         }
     }