From 373a1d544cf355a66b769b8d5f8b244c38110fd5 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 20 Sep 2023 18:14:55 +0200 Subject: [PATCH] NEW : add IdProfCheck on thirdparty for BE (xxxx.xxx.xxx) --- htdocs/societe/class/societe.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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; }