Skip to content
Snippets Groups Projects
Commit 438f189a authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Correction sur la vérification du code INSEE pour les départements de naissance en outre mer

parent e097ce9d
No related branches found
No related tags found
No related merge requests found
...@@ -202,7 +202,10 @@ class NumeroINSEEValidator extends NumeroINSEE ...@@ -202,7 +202,10 @@ class NumeroINSEEValidator extends NumeroINSEE
private function isValidDepartementFrance() private function isValidDepartementFrance()
{ {
/* Département du numéro INSEE */ /* Département du numéro INSEE */
$iDepartement = strtoupper(str_pad((string)$this->getDepartement(), 3, '0', STR_PAD_LEFT)); $iDepartement = (string)$this->getDepartement();
if ($iDepartement != '97' && $iDepartement != '98') {
$iDepartement = strtoupper(str_pad($iDepartement, 3, '0', STR_PAD_LEFT));
}
/* Code du département issu du dossier */ /* Code du département issu du dossier */
$dDepartement = strtoupper(str_pad((string)$this->departement->getCode(), 3, '0', STR_PAD_LEFT)); $dDepartement = strtoupper(str_pad((string)$this->departement->getCode(), 3, '0', STR_PAD_LEFT));
...@@ -220,6 +223,12 @@ class NumeroINSEEValidator extends NumeroINSEE ...@@ -220,6 +223,12 @@ class NumeroINSEEValidator extends NumeroINSEE
return false; // département étranger return false; // département étranger
} }
//On traite les départements d'outre mer (peuvent etre sur deux ou trois chiffres, donc on teste que les deux premiers...)
if ($iDepartement == '97' || $iDepartement == '98') {
$dDepartement = substr($dDepartement, 0, 2);
if ($dDepartement == $iDepartement) return true;
}
if ($dDepartement == $iDepartement) return true; // Impec if ($dDepartement == $iDepartement) return true; // Impec
if ($iDepartement == '020') { if ($iDepartement == '020') {
...@@ -310,11 +319,12 @@ class NumeroINSEEValidator extends NumeroINSEE ...@@ -310,11 +319,12 @@ class NumeroINSEEValidator extends NumeroINSEE
if ($iDepartement == '99') { if ($iDepartement == '99') {
return 99; // étranger return 99; // étranger
} }
if ($iDepartement == '97' || $iDepartement == '98') {
/* if ($iDepartement == '97' || $iDepartement == '98') {
$iDepartement = substr(strtoupper($this->value), 5, 3); $iDepartement = substr(strtoupper($this->value), 5, 3);
return (int)$iDepartement; return (int)$iDepartement;
} }*/
return (int)$iDepartement; return (int)$iDepartement;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment