dolibarr 24.0.0-beta
blockedlog.lib.php File Reference

Library for common blockedlog functions. More...

Go to the source code of this file.

Functions

 getBlockedLogVersionToShow ()
 Define head array for tabs of blockedlog tools setup pages.
 
 blockedlogadmin_prepare_head ($withtabsetup)
 Define head array for tabs of blockedlog tools setup pages.
 
 isRegistrationDataSaved ()
 Return if the KYC mandatory parameters are set Must be the same fields than the one defined as mandatory into the registration form.
 
 isRegistrationDataSavedAndPushed ()
 Return if the KYC mandatory parameters are set AND pushed/registered centralized server.
 
 getHashUniqueIdOfRegistration ($algo='sha256')
 Return a hash unique identifier of the registration (used to identify the registration of instance without disclosing personal data)
 
 isALNEQualifiedVersion ($ignoredev=0, $ignoremodule=0)
 Return if the version is a candidate version to get the LNE certification and if the prerequisites are OK in production to be switched to LNE certified mode.
 
 isALNERunningVersion ($blockedlogtestalreadydone=0, $blockedlogmodulealreadydone=0)
 Return if the application is executed with the LNE requirements on.
 
 isBlockedLogUsed ($ignoresystem=0)
 Return if the blocked log was already used to block some events.
 
 pdfCertifMentionblockedLog (&$pdf, $outputlangs, $seller, $default_font_size, &$posy, $pdftemplate)
 Add legal mention.
 
 sumAmountsForUnalterableEvent ($block, &$refinvoicefound, &$totalhtamount, &$totalvatamount, &$totalamount, &$total_ht, &$total_vat, &$total_ttc)
 sumAmountsForUnalterableEvent
 
 callApiToGetObfuscationKey ($idprof1, $registrationnumber, $force=false)
 Call remote API service to get the obfuscation key.
 
 userIsTaxAuditor ()
 Call remote API service to push the last counter and signature.
 
 pdfWriteBlockedLogSignature (&$pdf, $outputlangs, $page_height, $object, &$w, &$posx, &$posy)
 Add some information from the blockedlog module.
 
 migrate_blockedlog_add_end_file ()
 Migrate an old database to add the .end flag.
 

Detailed Description

Library for common blockedlog functions.

Definition in file blockedlog.lib.php.

Function Documentation

◆ blockedlogadmin_prepare_head()

blockedlogadmin_prepare_head ( $withtabsetup)

Define head array for tabs of blockedlog tools setup pages.

Parameters
int$withtabsetupAdd also the tab "Setup"
Returns
array<array{0:string,1:string,2:string}> Array of head

Definition at line 53 of file blockedlog.lib.php.

References $conf, $db, $mysoc, $object, complete_head_from_modules(), dol_dir_list(), getDolGlobalString(), getMultidirOutput(), GETPOST(), and userIsTaxAuditor().

◆ callApiToGetObfuscationKey()

callApiToGetObfuscationKey ( $idprof1,
$registrationnumber,
$force = false )

Call remote API service to get the obfuscation key.

This function is only called by blockedlog->getObfuscationKey();

Parameters
string$idprof1Counter ID/value of ne record
string$registrationnumberRegistration number
boolean$forceFalse. Use true for tests.
Returns
string Obfuscationkey or 'ERROR ...' if error.

Definition at line 412 of file blockedlog.lib.php.

References $conf, $mysoc, dol_now(), dol_print_date(), dol_sanitizeKeyCode(), dol_syslog(), getBlockedLogVersionToShow(), getDolGlobalString(), getHashUniqueIdOfRegistration(), and getURLContent().

Referenced by BlockedLog\getObfuscationKey().

◆ getBlockedLogVersionToShow()

getBlockedLogVersionToShow ( )

Define head array for tabs of blockedlog tools setup pages.

Returns
string Version

Definition at line 34 of file blockedlog.lib.php.

Referenced by callApiToGetObfuscationKey().

◆ getHashUniqueIdOfRegistration()

getHashUniqueIdOfRegistration ( $algo = 'sha256')

Return a hash unique identifier of the registration (used to identify the registration of instance without disclosing personal data)

Parameters
string$algoAlgorithm to use for hash key
Returns
string Hash unique ID

Definition at line 186 of file blockedlog.lib.php.

References $conf, and dol_hash().

Referenced by callApiToGetObfuscationKey(), BlockedLog\getObfuscationKey(), and printCodeForPing().

◆ isALNEQualifiedVersion()

isALNEQualifiedVersion ( $ignoredev = 0,
$ignoremodule = 0 )

Return if the version is a candidate version to get the LNE certification and if the prerequisites are OK in production to be switched to LNE certified mode.

The difference with isALNERunningVersion() is that isALNEQualifiedVersion() just checks if it has a sense or not to activate the restrictions (it is not a check to say if we are or not in a mode with restrictions activated, but if we are in a context that has a sense to activate them). It can be used to show warnings or alerts to end users.

Parameters
int<0,1>$ignoredev Set this to 1 to ignore the fact the version is an alpha or beta version (to avoid return false on such version)
int<0,1>$ignoremodule Set this to 1 to not take into account if module BlockedLog is on, so function can be used during module activation.
Returns
string '' if false, or a string if true

Definition at line 204 of file blockedlog.lib.php.

References $mysoc, and isModEnabled().

Referenced by BlockedLog\canBeDisabled(), BlockedLog\canBeEnabled(), modBlockedLog\getDesc(), modBlockedLog\init(), and pdfCertifMentionblockedLog().

◆ isALNERunningVersion()

