dolibarr 21.0.0-alpha
profid.lib.php File Reference

Set of functions for professional identifiers. More...

Go to the source code of this file.

Functions

 isValidLuhn ($str)
 Check if a string passes the Luhn algorithm test.
 
 isValidSiren ($siren)
 Check the syntax validity of a SIREN.
 
 isValidSiret ($siret)
 Check the syntax validity of a SIRET.
 
 isValidTinForPT ($str)
 Check the syntax validity of a Portuguese (PT) Tax Identification Number (TIN).
 
 isValidTinForDZ ($str)
 Check the syntax validity of an Algerian (DZ) Tax Identification Number (TIN).
 
 isValidTinForBE ($str)
 Check the syntax validity of a Belgium (BE) Tax Identification Number (TIN).
 
 isValidTinForES ($str)
 Check the syntax validity of a Spanish (ES) Tax Identification Number (TIN), where:
 

Detailed Description

Set of functions for professional identifiers.

Definition in file profid.lib.php.

Function Documentation

◆ isValidLuhn()

isValidLuhn ( $str)

Check if a string passes the Luhn algorithm test.

Parameters
string | int$strstring to check
Returns
bool True if the string passes the Luhn algorithm check, False otherwise
Since
Dolibarr V20

Definition at line 33 of file profid.lib.php.

References dol_strlen().

Referenced by isValidSiren(), and isValidSiret().

◆ isValidSiren()

isValidSiren ( $siren)

Check the syntax validity of a SIREN.

Parameters
string$sirenSIREN to check
Returns
boolean True if valid, False otherwise
Since
Dolibarr V20

Definition at line 59 of file profid.lib.php.

References dol_strlen(), and isValidLuhn().

Referenced by Societe\id_prof_check().

◆ isValidSiret()

isValidSiret ( $siret)

Check the syntax validity of a SIRET.

Parameters
string$siretSIRET to check
Returns
boolean True if valid, False otherwise
Since
Dolibarr V20

Specific case of "La Poste" businesses (SIRET such as "356 000 000 XXXXX"), for which the rule becomes: the sum of the 14 digits must be a multiple of 5. See https://fr.wikipedia.org/wiki/SIRET for details.

Definition at line 79 of file profid.lib.php.

References dol_strlen(), and isValidLuhn().

Referenced by Societe\id_prof_check().

◆ isValidTinForBE()

isValidTinForBE ( $str)

Check the syntax validity of a Belgium (BE) Tax Identification Number (TIN).

(NN = Numéro National)

Parameters
string$strNN to check
Returns
boolean True if valid, False otherwise
Since
Dolibarr V20

Definition at line 153 of file profid.lib.php.

Referenced by Societe\id_prof_check().

◆ isValidTinForDZ()

isValidTinForDZ ( $str)

Check the syntax validity of an Algerian (DZ) Tax Identification Number (TIN).

(NIF = Numéro d'Identification Fiscale)

Parameters
string$strTIN to check
Returns
boolean True if valid, False otherwise
Since
Dolibarr V20

Definition at line 132 of file profid.lib.php.

Referenced by Societe\id_prof_check().

◆ isValidTinForES()

isValidTinForES ( $str)

Check the syntax validity of a Spanish (ES) Tax Identification Number (TIN), where:

  • NIF = Número de Identificación Fiscal (used for residents only before 2008. Used for both residents and companies since 2008.)
  • CIF = Código de Identificación Fiscal (used for companies only before 2008. Replaced by NIF since 2008.)
  • NIE = Número de Identidad de Extranjero
Parameters
string$strTIN to check
Returns
int<-4,3> 1 if NIF ok, 2 if CIF ok, 3 if NIE ok, -1 if NIF bad, -2 if CIF bad, -3 if NIE bad, -4 if unexpected bad
Since
Dolibarr V20

Definition at line 177 of file profid.lib.php.

Referenced by Societe\id_prof_check().

◆ isValidTinForPT()

isValidTinForPT ( $str)

Check the syntax validity of a Portuguese (PT) Tax Identification Number (TIN).

(NIF = Número de Identificação Fiscal)

Parameters
string$strNIF to check
Returns
boolean True if valid, False otherwise
Since
Dolibarr V20

Definition at line 111 of file profid.lib.php.

Referenced by Societe\id_prof_check().