29require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/blockedlog/lib/blockedlog.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/blockedlog/class/blockedlog.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/json.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
48$langs->loadLangs(array(
'admin',
'banks',
'bills',
'blockedlog',
'cashdesk',
'other'));
51$action =
GETPOST(
'action',
'aZ09');
53$backtopage =
GETPOST(
'backtopage',
'alpha');
54$optioncss =
GETPOST(
'optioncss',
'aZ');
56$search_showonlyerrors =
GETPOSTINT(
'search_showonlyerrors');
57if ($search_showonlyerrors < 0) {
58 $search_showonlyerrors = 0;
61$search_startyear =
GETPOSTINT(
'search_startyear');
62$search_startmonth =
GETPOSTINT(
'search_startmonth');
63$search_startday =
GETPOSTINT(
'search_startday');
65$search_endmonth =
GETPOSTINT(
'search_endmonth');
67$search_id =
GETPOST(
'search_id',
'alpha');
68$search_fk_user =
GETPOST(
'search_fk_user',
'intcomma');
70if (
GETPOST(
'search_startyear') !=
'') {
71 $search_start =
dol_mktime(0, 0, 0, $search_startmonth, $search_startday, $search_startyear);
74if (
GETPOST(
'search_endyear') !=
'') {
75 $search_end =
dol_mktime(23, 59, 59, $search_endmonth, $search_endday, $search_endyear);
77$search_code =
GETPOST(
'search_code',
'array:alpha');
78$search_module_source = GETPOSTISSET(
'search_module_source') ?
GETPOST(
'search_module_source',
'array:alpha') : (
isModEnabled(
'takepos') ? array(
'takepos') : array());
79$search_pos_source =
GETPOST(
'search_pos_source');
80$search_ref =
GETPOST(
'search_ref',
'alpha');
81$search_type_code =
GETPOST(
'search_type_code',
'aZ09');
82$search_amount =
GETPOST(
'search_amount',
'alpha');
83$search_signature =
GETPOST(
'search_signature',
'alpha');
84$withtab = GETPOSTISSET(
'withtab') ?
GETPOSTINT(
'withtab') : 1;
86if (($search_start == -1 || empty($search_start)) && !GETPOSTISSET(
'search_startmonth') && !GETPOSTISSET(
'begin')) {
89 $search_startday = $tmparray[
'mday'];
90 $search_startmonth = $tmparray[
'mon'];
91 $search_startyear = $tmparray[
'year'];
94$includebeforev2 =
GETPOSTINT(
'includebeforev2');
98$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
99$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
101if (empty($page) || $page == -1) {
104$offset = $limit * $page;
105$pageprev = $page - 1;
106$pagenext = $page + 1;
108if (empty($sortfield)) {
109 $sortfield =
'rowid';
111if (empty($sortorder)) {
116$block_static->loadTrackedEvents();
119if ((!$user->admin && !$user->hasRight(
'blockedlog',
'read')) || !
isModEnabled(
'blockedlog')) {
126$max_execution_time_for_importexport =
getDolGlobalInt(
'EXPORT_MAX_EXECUTION_TIME', 300);
127$max_time = @ini_get(
"max_execution_time");
128if ($max_time && $max_time < $max_execution_time_for_importexport) {
129 dol_syslog(
"max_execution_time=".$max_time.
" is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.
". We try to increase it dynamically.");
130 @ini_set(
"max_execution_time", $max_execution_time_for_importexport);
134$MAXFORSHOWNLINKS =
getDolGlobalInt(
'BLOCKEDLOG_MAX_FOR_SHOWN_LINKS', 100);
144if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
146 $search_fk_user =
'';
149 $search_code = array();
150 $search_module_source =
isModEnabled(
'takepos') ? array(
'takepos') : array();
151 $search_pos_source =
'';
153 $search_type_code =
'';
155 $search_signature =
'';
156 $search_showonlyerrors = 0;
157 $search_startyear =
'';
158 $search_startmonth =
'';
159 $search_startday =
'';
160 $search_endyear =
'';
161 $search_endmonth =
'';
164 $search_array_options = array();
169 header(
"Location: ".DOL_URL_ROOT.
"/blockedlog/admin/blockedlog_archives.php");
181 $title = $langs->trans(
"ModuleSetup").
' '.$langs->trans(
'BlockedLog');
183 $title = $langs->trans(
"BrowseBlockedLog");
185$help_url =
"EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
187llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-blockedlog page-admin_blockedlog_list');
191$blocks = $block_static->getLog(
'all', (
string) $search_id, $MAXLINES, $sortfield, $sortorder, (
int) $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code, $search_signature, $search_module_source, $search_pos_source);
193if (!is_array($blocks)) {
195 setEventMessages($langs->trans(
"TooManyRecordToScanRestrictFilters", $MAXLINES),
null,
'errors');
197 dol_print_error($block_static->db, $block_static->error, $block_static->errors);
204 $linkback =
'<a href="'.dolBuildUrl($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
212 $texttop =
'<small class="opacitymedium">'.$langs->trans(
"RegistrationNumber").
':</small> <small>'.
dol_trunc($registrationnumber, 10).
'</small>';
218print
load_fiche_titre($title.
'<br>'.$texttop, $linkback,
'blockedlog', 0,
'',
'', $morehtmlcenter);
227print
'<div class="justify">';
228print
'<span class="opacitymedium hideonsmartphone">';
229print $langs->trans(
"FingerprintsDesc").
"<br>";
230print $langs->trans(
"FilesIntegrityDesc").
': ';
232print
'<a href="'.DOL_URL_ROOT.
'/blockedlog/admin/filecheck.php">'.
img_picto(
'',
'url',
'class="pictofixedwidth"').$langs->trans(
"FileCheck").
'</a>';
236$nbrecorddone = $block_static->countRecord();
238$maxtranspermonth = 10000;
239$nbrecordallowed = $mindisksize * 1024 * 1024 / 40 - $nbrecorddone;
240$nbmonthallowed = $nbrecordallowed / $maxtranspermonth;
243$htmltext .= $langs->trans(
"UnalterableLogTool2", $langs->transnoentitiesnoconv(
"Archives")).
"<br>";
244$htmltext .=
'<span class="small">'.$langs->trans(
"UnalterableLogTool2MaxUsage", $nbrecorddone, $mindisksize, $nbrecordallowed).
"</span><br>";
246$htmltext .=
'<span class="small">'.$langs->trans(
"UnalterableLogTool3").
"</span><br>";
247if (
$mysoc->country_code ==
'FR') {
248 $htmltext .=
'<br><span class="small">'.$langs->trans(
"UnalterableLogTool1FR", $langs->transnoentitiesnoconv(
"Archives")).
'</span><br>';
250 $htmltext .=
'<span class="small">'.$langs->trans(
"UnalterableLogTool2b", $langs->transnoentitiesnoconv(
"Archives")).
"</span><br>";
260 $param .=
'&contextpage='.urlencode($contextpage);
262if ($limit > 0 && $limit !=
$conf->liste_limit) {
263 $param .=
'&limit='.((int) $limit);
265if ($optioncss !=
'') {
266 $param .=
'&optioncss='.urlencode($optioncss);
268if ($search_id !=
'') {
269 $param .=
'&search_id='.urlencode($search_id);
271if ($search_ref !=
'') {
272 $param .=
'&search_ref='.urlencode($search_ref);
274if ($search_fk_user > 0) {
275 $param .=
'&search_fk_user='.urlencode($search_fk_user);
278 $param .=
'&search_module_source='.urlencode($search_module_source);
280if ($search_pos_source) {
281 $param .=
'&search_pos_source='.urlencode($search_pos_source);
283if ($search_type_code) {
284 $param .=
'&search_type_code='.urlencode($search_type_code);
286if ($search_startyear > 0) {
287 $param .=
'&search_startyear='.((int) $search_startyear);
289if ($search_startmonth > 0) {
290 $param .=
'&search_startmonth='.((int) $search_startmonth);
292if ($search_startday > 0) {
293 $param .=
'&search_startday='.((int) $search_startday);
295if ($search_endyear > 0) {
296 $param .=
'&search_endyear='.((int) $search_endyear);
298if ($search_endmonth > 0) {
299 $param .=
'&search_endmonth='.((int) $search_endmonth);
301if ($search_endday > 0) {
302 $param .=
'&search_endday='.((int) $search_endday);
305 $param .=
'&search_amount='.urlencode($search_amount);
307if ($search_signature) {
308 $param .=
'&search_signature='.urlencode($search_signature);
310if ($search_showonlyerrors > 0) {
311 $param .=
'&search_showonlyerrors='.((int) $search_showonlyerrors);
314 $param .=
'&withtab='.((int) $withtab);
319 unset($_SESSION[
'obfuscationkey_'.((
int)
$conf->entity)]);
320 unset(
$conf->cache[
'obfuscationkey_'.((int)
$conf->entity)]);
325$remoteobfuscationkey =
'';
328 $remoteobfuscationkey = $block_static->getObfuscationKey();
333 print
'<div class="error mess1">';
334 print $e->getMessage();
336 print
'<a class="" href="'.$_SERVER[
"PHP_SELF"].
'?clearcache=1">'.$langs->trans(
"Retry").
'</a>';
342$hmac_encoded_secret_key = $block_static->getEncodedHMACSecretKey();
343if (empty($hmac_encoded_secret_key)) {
345 print
'<div class="error mess2">';
346 print
'Error: BLOCKEDLOG_HMAC_KEY was not found. It should have been initialized to a value "BLOCKEDLOG_HMAC_...." during initialization of module BlockedLog or during migration from a very old version.';
351$hmac_secret_key =
'';
354 $hmac_secret_key = $block_static->getClearHMACSecretKey($hmac_encoded_secret_key);
356 print
'<div class="error mess3">';
357 print $e->getMessage();
359 print
'<a class="" href="'.$_SERVER[
"PHP_SELF"].
'?clearcache=1">'.$langs->trans(
"Retry").
'</a>';
364print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'" spellcheck="false">';
366if ($optioncss !=
'') {
367 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
369print
'<input type="hidden" name="token" value="'.newToken().
'">';
370print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
371print
'<input type="hidden" name="action" value="list">';
372print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
373print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
374print
'<input type="hidden" name="page" value="'.$page.
'">';
375print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
376print
'<input type="hidden" name="withtab" value="'.$withtab.
'">';
378print
'<div class="div-table-responsive">';
379print
'<table class="noborder centpercent liste">';
382print
'<tr class="liste_titre_filter">';
385if (
$conf->main_checkbox_left_column) {
386 print
'<td class="liste_titre center">';
387 $searchpicto = $form->showFilterButtons();
392print
'<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.dol_escape_htmltag($search_id).
'"></td>';
394print
'<td class="liste_titre">';
396print $form->selectDate($search_start,
'search_start');
399print $form->selectDate($search_end,
'search_end');
403print
'<td class="liste_titre">';
404print $form->select_dolusers($search_fk_user,
'search_fk_user', 1,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth100');
408print
'<td class="liste_titre">';
410print
'<input type="text" class="maxwidth100" name="search_module_source" list="search_module_sources" value="'.dol_escape_htmltag($search_module_source[0]).
'">';
412 print
'<datalist id="search_module_sources">
413 <option value="takepos">
414 <option value="backoffice">
420print
'<td class="liste_titre">';
421print
'<input type="text" class="maxwidth50" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
426$actioncodetoshowincombo = array();
428foreach ($block_static->trackedevents as $key => $value) {
429 if ($key ===
'PAYMENT_CUSTOMER_DELETE') {
430 $actioncodetoshowincombo[
'PAYMENT_CUSTOMER'] = array(
'id' =>
'PAYMENT_CUSTOMER',
'label' =>
'logPAYMENT_CUSTOMER',
'labelhtml' =>
img_picto(
'',
'bill',
'class="pictofixedwidth").').$langs->trans(
'logPAYMENT_CUSTOMER'));
431 unset($actioncodetoshowincombo[
'PAYMENT_CUSTOMER_CREATE']);
432 unset($actioncodetoshowincombo[
'PAYMENT_CUSTOMER_DELETE']);
434 $actioncodetoshowincombo[$key] = $value;
437$actioncodetoshowincombo[
'PAYMENT_CUSTOMER'] = array(
'id' =>
'PAYMENT_CUSTOMER',
'label' =>
'logPAYMENT_CUSTOMER',
'labelhtml' =>
img_picto(
'',
'bill',
'class="pictofixedwidth").').$langs->trans(
'logPAYMENT_CUSTOMER'));
439print
'<td class="liste_titre">';
440print $form->multiselectarray(
'search_code', $actioncodetoshowincombo, $search_code, 0, 0,
'maxwidth200', 1);
444print
'<td class="liste_titre"><input type="text" class="maxwidth100" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'"></td>';
450print
'<td class="liste_titre right"><input type="text" class="maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'"></td>';
453print
'<td class="liste_titre"></td>';
456print
'<td class="liste_titre"><input type="text" class="maxwidth50" name="search_signature" value="'.dol_escape_htmltag($search_signature).
'"></td>';
459print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
460$array = array(
"1" => $langs->trans(
"OnlyNonValid").
' (KO)');
461print $form->selectarray(
'search_showonlyerrors', $array, $search_showonlyerrors, 1, 0, 0,
'', 1, 0, 0,
'ASC',
'search_status width100 onrightofpage', 1);
466 print
'<td class="liste_titre"></td>';
467 print
'<td class="liste_titre"></td>';
471if (!
$conf->main_checkbox_left_column) {
472 print
'<td class="liste_titre center">';
473 $searchpicto = $form->showFilterButtons();
481print
'<tr class="liste_titre">';
483if (
$conf->main_checkbox_left_column) {
484 print
getTitleFieldOfList(
'<span id="blockchainstatus"></span>', 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="center"', $sortfield, $sortorder,
'').
"\n";
486print
getTitleFieldOfList($langs->trans(
'#'), 0, $_SERVER[
"PHP_SELF"],
'rowid',
'', $param,
'', $sortfield, $sortorder,
'minwidth50 ').
"\n";
487print
getTitleFieldOfList($langs->trans(
'Date'), 0, $_SERVER[
"PHP_SELF"],
'date_creation',
'', $param,
'', $sortfield, $sortorder,
'').
"\n";
488print
getTitleFieldOfList($langs->trans(
'Author'), 0, $_SERVER[
"PHP_SELF"],
'user_fullname',
'', $param,
'', $sortfield, $sortorder,
'').
"\n";
489print
getTitleFieldOfList($langs->trans(
'POS'), 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'').
"\n";
490print
getTitleFieldOfList($langs->trans(
'Terminal'), 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'').
"\n";
491print
getTitleFieldOfList($langs->trans(
'Action'), 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'').
"\n";
492print
getTitleFieldOfList($langs->trans(
'Ref'), 0, $_SERVER[
"PHP_SELF"],
'ref_object',
'', $param,
'', $sortfield, $sortorder,
'').
"\n";
494print
getTitleFieldOfList($langs->trans(
'Amount'), 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ', 0, $langs->trans(
"TotalTTCIfInvoiceSeeCompleteDataForDetail").
'<br>'.$langs->trans(
"AmountInCurrency",
getDolCurrency())).
"\n";
495print
getTitleFieldOfList($langs->trans(
'DataOfArchivedEvent'), 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ', 0, $langs->trans(
'DataOfArchivedEventHelp'), 1).
"\n";
496print
getTitleFieldOfList($langs->trans(
'Fingerprint'), 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'').
"\n";
497print
getTitleFieldOfList($form->textwithpicto($langs->trans(
'Status'), $langs->trans(
'DataOfArchivedEventHelp2')), 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ').
"\n";
499 print
getTitleFieldOfList(
'', 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'').
"\n";
500 print
getTitleFieldOfList(
'', 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'').
"\n";
503if (!
$conf->main_checkbox_left_column) {
504 print
getTitleFieldOfList(
'<span id="blockchainstatus"></span>', 0, $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="center"', $sortfield, $sortorder,
'').
"\n";
508$checkresult = array();
509$checkdetail = array();
510$checkerror = array();
514if (is_array($blocks)) {
515 foreach ($blocks as &$block) {
519 $tmpcheckresult = $block->checkSignature(
'', 1);
521 $checksignature = $tmpcheckresult[
'checkresult'];
523 $checkresult[$block->id] = $checksignature;
524 $checkdetail[$block->id] = $tmpcheckresult;
526 if (!empty($tmpcheckresult[
'error'])) {
527 $checkerror[$block->id] = $tmpcheckresult[
'error'];
529 if (!empty($block->note)) {
530 $checkresult[$block->id] =
false;
534 if (!$checksignature) {
535 if (empty($loweridinerror)) {
536 $loweridinerror = $block->id;
538 $loweridinerror = min($loweridinerror, $block->id);
544$refinvoicefound = array();
545$totalhtamount = array();
546$totalvatamount = array();
547$totalamount = array();
549if (is_array($blocks)) {
552 $object_link_title =
'';
561 $lastrecord = $block_static->getLastRecord();
563 $lockfile = $block_static->getEndOfChainFlagFile();
568 if (defined(
'BLOCKEDLOG_END_FLAG_IN_A_FILE')) {
569 if (!file_exists($lockfile)) {
572 print
'<tr><td class="center" colspan="'.$colspan.
'">';
573 if (
$mysoc->country_code ==
'FR') {
574 print
'<span class="error">'.$langs->trans(
"ErrorEndOfChainFlagWasRemoved").
'</span>';
576 print
'<span class="warning">'.$langs->trans(
"WarningNoProtectionOnEndOfChain").
'</span>';
580 $lockline = trim(file_get_contents($lockfile));
583 $sql =
"SELECT value from ".MAIN_DB_PREFIX.
"const";
584 $sql .=
" WHERE name = '".$db->escape(basename($lockfile)).
"' AND entity = ".((int)
$conf->entity);
585 $resql =
$db->query($sql);
587 $obj =
$db->fetch_object($resql);
589 $lockline = $obj->value;
593 print
'<tr><td class="center" colspan="'.$colspan.
'">';
594 if (
$mysoc->country_code ==
'FR') {
595 print
'<span class="error">'.$langs->trans(
"ErrorEndOfChainFlagWasRemoved").
'</span>';
597 print
'<span class="warning">'.$langs->trans(
"WarningNoProtectionOnEndOfChain").
'</span>';
606 if (preg_match(
'/^dolcrypt/', $lockline)) {
607 $headstring =
dolDecrypt($lockline,
'',
'BLOCKEDLOGHEAD');
608 } elseif (preg_match(
'/^dolobfuscation/', $lockline)) {
610 $remoteobfuscationkey = $block_static->getObfuscationKey();
611 if (empty($remoteobfuscationkey)) {
612 throw new Exception(
'Remote obfuscation key is empty');
617 print
'<tr><td class="center" colspan="'.$colspan.
'">';
618 $url_for_ping =
getDolGlobalString(
'MAIN_URL_FOR_PING',
"https://ping.dolibarr.org/");
619 print
'<span class="warning">'.$langs->trans(
"FailedToGetRemoteObfuscationKeyReTryLater", $url_for_ping).
'</span>';
621 print
'<span class="warning">'.$langs->trans(
"CantValidateEndOfChain").
'</span>';
624 $headstring =
dolDecrypt($lockline, $remoteobfuscationkey,
'BLOCKEDLOGHEAD');
628 if (preg_match(
'/^BLOCKEDLOGHEAD (\d+) ([^\s]+) ([a-zA-Z0-9\-]+)/', $headstring, $reg)) {
630 $lastrecordid = $lastrecord[
'id'];
631 $lastrecorddate = $lastrecord[
'date'];
632 $lastrecordsignature = $lastrecord[
'signature'];
634 if ($reg[1] > $lastrecordid || $reg[3] != $lastrecordsignature) {
638 print
'<tr><td class="center" colspan="'.$colspan.
'">';
639 print
'<span class="error">'.$langs->trans(
"ErrorEndOfChainRecordWasRemoved", str_replace(array(
'T',
'Z'),
' ',
dol_print_date($lastrecorddate,
'dayhourrfc',
'gmt')), str_replace(array(
'T',
'Z'),
' ', $reg[2])).
'</span>';
645 print
'<tr><td class="center" colspan="'.$colspan.
'">';
646 print
'<span class="error">'.$langs->trans(
"FailedToDecodeTheHeadFlagEndOfChainIsNotReliable").
'</span>';
652 foreach ($blocks as &$block) {
654 if (empty($search_showonlyerrors) || !$checkresult[$block->id]) {
658 if ($nbshown < $MAXFORSHOWNLINKS) {
659 $object_link = $block->getObjectLink();
660 $object_link_title =
'';
662 $object_link = $block->element.
'/'.$block->fk_object;
663 $object_link_title = $langs->trans(
'LinkHasBeenDisabledForPerformancePurpose');
667 print
'<tr class="oddeven">';
670 if (
$conf->main_checkbox_left_column) {
676 print
'<td>'.dolPrintHTML((
string) $block->id).
'</td>';
679 print
'<td class="nowraponall">'.dol_print_date($block->date_creation,
'dayhour',
'tzuserrel').
'</td>';
682 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($block->user_fullname).
'">';
688 $labelofmodulesource = $block->module_source;
689 print
'<td class="tdoverflowmax250" title="'.dolPrintHTMLForAttribute($labelofmodulesource).
'">'.
dolPrintHTML($labelofmodulesource).
'</td>';
692 print
'<td>'.dolPrintHTML($block->pos_source).
'</td>';
695 $labelofaction = $langs->transnoentitiesnoconv(
'log'.$block->action);
696 print
'<td class="" title="'.dolPrintHTMLForAttribute($labelofaction).
'">';
697 print
'<div class="twolinesmax-normallineheight minwidth200onall small">';
703 $total_ht = $total_vat = $total_ttc = 0;
707 print
'<td class="nowraponall"><div class="smallheight" title="'.dolPrintHTMLForAttribute(
price($total_ttc)).
'">';
708 if (!empty($block->ref_object)) {
710 if ($block->linktype && $block->linktoref) {
711 if ($block->linktype ==
'payment') {
712 print
'<br><span class="opacitymedium small">'.$langs->trans(
"PaymentOf").
' '.$block->linktoref.
'</span>';
714 if ($block->linktype ==
'replacedby') {
715 print
'<br><span class="opacitymedium small">'.$langs->trans(
"ReplacedBy").
' '.$block->linktoref.
'</span>';
717 if ($block->linktype ==
'credit_note_of') {
718 print
'<br><span class="opacitymedium small">'.$langs->trans(
"CreditNoteOf").
' '.$block->linktoref.
'</span>';
730 print
'<td class="right nowraponall"><span class="amount">';
731 if (!in_array($block->action, array(
'BLOCKEDLOG_EXPORT',
'CASHCONTROL_CLOSE',
'MODULE_SET',
'MODULE_RESET'))) {
732 $showamount = in_array($block->action, array(
'BILL_VALIDATE',
'PAYMENT_CUSTOMER_CREATE',
'PAYMENT_CUSTOMER_DELETE'));
734 print
price($total_ttc);
737 print
'</span></td>';
740 print
'<td class="center"><a href="#" data-blockid="'.$block->id.
'" rel="show-info">'.
img_picto($langs->trans(
'ShowDetails'),
'note',
'class="size15x"').
'</span></td>';
743 print
'<td class="nowraponall">';
745 $texttoshow = $langs->trans(
"Fingerprint").
' - '.$langs->trans(
"SavedOnLine").
' =<br>'.$block->signature;
746 $texttoshow .=
'<br><br>'.$langs->trans(
"Fingerprint").
' - Recalculated hash_hmac(\'sha256\', '.strtolower($langs->trans(
"PreviousHash").
' on previous line').
' + data, secret key) =<br>'.$checkdetail[$block->id][
'calculatedsignature'];
747 $texttoshow .=
'<br><span class="opacitymedium">'.$langs->trans(
"PreviousHash").
'='.$checkdetail[$block->id][
'previoushash'].
'</span>';
748 $texttoshow .=
'<br><span class="opacitymedium">'.$langs->trans(
"SecretKey").
'=Not available from interface</span>';
750 print $form->textwithpicto(
dol_trunc($block->signature, 8), $texttoshow, 1,
'help',
'', 0, 2,
'fingerprint'.$block->id);
754 print
'<td class="center">';
755 if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) {
756 if ($checkresult[$block->id]) {
758 print
'<span class="badge badge-status4 badge-status" title="'.dolPrintHTMLForAttribute($langs->trans(
'OkCheckFingerprintValidity')).
'">'.$langs->trans(
"StatusValid").
'</span>';
759 } elseif ($block->action ==
'MODULE_RESET') {
761 print
'<span class="badge badge-status8 badge-status" title="'.dolPrintHTMLForAttribute(
'Module has been disabled').
'">OK</span>';
763 print
'<span class="badge badge-status8 badge-status" title="';
764 if (!empty($checkerror[$block->id])) {
767 $alt = $langs->trans(
'KoCheckFingerprintValidity');
769 $notetoshow = $block->note;
770 $notetoshow = str_replace(
'EndOfChainDeletionDetected', $langs->trans(
"EndOfChainDeletionDetected"), $notetoshow);
771 $alt .=
"\n".
' '.$langs->trans(
"AddtionalInformation").
': '.$notetoshow;
777 print
'<span class="badge badge-status4 badge-status" title="'.$langs->trans(
'OkCheckFingerprintValidity').
'">'.$langs->trans(
"StatusValid").
'</span>';
781 if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) {
782 if ($checkresult[$block->id]) {
784 print $form->textwithpicto(
'', $langs->trans(
'OkCheckFingerprintValidityButChainIsKo'));
792 print
'<td class="nowraponall">';
793 print
'<!-- version -->';
794 print
'<span class="small">'.$block->object_version.
'<br>'.$block->object_format.
'</span>';
797 print
'<td class="tdoverflowmax150"'.(preg_match(
'/<a/', $object_link) ?
'' :
'title="'.dol_escape_htmltag(
dol_string_nohtmltag($object_link.($object_link_title ?
' - '.$object_link_title :
''))).
'"').
'>';
798 print
'<!-- object_link -->';
804 if (!
$conf->main_checkbox_left_column) {
805 print
'<td class="liste_titre">';
814 $showtotalfor = array();
815 foreach ($totalamount as $key => $totalamountofcodepersource) {
816 if ($key ==
'BILL_VALIDATE' || $key ==
'PAYMENT_CUSTOMER') {
817 foreach ($totalamountofcodepersource as $source => $tmpval) {
818 $showtotalfor[$source] = 1;
820 if (empty($totalamount[
'BILL_VALIDATE'][$source])) {
821 $totalamount[
'BILL_VALIDATE'][$source] = 0;
823 if (empty($totalamount[
'PAYMENT_CUSTOMER'][$source])) {
824 $totalamount[
'PAYMENT_CUSTOMER'][$source] = 0;
826 if (empty($totalhtamount[
'BILL_VALIDATE'][$source])) {
827 $totalhtamount[
'BILL_VALIDATE'][$source] = 0;
829 if (empty($totalhtamount[
'PAYMENT_CUSTOMER'][$source])) {
830 $totalhtamount[
'PAYMENT_CUSTOMER'][$source] = 0;
832 if (empty($totalvatamount[
'BILL_VALIDATE'][$source])) {
833 $totalvatamount[
'BILL_VALIDATE'][$source] = 0;
835 if (empty($totalvatamount[
'PAYMENT_CUSTOMER'][$source])) {
836 $totalvatamount[
'PAYMENT_CUSTOMER'][$source] = 0;
844 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
847 krsort($showtotalfor);
850 $afilterexists = ($search_id || ($search_fk_user > 0) || $search_ref || $search_amount || $search_signature);
853 foreach ($showtotalfor as $source => $tmpval) {
857 print
'<tr class="liste_titre totalblockedlog">';
858 print
'<td colspan="'.$colspan.
'"';
859 if ($countsource == 1) {
860 print
' style="border-top: 1px solid #000;"';
863 print $langs->trans(
"TotalForThePeriod");
864 print
' - '.($source ? $langs->trans(
"PointOfSale").
' '.ucfirst($source) : $langs->trans(
"BackOffice"));
865 print
' <span class="opacitylow">(';
866 if ($afilterexists) {
867 print
img_picto($langs->trans(
"ForPeriodAndFilters"),
'warning',
'class="pictofixedwidth"');
869 print $langs->trans(
"ForPeriodAndFilters").
')</span>';
873 foreach ($totalamount as $actioncode => $totalamountofcodepersource) {
874 if ($actioncode ==
'BILL_VALIDATE' && (!empty($search_code) && !in_array(
'BILL_VALIDATE', $search_code))) {
877 if ($actioncode ==
'PAYMENT_CUSTOMER' && (!empty($search_code) && !in_array(
'PAYMENT_CUSTOMER', $search_code))) {
882 print
'<tr class="liste_total totalblockedlog">';
885 if (
$conf->main_checkbox_left_column) {
891 print
'<td colspan="4">';
893 if ($actioncode ==
'BILL_VALIDATE') {
894 $s =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Turnover");
895 } elseif ($actioncode ==
'PAYMENT_CUSTOMER') {
896 $s =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"TurnoverCollected");
898 print $form->textwithpicto($s, $langs->trans(
"TotalForAction").
' '.$langs->trans(
'log'.$actioncode));
905 print
'<td class="right nowraponall" colspan="3">';
906 if ($actioncode ==
'BILL_VALIDATE') {
907 print
'<span class="amount">'.price($totalhtamount[$actioncode][$source]).
'</span>';
908 print
' '.$langs->trans(
"HT");
912 print
'<span class="amount">'.price($totalvatamount[$actioncode][$source]).
'</span>';
913 print
' '.$langs->trans(
"VAT");
918 print
'<span class="amount">'.price($totalamount[$actioncode][$source]).
'</span>';
919 if ($actioncode ==
'BILL_VALIDATE') {
920 print
' '.$langs->trans(
"TTC");
925 print
'<td class="center"></td>';
928 print
'<td class="nowraponall">';
932 print
'<td class="center">';
939 print
'<td class="tdoverflowmax150"'.(preg_match(
'/<a/', $object_link) ?
'' :
'title="'.dol_escape_htmltag(
dol_string_nohtmltag($object_link.($object_link_title ?
' - '.$object_link_title :
''))).
'"').
'>';
944 if (!
$conf->main_checkbox_left_column) {
945 print
'<td class="liste_titre">';
955 foreach ($showtotalfor as $source => $tmpval) {
958 if (empty($search_end) || $search_end == -1) {
965 $totalamountlifetime = array(
'BILL_VALIDATE' => array(),
'PAYMENT_CUSTOMER_CREATE' => array(),
'PAYMENT_CUSTOMER_DELETE' => array());
966 $totalhtamountlifetime = array(
'BILL_VALIDATE' => array(),
'PAYMENT_CUSTOMER_CREATE' => array(),
'PAYMENT_CUSTOMER_DELETE' => array());
969 $firstrecorddate = 0;
970 global $foundoldformat, $firstrecorddate;
971 include DOL_DOCUMENT_ROOT.
'/blockedlog/admin/lifetimeamount.inc.php';
972 '@phan-var-force array<string,array<string,float>> $totalamountlifetime';
973 '@phan-var-force array<string,array<string,float>> $totalhtamountlifetime';
975 print
'<tr class="liste_titre totalblockedlog" style="border-top: 1px solid #222">';
976 print
'<td colspan="'.$colspan.
'"';
977 if ($countsource == 1) {
978 print
' style="border-top: 1px solid #000;"';
982 print $langs->trans(
"TotalForLifetime");
983 print
' - '.($source ? $langs->trans(
"PointOfSale").
' '.ucfirst($source) : $langs->trans(
"BackOffice"));
985 print
' <span class="opacitymedium">('.dol_print_date($firstrecorddate,
'dayhour',
'tzuserrel');
986 if (
GETPOST(
'search_endyear') && $search_end && $search_end != -1) {
987 print
' - '.dol_print_date($search_end,
'dayhoursec',
'tzuserrel');
989 print
' - '.$langs->trans(
"Now");
996 if (empty($search_code) || in_array(
'BILL_VALIDATE', $search_code)) {
998 print
'<tr class="liste_total totalblockedlog">';
1001 if (
$conf->main_checkbox_left_column) {
1006 print
'<td colspan="4">';
1008 $s =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Turnover");
1009 print $form->textwithpicto($s, $langs->trans(
"TotalForAction").
' '.$langs->trans(
'logBILL_VALIDATE'));
1014 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"blockedlog WHERE object_format < 'V2' and action = 'BILL_VALIDATE' LIMIT 1";
1015 $resql =
$db->query($sql);
1016 $obj =
$db->fetch_object($resql);
1019 if ($includebeforev2) {
1020 print
' <span class="small"><a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?includebeforev2=0&'.($page ?
'page='.$page.
'&' :
'').$param.
'">'.$form->textwithpicto($langs->trans(
"OnlyFromV2"), $langs->trans(
"OnlyFromV2Help")).
'</a></span>';
1022 print
' <span class="small"><a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?includebeforev2=1&'.($page ?
'page='.$page.
'&' :
'').$param.
'">'.$form->textwithpicto($langs->trans(
"IncludesAll"), $langs->trans(
"IncludesAllHelp")).
'</a></span>';
1031 print
'<td class="right nowraponall" colspan="3">';
1032 print ($foundoldformat ?
'' :
'<span class="amount">'.
price($totalhtamountlifetime[
'BILL_VALIDATE'][$source]).
'</span> '.$langs->trans(
"HT")).($foundoldformat ?
'' :
' - <span class="amount">'.
price((float) $totalamountlifetime[
'BILL_VALIDATE'][$source] - (float) $totalhtamountlifetime[
'BILL_VALIDATE'][$source]).
'</span> '.$langs->transnoentitiesnoconv(
"VAT")).($foundoldformat ?
'' :
" - ").
'<span class="amount">'.
price($totalamountlifetime[
'BILL_VALIDATE'][$source]).
'</span> '.$langs->trans(
"TTC");
1036 print
'<td class="center"></td>';
1039 print
'<td class="nowraponall"></td>';
1042 print
'<td class="center"></td>';
1049 print
'<td class="tdoverflowmax150"'.(preg_match(
'/<a/', $object_link) ?
'' :
'title="'.dol_escape_htmltag(
dol_string_nohtmltag($object_link.($object_link_title ?
' - '.$object_link_title :
''))).
'"').
'>';
1054 if (!
$conf->main_checkbox_left_column) {
1055 print
'<td class="liste_titre"></td>';
1062 if (empty($search_code)
1063 || in_array(
'PAYMENT_CUSTOMER', $search_code)
1064 || in_array(
'PAYMENT_CUSTOMER_CREATE', $search_code)
1065 || in_array(
'PAYMENT_CUSTOMER_DELETE', $search_code)) {
1067 print
'<tr class="liste_total totalblockedlog">';
1070 if (
$conf->main_checkbox_left_column) {
1075 print
'<td colspan="4">';
1077 $s =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"TurnoverCollected");
1078 print $form->textwithpicto($s, $langs->trans(
"TotalForAction").
' '.$langs->trans(
'logPAYMENT_CUSTOMER'));
1086 print
'<td class="right nowraponall" colspan="3">';
1087 print
'<span class="amount">'.price((
float) $totalamountlifetime[
'PAYMENT_CUSTOMER_CREATE'][$source] + (
float) $totalamountlifetime[
'PAYMENT_CUSTOMER_DELETE'][$source]).
'</span>';
1091 print
'<td class="center"></td>';
1094 print
'<td class="nowraponall"></td>';
1097 print
'<td class="center"></td>';
1104 print
'<td class="tdoverflowmax150"'.(preg_match(
'/<a/', $object_link) ?
'' :
'title="'.dol_escape_htmltag(
dol_string_nohtmltag($object_link.($object_link_title ?
' - '.$object_link_title :
''))).
'"').
'>';
1109 if (!
$conf->main_checkbox_left_column) {
1110 print
'<td class="liste_titre"></td>';
1126print
'<script type="text/javascript">
1128jQuery(document).ready(function () {
1129 jQuery("#dialogforpopup").dialog({
1130 closeOnEscape: true,
1131 classes: { "ui-dialog": "highlight" },
1132 maxHeight: window.innerHeight-60,
1133 height: window.innerHeight-60,
1134 width: '.($conf->browser->layout ==
'phone' ? 400 : 700).
',
1137 }).css("z-index: 5000");
1139 $("a[rel=show-info]").click(function() {
1140 console.log("We click on tooltip a[rel=show-info], we open popup and get content using an ajax call");
1142 var fk_block = $(this).attr("data-blockid");
1146 data: { token: \''.currentToken().
'\' },
1147 url:
"'.DOL_URL_ROOT.'/blockedlog/ajax/block-info.php?id="+fk_block,
1149 }).done(
function(data) {
1150 jQuery(
"#dialogforpopup").html(data);
1153 var mydialog = jQuery(
"#dialogforpopup");
1154 mydialog.dialog({autoOpen:
false, modal:
true, height: (window.innerHeight - 150), width: \
'80%\', title: \''.
dol_escape_js($langs->transnoentitiesnoconv(
"UnlaterableDataOfEvent")).
'\',});
1155 mydialog.dialog("open");
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
sumAmountsForUnalterableEvent($block, &$refinvoicefound, &$totalhtamount, &$totalvatamount, &$totalamount, &$total_ht, &$total_vat, &$total_ttc)
sumAmountsForUnalterableEvent
userIsTaxAuditor()
Call remote API service to push the last counter and signature.
blockedlogadmin_prepare_head($withtabsetup)
Define head array for tabs of blockedlog tools setup pages.
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 wi...
isALNERunningVersion($blockedlogtestalreadydone=0, $blockedlogmodulealreadydone=0)
Return if the application is executed with the LNE requirements on.
Class to manage Blocked Log.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
getDolDefaultContextPage($s)
Return the default context page string.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
dolDecrypt($chain, $key='', $patterntotest='')
Decode a string with a symmetric encryption.