Jump to content

[SOLVED] Change siret


krick

Recommended Posts

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,

post-661012-0-04770900-1378803533_thumb.png

Edited by krick (see edit history)
Link to comment
Share on other sites

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

  • Like 2
Link to comment
Share on other sites

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

  • 1 year later...

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

  • 7 months later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...