krick Posted September 10, 2013 Share Posted September 10, 2013 (edited) Dear, I have some problem trying to change the siret (on the registration page) so I can type in "123456-1234" instead of the 14 digits or what it is now.. Anyone who have any idea how I fix this? On the pic it says "Org-nr" Version: 15.5.0 Best regards, Edited September 11, 2013 by krick (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted September 10, 2013 Share Posted September 10, 2013 Hi krick, try this: edit file : classes/Validate.php find and add the red code: /** * Validate SIRET Code * @static * @param $siret SIRET Code * @return boolean Return true if is valid */ public static function isSiret($siret) { return (bool)preg_match('/^[0-9]{6}-[0-9]{4}$/s', $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); */ } So comment out the original test using /* original code */ and add the new test return (bool)preg_match('/^[0-9]{6}-[0-9]{4}$/s', $siret); Which tests for exactly 6 numbers, then a hypen, then exactly 4 numbers. Hope this helps, pascal 2 Link to comment Share on other sites More sharing options...
krick Posted September 11, 2013 Author Share Posted September 11, 2013 Hi krick, try this: edit file : classes/Validate.php find and add the red code: /** * Validate SIRET Code * @static * @param $siret SIRET Code * @return boolean Return true if is valid */ public static function isSiret($siret) { return (bool)preg_match('/^[0-9]{6}-[0-9]{4}$/s', $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); */ } So comment out the original test using /* original code */ and add the new test return (bool)preg_match('/^[0-9]{6}-[0-9]{4}$/s', $siret); Which tests for exactly 6 numbers, then a hypen, then exactly 4 numbers. Hope this helps, pascal Thank you very much for this! It worked without any problems Link to comment Share on other sites More sharing options...
PascalVG Posted September 11, 2013 Share Posted September 11, 2013 Glad I could help! Happy selling, Pascal Link to comment Share on other sites More sharing options...
imagemaster250787 Posted August 31, 2015 Share Posted August 31, 2015 Glad I could help! Happy selling, Pascal Hi Pascal, Can you please help me with this issuee . I want to change the SIREt coding in Romanian standards which is RO12345678 (its the VAT Number) . Can you please tell me what should I write in the validate.php? Also is it possible to show to my customers who are creating an account CUI instead of SIRET ? on the front end? Thank you very much for your help. Regards Mihai Link to comment Share on other sites More sharing options...
pietpetoors Posted April 18, 2016 Share Posted April 18, 2016 Hi Did that and managed to update the SIRET en APE numbers this way. But now I have a new problem. If that user who changed his details tries to access his Personal Information page again I get an "500 Server" error. If I log in with another user I do not get that error. Link to comment Share on other sites More sharing options...
pietpetoors Posted April 18, 2016 Share Posted April 18, 2016 try preg_match('/\d{12}/') 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