dolibarr 21.0.0-alpha
|
Class to manage Blocked Log. More...
Public Member Functions | |
__construct (DoliDB $db) | |
Constructor. | |
loadTrackedEvents () | |
Load list of tracked events into $this->trackedevents. | |
getObjectLink () | |
Try to retrieve source object (it it still exists). | |
getUser () | |
Try to retrieve user author. | |
setObjectData (&$object, $action, $amounts, $fuser=null) | |
Populate properties of log from object data. | |
fetch ($id) | |
Get object from database. | |
dolEncodeBlockedData ($data, $mode=0) | |
Encode data. | |
dolDecodeBlockedData ($data, $mode=0) | |
Decode data. | |
setCertified () | |
Set block certified by authority. | |
create ($user, $forcesignature='') | |
Create blocked log in database. | |
checkSignature ($previoushash='', $returnarray=0) | |
Check if current signature still correct compared to the value in chain. | |
getPreviousHash ($withlock=0, $beforeid=0) | |
Get previous signature/hash in chain. | |
getLog ($element, $fk_object, $limit=0, $sortfield='', $sortorder='', $search_fk_user=-1, $search_start=-1, $search_end=-1, $search_ref='', $search_amount='', $search_code='') | |
Return array of log objects (with criteria) | |
getSignature () | |
Return the signature (hash) of the "genesis-block" (Block 0). | |
alreadyUsed ($ignoresystem=0) | |
Check if module was already used or not for at least one recording. | |
Private Member Functions | |
buildKeyForSignature () | |
Return a string for signature. | |
Class to manage Blocked Log.
Definition at line 28 of file blockedlog.class.php.
BlockedLog::__construct | ( | DoliDB | $db | ) |
Constructor.
Definition at line 152 of file blockedlog.class.php.
BlockedLog::alreadyUsed | ( | $ignoresystem = 0 | ) |
Check if module was already used or not for at least one recording.
int<0,1> | $ignoresystem Ignore system events for the test |
Definition at line 1240 of file blockedlog.class.php.
References dol_print_error(), and dol_syslog().
|
private |
Return a string for signature.
Note: rowid of line not included as it is not a business data and this allow to make backup of a year and restore it into another database with different id without comprimising checksums
Definition at line 1065 of file blockedlog.class.php.
Referenced by checkSignature(), and create().
BlockedLog::checkSignature | ( | $previoushash = '', | |
$returnarray = 0 ) |
Check if current signature still correct compared to the value in chain.
string | $previoushash | If previous signature hash is known, we can provide it to avoid to make a search of it in database. |
int<0,2> | $returnarray 1=Return array of details, 2=Return array of details including keyforsignature, 0=Boolean |
Definition at line 1027 of file blockedlog.class.php.
References buildKeyForSignature(), dol_hash(), and getPreviousHash().
BlockedLog::create | ( | $user, | |
$forcesignature = '' ) |
Create blocked log in database.
User | $user | Object user that create |
string | $forcesignature | Force signature (for example '0000000000' when we disabled the module) |
Definition at line 900 of file blockedlog.class.php.
References buildKeyForSignature(), dol_hash(), dol_now(), dol_syslog(), dolEncodeBlockedData(), and getPreviousHash().
BlockedLog::dolDecodeBlockedData | ( | $data, | |
$mode = 0 ) |
Decode data.
string | $data | Data to unserialize |
int | $mode | 0=unserialize, 1=json_decode |
Definition at line 865 of file blockedlog.class.php.
References jsonOrUnserialize().
Referenced by fetch().
BlockedLog::dolEncodeBlockedData | ( | $data, | |
$mode = 0 ) |
Encode data.
?stdClass | $data | Data to serialize |
int<0,1> | $mode 0=serialize, 1=json_encode |
Definition at line 845 of file blockedlog.class.php.
Referenced by create().
BlockedLog::fetch | ( | $id | ) |
Get object from database.
int | $id | Id of object to load |
Definition at line 781 of file blockedlog.class.php.
References dolDecodeBlockedData().
BlockedLog::getLog | ( | $element, | |
$fk_object, | |||
$limit = 0, | |||
$sortfield = '', | |||
$sortorder = '', | |||
$search_fk_user = -1, | |||
$search_start = -1, | |||
$search_end = -1, | |||
$search_ref = '', | |||
$search_amount = '', | |||
$search_code = '' ) |
Return array of log objects (with criteria)
string | $element | element to search |
int | $fk_object | id of object to search |
int<0,max> | $limit max number of element, 0 for all | |
string | $sortfield | sort field |
string | $sortorder | sort order |
int | $search_fk_user | id of user(s) |
int | $search_start | start time limit |
int | $search_end | end time limit |
string | $search_ref | search ref |
string | $search_amount | search amount |
string | $search_code | search code |
Definition at line 1132 of file blockedlog.class.php.
References natural_search().
BlockedLog::getObjectLink | ( | ) |
Try to retrieve source object (it it still exists).
Definition at line 249 of file blockedlog.class.php.
References $object.
BlockedLog::getPreviousHash | ( | $withlock = 0, | |
$beforeid = 0 ) |
Get previous signature/hash in chain.
int<0,1> | $withlock 1=With a lock | |
int | $beforeid | ID of a record |
Definition at line 1083 of file blockedlog.class.php.
References dol_print_error(), and getSignature().
Referenced by checkSignature(), and create().
BlockedLog::getSignature | ( | ) |
Return the signature (hash) of the "genesis-block" (Block 0).
Definition at line 1214 of file blockedlog.class.php.
References dol_hash(), dolibarr_set_const(), getDolGlobalString(), and getRandomPassword().
Referenced by getPreviousHash().
BlockedLog::getUser | ( | ) |
BlockedLog::loadTrackedEvents | ( | ) |
Load list of tracked events into $this->trackedevents.
Definition at line 163 of file blockedlog.class.php.
References getDolGlobalString().
BlockedLog::setCertified | ( | ) |
Set block certified by authority.
Definition at line 883 of file blockedlog.class.php.
BlockedLog::setObjectData | ( | & | $object, |
$action, | |||
$amounts, | |||
$fuser = null ) |
Populate properties of log from object data.
CommonObject | $object | object to store |
string | $action | action |
float | int | $amounts | amounts |
?User | $fuser | User object (forced) |
Definition at line 402 of file blockedlog.class.php.
References $object, dol_getIdFromCode(), and dol_syslog().