New rule for FR siret value check
This commit is contained in:
parent
5392218806
commit
8ae90bebaf
@ -2888,7 +2888,23 @@ class Societe extends CommonObject
|
|||||||
$chaine=trim($this->idprof2);
|
$chaine=trim($this->idprof2);
|
||||||
$chaine=preg_replace('/(\s)/','',$chaine);
|
$chaine=preg_replace('/(\s)/','',$chaine);
|
||||||
|
|
||||||
|
if (!is_numeric($chaine)) return -1;
|
||||||
if (dol_strlen($chaine) != 14) return -1;
|
if (dol_strlen($chaine) != 14) return -1;
|
||||||
|
|
||||||
|
// on prend chaque chiffre un par un
|
||||||
|
// si son index (position dans la chaîne en commence à 0 au premier caractère) est pair
|
||||||
|
// on double sa valeur et si cette dernière est supérieure à 9, on lui retranche 9
|
||||||
|
// on ajoute cette valeur à la somme totale
|
||||||
|
|
||||||
|
for ($index = 0; $index < 14; $index ++)
|
||||||
|
{
|
||||||
|
$number = (int) $chaine[$index];
|
||||||
|
if (($index % 2) == 0) { if (($number *= 2) > 9) $number -= 9; }
|
||||||
|
$sum += $number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// le numéro est valide si la somme des chiffres est multiple de 10
|
||||||
|
if (($sum % 10) != 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Verify CIF/NIF/NIE if pays ES
|
//Verify CIF/NIF/NIE if pays ES
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user