class mod_codeproduct_elephant extends ModeleProductCode (View source)

Class to manage product code with elephant rule

Properties

$name
$version
string $error from  CommonNumRefGenerator
string[] $errors from  CommonNumRefGenerator
protected DoliDB $db from  CommonNumRefGenerator
int<0, 1> $code_null from  CommonNumRefGenerator
int<0, 1> $code_modifiable from  CommonNumRefGenerator
int<0, 1> $code_modifiable_invalide from  CommonNumRefGenerator
int<0, 1> $code_modifiable_null from  CommonNumRefGenerator
int<0, 1> $code_auto from  CommonNumRefGenerator
int<0, 1> $prefixIsRequired from  CommonNumRefGenerator
int $position
string $searchcode
int $numbitcounter

Methods

string
getNom($langs)

Return model name

string
getName($langs)

Return model name

bool
isEnabled()

Return if a module can be used or not

string
info(Translate $langs)

Return description of module

bool
canBeActivated(CommonObject $object)

Checks if the numbers already in the database do not cause conflicts that would prevent this numbering working.

string
getVersion()

Returns version of numbering module

string
getExample(Translate $langs = null, Product|"" $objproduct = '', int<-1, 2> $type = -1)

Return an example of result returned by getNextValue

getNextValue(Product|"" $objproduct = null, int $type = -1)

Return next value

static 
liste_modeles($dbs, int $maxfilenamelength = 0)

Renvoi la liste des modeles de numérotation

getToolTip($langs, Product|"" $product, $type)

Return description of module parameters

verif_prefixIsUsed()

Check if mask/numbering use prefix

__construct()

Constructor

verif(DoliDB $db, string $code, Product $product, $type)

Check validity of code according to its rules

verif_dispo($db, string $code, $product)

Indicate if the code is available or not (by another third party)

Details

string getNom($langs)

Return model name

@param Translate $langs Object langs

Parameters

$langs

Return Value

string

Model name @deprecated Use getName() instead getName()

string getName($langs)

Return model name

@param Translate $langs Object langs

Parameters

$langs

Return Value

string

Model name

bool isEnabled()

Return if a module can be used or not

Return Value

bool

true if module can be used

string info(Translate $langs)

Return description of module

@param Translate $langs Object langs

Parameters

Translate $langs Language

Return Value

string

Descriptive text

bool canBeActivated(CommonObject $object)

Checks if the numbers already in the database do not cause conflicts that would prevent this numbering working.

Parameters

CommonObject $object

Object we need next value for

Return Value

bool

false if conflict, true if ok

string getVersion()

Returns version of numbering module

Return Value

string Valeur

string getExample(Translate $langs = null, Product|"" $objproduct = '', int<-1, 2> $type = -1)

Return an example of result returned by getNextValue

Parameters

Translate $langs

Object langs

Product|"" $objproduct

Object product

int<-1, 2> $type

Type of third party (1:customer, 2:supplier, -1:autodetect)

Return Value

string Example

getNextValue(Product|"" $objproduct = null, int $type = -1)

Return next value

Parameters

Product|"" $objproduct

Object product

int $type

Type @return string Value

static liste_modeles($dbs, int $maxfilenamelength = 0)

Renvoi la liste des modeles de numérotation

@param DoliDB $dbs Database handler

Parameters

$dbs
int $maxfilenamelength

Max length of value to show @return array|int List of numbers

getToolTip($langs, Product|"" $product, $type)

Return description of module parameters

@param Translate $langs Output language

Parameters

$langs
Product|"" $product

Product object @param int<-1,1> $type -1=Nothing, 0=Customer, 1=Supplier @return string HTML translated description

$type

verif_prefixIsUsed()

Check if mask/numbering use prefix

@return int 0 or 1

__construct()

Constructor

verif(DoliDB $db, string $code, Product $product, $type)

Check validity of code according to its rules

Parameters

DoliDB $db

Database handler

string $code

Code to check/correct

Product $product

Object product @param int $type 0 = product , 1 = service @return int 0 if OK -1 ErrorBadCustomerCodeSyntax -2 ErrorCustomerCodeRequired -3 ErrorCustomerCodeAlreadyUsed -4 ErrorPrefixRequired -5 Other (see this->error)

$type

verif_dispo($db, string $code, $product)

Indicate if the code is available or not (by another third party)

@param DoliDB $db Handler access base

Parameters

$db
string $code

Code a verifier @param Product $product Object product @return int 0 if available, <0 if KO

$product