class CProductNature extends CommonDict (View source)

Class of dictionary of nature of product (used by imports)

Properties

DoliDB $db from  CommonDict
$error from  CommonDict
string[] $errors from  CommonDict
int $id from  CommonDict
?int $entity from  CommonDict
?string $code from  CommonDict
?string $label from  CommonDict
?int<0, 1> $active from  CommonDict
CProductNature[] $records
string $element
string $table_element

Methods

__construct($db)

Constructor

create($user, int $notrigger = 0)

Create object into database

fetch($id, string $code = '')

Load object in memory from database

CProductNature[]|int<-1, -1>
fetchAll(string $sortorder = '', string $sortfield = '', int $limit = 0, int $offset = 0, string|array<string, mixed> $filter = '', string $filtermode = 'AND')

Load list of objects in memory from the database.

update($user = null, int $notrigger = 0)

Update object into database

delete(User $user, $notrigger = 0)

Delete object in database

int
getProductNatureFromCode(int $code, string $mode = 'code')

Get unit from code

Details

__construct($db)

Constructor

@param DoliDB $db Database handler

Parameters

$db

create($user, int $notrigger = 0)

Create object into database

@param User $user User that create

Parameters

$user
int $notrigger

0=launch triggers after, 1=disable triggers @return int Return integer <0 if KO, Id of created object if OK

fetch($id, string $code = '')

Load object in memory from database

@param int $id Id of CUnit object to fetch (rowid)

Parameters

$id
string $code

Code @return int Return integer <0 if KO, >0 if OK

CProductNature[]|int<-1, -1> fetchAll(string $sortorder = '', string $sortfield = '', int $limit = 0, int $offset = 0, string|array<string, mixed> $filter = '', string $filtermode = 'AND')

Load list of objects in memory from the database.

Parameters

string $sortorder

Sort Order

string $sortfield

Sort field

int $limit Limit
int $offset Offset
string|array<string, mixed> $filter

Filter USF

string $filtermode

Filter mode (AND or OR)

Return Value

CProductNature[]|int<-1, -1>

int <0 if KO, array of pages if OK

update($user = null, int $notrigger = 0)

Update object into database

@param User $user User that modify

Parameters

$user
int $notrigger

0=launch triggers after, 1=disable triggers @return int Return integer <0 if KO, >0 if OK

delete(User $user, $notrigger = 0)

Delete object in database

Parameters

User $user

User that delete @param int $notrigger 0=launch triggers after, 1=disable triggers @return int Return integer <0 if KO, >0 if OK

$notrigger

int getProductNatureFromCode(int $code, string $mode = 'code')

Get unit from code

Parameters

int $code

code of unit

string $mode

0= id , short_label=Use short label as value, code=use code

Return Value

int

Return integer <0 if KO, Id of code if OK