BlockedLog
class BlockedLog (View source)
Class to manage Blocked Log
Properties
| DoliDB | $db | ||
| int | $id | Id of the log |
|
| int | $entity | Entity | |
| string | $picto | Picto | |
| string | $error | ||
| string[] | $errors | ||
| string | $signature | Unique fingerprint of the log |
|
| float|string|null | $amounts | ||
| float|string|null | $amounts_taxexcl | ||
| string | $action | trigger action |
|
| string | $module_source | Module source |
|
| string | $linktype | ||
| string | $linktoref | ||
| string | $element | Object element |
|
| int | $fk_object | Object id |
|
| bool | $certified | Log certified by remote authority or not |
|
| int | $fk_user | Author | |
| int|string | $date_creation | ||
| int|string | $date_modification | ||
| int | $date_object | ||
| string | $ref_object | ||
| stdClass | $object_data | ||
| string | $object_version | ||
| string | $object_format | ||
| string | $user_fullname | ||
| string | $debuginfo | ||
| array<string, string|mixed> | $trackedevents | Array of tracked event codes |
|
| array<int|string, string> | $trackedmodules | Array of tracked modules (key => label) |
Methods
Load list of tracked events into $this->trackedevents.
Try to retrieve source object (it it still exists).
Try to retrieve user author
Populate properties of an unalterable log entry from object data.
Get object from database
Encode data
Decode data
Set block certified by an external authority
Check if calculated signature still correct compared to the value in the chain
Return the string for signature (clear data).
Get previous signature/hash in chain
Return array of log objects (with criteria)
Return the signature (hash) of the "genesis-block" (Block 0).
Check if module was already used or not for at least one recording.
Check if module can be enabled.
Check if module can be disabled.
Details
__construct(DoliDB $db)
Constructor
@param DoliDB $db Database handler
int<1, 1>
loadTrackedEvents()
Load list of tracked events into $this->trackedevents.
string
getObjectLink()
Try to retrieve source object (it it still exists).
string
getUser()
Try to retrieve user author
int<-1, -1>|int<1, 1>
setObjectData(CommonObject|stdClass $object, string $action, float|int $amounts, User $fuser = null, float|int|null $amounts_taxexcl = null)
Populate properties of an unalterable log entry from object data.
This populates ->object_data but also other fields like ->action, ->module_source, ->amounts_taxexcl, ->amounts and ->linktoref and ->linktype It also populates some debug info like ->element and ->fk_object
int<-1, 1>
fetch(int $id)
Get object from database
string
dolEncodeBlockedData(stdClass $data, int<0, 1> $mode = 0)
Encode data
object
dolDecodeBlockedData(string $data, int $mode = 0)
Decode data
bool
setCertified()
Set block certified by an external authority
int<-3, -1>|int<1, 1>
create(User $user, $forcesignature = '')
Create blocked log in database.
bool|array{checkresult: bool, calculatedsignature: string, previoushash: string, keyforsignature?: string}
checkSignature(string $previoushash = '', $returnarray = 0)
Check if calculated signature still correct compared to the value in the chain
string
buildKeyForSignature()
Return the string for signature (clear data).
getPreviousHash(int<0, 1> $withlock = 0, int $beforeid = 0)
Get previous signature/hash in chain
BlockedLog[]|int<-2, -1>
getLog(string $element, string|int $fk_object, int<0, max> $limit = 0, string $sortfield = '', string $sortorder = '', int $search_fk_user = -1, int $search_start = -1, int $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '', $search_signature = '', $search_module_source = '')
Return array of log objects (with criteria)
string
getOrInitFirstSignature()
Return the signature (hash) of the "genesis-block" (Block 0).
bool
alreadyUsed(int<0, 1> $ignoresystem = 0)
Check if module was already used or not for at least one recording.
string
canBeEnabled()
Check if module can be enabled.
int<0, 1>
canBeDisabled()
Check if module can be disabled.