pixAN Posted February 12, 2019 Share Posted February 12, 2019 Bonjour, Comment prestashop fait pour valider le numéro de siret car si je rentre 14 chiffres au hasard , il met que le numero de tiret est invalide . Dans la classe validate.php j'ai trouvé ceci : public static function isSiret($siret) { if (Tools::strlen($siret) != 14) { return false; } $sum = 0; for ($i = 0; $i != 14; $i++) { $tmp = ((($i + 1) % 2) + 1) * intval($siret[$i]); if ($tmp >= 10) { $tmp -= 9; } $sum += $tmp; } return ($sum % 10 === 0); } Quelqu'un peut-il m'explique ce code? Car j'ai bien rentré 14 chiffres donc je ne comprend pas pourquoi il ne valide pas le numero de siret ? que vérifie -til ? Merci Link to comment Share on other sites More sharing options...
doekia Posted February 12, 2019 Share Posted February 12, 2019 (edited) il verifie le code LUHN tu connais google? Edited February 12, 2019 by doekia (see edit history) Link to comment Share on other sites More sharing options...
pixAN Posted February 12, 2019 Author Share Posted February 12, 2019 oui j'avais déjà fais des recherches sur google. Pouvez-vous être plus explicite sur le code LUN. Merci Link to comment Share on other sites More sharing options...
pixAN Posted February 12, 2019 Author Share Posted February 12, 2019 C'est bon j'ai compris le code LUHN en recherchant sur google , c'est très clair. Merci pour l'info Link to comment Share on other sites More sharing options...
coeos.pro Posted February 12, 2019 Share Posted February 12, 2019 Luhn, regarde ça https://fr.m.wikipedia.org/wiki/Système_d'identification_du_répertoire_des_entreprises Link to comment Share on other sites More sharing options...
pixAN Posted February 13, 2019 Author Share Posted February 13, 2019 oui merci pour le lien , ce que j'avais trouvé. tout est très clair désormais. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now