Forráskód Böngészése

fix organization identifier validation regex

Olivier Massot 9 hónapja
szülő
commit
810cd9e0ac

+ 1 - 1
src/ApiResources/Organization/OrganizationCreationRequest.php

@@ -49,7 +49,7 @@ class OrganizationCreationRequest
     /**
      * Matricule (obligatoire dans le réseau CMF).
      */
-    #[Assert\Regex(pattern: '/^|(FR\d{12})$/')]
+    #[Assert\Regex(pattern: '/^|(FR\d{3}\w\d{8})$/')]
     private string $identifier = '';
 
     #[Assert\Regex(pattern: '/^|(\d+)$/')]

+ 1 - 1
src/Service/Organization/OrganizationFactory.php

@@ -502,7 +502,7 @@ class OrganizationFactory
 
         // Si réseau CMF, on vérifie que le matricule est valide
         if ($network->getId() === NetworkEnum::CMF->value) {
-            if (!preg_match("/FR\d{12}/", $organizationCreationRequest->getIdentifier())) {
+            if (!preg_match("/FR\d{3}\w\d{8}/", $organizationCreationRequest->getIdentifier())) {
                 throw new \RuntimeException('CMF identifier is missing or invalid.');
             }
         }