class Logs extends CrudObject (View source)

Logs class

Properties

string $element from CrudObject
string $table_element
array $fetch_fields from CrudObject
array $date_fields from CrudObject
string $pk_name
string $ref_field_name from CrudObject
array $rows from CrudObject
string $triggers_prefix from CrudObject

Methods

__construct()

Constructor

$this
setTableName($table_name)

Set table name

int
create(array $data, int $notrigger = 1)

Create object into database

int
fetch(int $id, string $ref = '')

Load object in memory from database

int
fetchWhere(string $where)

Load object in memory from database (wrapper for fetchAll function)

int
fetchAll(string $where = '')

Load all object entries in memory from database

int
update(array $data, int $notrigger = 1)

Update object into database

int
updateWhere(array $data, string $where, int $notrigger = 1)

Update row(s) into database (wrapper for updateAll function)

int
updateAll(array $data, string $where = '', int $notrigger = 1)

Update all object rows into database

int
delete(int $notrigger = 1)

Delete object in database

int
deleteWhere(string $where, int $notrigger = 1)

Delete row(s) in database (wrapper for deleteAll function)

int
deleteAll(string $where = '', int $notrigger = 1)

Delete all object rows in database

int
deleteAllObjectLinked()

Delete all links between an object $this

string
escape($value)

Escape field value

int
run_triggers($action_suffix)

Run Dolibarr triggers (from other modules)

int
add(object $object, string $action, int $notrigger = 1)

Add log into database

Details

__construct()

Constructor

$this setTableName($table_name)

Set table name

Parameters

$table_name table name

Return Value

$this

int create(array $data, int $notrigger = 1)

Create object into database

Parameters

array $data array, e.: array('my_field_name' => 'my_field_value', 'second_field_name' => 'second_field_value')
int $notrigger 0=launch triggers after, 1=disable triggers

Return Value

int <0 if KO, Id of created object if OK

int fetch(int $id, string $ref = '')

Load object in memory from database

Parameters

int $id object Id
string $ref object ref

Return Value

int <0 if KO, >0 if OK

int fetchWhere(string $where)

Load object in memory from database (wrapper for fetchAll function)

Parameters

string $where where clause (without 'WHERE')

Return Value

int <0 if KO, >0 if OK

int fetchAll(string $where = '')

Load all object entries in memory from database

Parameters

string $where where clause (without 'WHERE')

Return Value

int <0 if KO, >0 if OK

int update(array $data, int $notrigger = 1)

Update object into database

Parameters

array $data array, e.: array('my_field_name' => 'my_field_value', 'second_field_name' => 'second_field_value')
int $notrigger 0=launch triggers after, 1=disable triggers

Return Value

int <0 if KO, >0 if OK

int updateWhere(array $data, string $where, int $notrigger = 1)

Update row(s) into database (wrapper for updateAll function)

Parameters

array $data array, e.: array('my_field_name' => 'my_field_value', 'second_field_name' => 'second_field_value')
string $where where clause (without 'WHERE')
int $notrigger 0=launch triggers after, 1=disable triggers

Return Value

int <0 if KO, >0 if OK

int updateAll(array $data, string $where = '', int $notrigger = 1)

Update all object rows into database

Parameters

array $data array, e.: array('my_field_name' => 'my_field_value', 'second_field_name' => 'second_field_value')
string $where where clause (without 'WHERE')
int $notrigger 0=launch triggers after, 1=disable triggers

Return Value

int <0 if KO, >0 if OK

int delete(int $notrigger = 1)

Delete object in database

Parameters

int $notrigger 0=launch triggers after, 1=disable triggers

Return Value

int <0 if KO, >0 if OK

int deleteWhere(string $where, int $notrigger = 1)

Delete row(s) in database (wrapper for deleteAll function)

Parameters

string $where where clause (without 'WHERE')
int $notrigger 0=launch triggers after, 1=disable triggers

Return Value

int <0 if KO, >0 if OK

int deleteAll(string $where = '', int $notrigger = 1)

Delete all object rows in database

Parameters

string $where where clause (without 'WHERE')
int $notrigger 0=launch triggers after, 1=disable triggers

Return Value

int <0 if KO, >0 if OK

protected int deleteAllObjectLinked()

Delete all links between an object $this

Return Value

int <0 if KO, >0 if OK

protected string escape($value)

Escape field value

Parameters

$value field value

Return Value

string escaped value

protected int run_triggers($action_suffix)

Run Dolibarr triggers (from other modules)

Parameters

$action_suffix action suffix

Return Value

int errors number

int add(object $object, string $action, int $notrigger = 1)

Add log into database

Parameters

object $object object
string $action log action
int $notrigger 0=launch triggers after, 1=disable triggers

Return Value

int <0 if KO, Id of created object if OK