dolibarr  20.0.0-beta
Functions
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. More...
 
 isValidSiren ($siren)
 Check the syntax validity of a SIREN. More...
 
 isValidSiret ($siret)
 Check the syntax validity of a SIRET. More...
 
 isValidTinForPT ($str)
 Check the syntax validity of a Portuguese (PT) Tax Identification Number (TIN). More...
 
 isValidTinForDZ ($str)
 Check the syntax validity of an Algerian (DZ) Tax Identification Number (TIN). More...
 
 isValidTinForBE ($str)
 Check the syntax validity of a Belgium (BE) Tax Identification Number (TIN). More...
 
 isValidTinForES ($str)
 Check the syntax validity of a Spanish (ES) Tax Identification Number (TIN), where: More...
 

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().

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.