isALNERunningVersion ( $blockedlogtestalreadydone = 0,
$blockedlogmodulealreadydone = 0 )

Return if the application is executed with the LNE requirements on.

This function can be used to block some features like custom receipts, or to enable others like showing the information "Certified LNE".

Parameters
int$blockedlogtestalreadydoneTest on blockedlog used already done and we suppose it is true.
int$blockedlogmodulealreadydoneTest on blockedlog module already done and we suppose it is true.
Returns
boolean True or false

Definition at line 240 of file blockedlog.lib.php.

References isBlockedLogUsed(), and isModEnabled().

Referenced by BlockedLog\buildFinalSignatureHash(), BlockedLog\create(), modBlockedLog\init(), CommonInvoice\is_erasable(), CommonInvoice\isEditable(), CommonInvoice\isReplacable(), migrate_blockedlog_add_end_file(), pdfWriteAlreadyPaid(), pdfWriteBlockedLogSignature(), and dolReceiptPrinter\sendToPrinter().

◆ isBlockedLogUsed()

isBlockedLogUsed ( $ignoresystem = 0)

Return if the blocked log was already used to block some events.

Parameters
int<0,1>$ignoresystem Ignore system events for the test
Returns
boolean True if blocked log was already used, false if not

Definition at line 265 of file blockedlog.lib.php.

References $conf, $db, dol_print_error(), dol_syslog(), and isModEnabled().

Referenced by BlockedLog\alreadyUsed(), modBlockedLog\alreadyUsed(), and isALNERunningVersion().

◆ isRegistrationDataSaved()

isRegistrationDataSaved ( )

Return if the KYC mandatory parameters are set Must be the same fields than the one defined as mandatory into the registration form.

Returns
boolean True or false

Definition at line 143 of file blockedlog.lib.php.

References $mysoc, and getDolGlobalString().

Referenced by isRegistrationDataSavedAndPushed().

◆ isRegistrationDataSavedAndPushed()

isRegistrationDataSavedAndPushed ( )

Return if the KYC mandatory parameters are set AND pushed/registered centralized server.

Returns
boolean True or false

Definition at line 174 of file blockedlog.lib.php.

References getDolGlobalString(), and isRegistrationDataSaved().

◆ migrate_blockedlog_add_end_file()

migrate_blockedlog_add_end_file ( )

Migrate an old database to add the .end flag.

Returns
int Return -1 if KO, 1 if OK

Definition at line 668 of file blockedlog.lib.php.

References $conf, $db, $mysoc, dol_print_date(), dolChmod(), dolEncrypt(), isALNERunningVersion(), and string.

◆ pdfCertifMentionblockedLog()

pdfCertifMentionblockedLog ( & $pdf,
$outputlangs,
$seller,
$default_font_size,
& $posy,
$pdftemplate )

Add legal mention.

Parameters
TCPDF$pdfObject PDF
Translate$outputlangsObject lang
Societe$sellerSeller company
int$default_font_sizeDefault font size
float$posyY position
CommonDocGenerator$pdftemplatePDF template
Returns
int 0 if nothing done, 1 if a mention was printed

Definition at line 315 of file blockedlog.lib.php.

References isALNEQualifiedVersion().

Referenced by pdfCertifMention().

◆ pdfWriteBlockedLogSignature()

pdfWriteBlockedLogSignature ( & $pdf,
$outputlangs,
$page_height,
$object,
& $w,
& $posx,
& $posy )

Add some information from the blockedlog module.

Parameters
TCPDF$pdfObject PDF
Translate$outputlangsObject lang for output
float$page_heightHeight of page
Facture$objectObject invoice
int$wWidth for text
float$posxPos x
float$posyPos y
Returns
void

Definition at line 614 of file blockedlog.lib.php.

References $db, $object, dol_trunc(), isALNERunningVersion(), and isModEnabled().

Referenced by pdfWriteAdditionnalTitle().

◆ sumAmountsForUnalterableEvent()

sumAmountsForUnalterableEvent ( $block,
& $refinvoicefound,
& $totalhtamount,
& $totalvatamount,
& $totalamount,
& $total_ht,
& $total_vat,
& $total_ttc )

sumAmountsForUnalterableEvent

Parameters
BlockedLog$blockObject BlockedLog
array<string,int>$refinvoicefound Array of ref of invoice already found (to avoid duplicates. Should be useless but just in case of)
array<string,array<string,float>>$totalhtamount Array of total per code event and module
array<string,array<string,float>>$totalvatamount Array of total per code event and module
array<string,array<string,float>>$totalamount Array of total per code event and module
float$total_htTotal HT
float$total_vatTotal VAT
float$total_ttcTotal TTC
Returns
int Return > 0

Definition at line 355 of file blockedlog.lib.php.

◆ userIsTaxAuditor()

userIsTaxAuditor ( )

Call remote API service to push the last counter and signature.

Parameters
int$idCounter ID/value of ne record
string$signatureSignature of new record
int$datecreationDate creation of new record
int$testAdd property test to 1 if it is for test
int$previousidCounter ID/value of previous record
string$previoussignatureSignature of previous record
int$previousdatecreationDate creation of previous record
Returns
int Return <0 if KO, 0 if nothing done, >0 if OK Return if user is a tax auditor. Must be an external user and BLOCKEDLOG_FOR_TAX_AUDITOR must be set to 1 OR BLOCKEDLOG_FOR_TAX_AUDITOR must be set to 2
int Return > 0 if user is an external user so must be restricted to archive control feature

Definition at line 593 of file blockedlog.lib.php.

References getDolGlobalString().

Referenced by blockedlogadmin_prepare_head().