diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5cd412be159..d1b87656588 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3996,6 +3996,20 @@ class Societe extends CommonObject } } + //Verify ID Prof 1 if country is BE (xxxx.xxx.xxx) (https://economie.fgov.be/fr/themes/entreprises/banque-carrefour-des/actualites/structure-du-numero) + //Returns: 1 if ok, -1 if bad, 0 if unexpected bad + if ($idprof == 1 && $soc->country_code == 'BE') { + $string = trim($this->idprof1); + $string = preg_replace('/(\s)/', '', $string); + + //Check + if (preg_match('/(^[0-9]{4}\.[0-9]{3}\.[0-9]{3}$)/', $string)) { + return 1; + } else { + return -1; + } + } + return $ok; }