dolibarr 23.0.3
blockedlog_list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
3 * Copyright (C) 2017-2018 Laurent Destailleur <eldy@destailleur.fr>
4 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
6 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
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';
46
47// Load translation files required by the page
48$langs->loadLangs(array('admin', 'banks', 'bills', 'blockedlog', 'other'));
49
50// Get Parameters
51$action = GETPOST('action', 'aZ09');
52$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : getDolDefaultContextPage(__FILE__); // To manage different context of search
53$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
54$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
55
56$search_showonlyerrors = GETPOSTINT('search_showonlyerrors');
57if ($search_showonlyerrors < 0) {
58 $search_showonlyerrors = 0;
59}
60
61$search_startyear = GETPOSTINT('search_startyear');
62$search_startmonth = GETPOSTINT('search_startmonth');
63$search_startday = GETPOSTINT('search_startday');
64$search_endyear = GETPOSTINT('search_endyear');
65$search_endmonth = GETPOSTINT('search_endmonth');
66$search_endday = GETPOSTINT('search_endday');
67$search_id = GETPOST('search_id', 'alpha'); // Can be a USF search string
68$search_fk_user = GETPOST('search_fk_user', 'intcomma');
69$search_start = -1;
70if (GETPOST('search_startyear') != '') {
71 $search_start = dol_mktime(0, 0, 0, $search_startmonth, $search_startday, $search_startyear);
72}
73$search_end = -1;
74if (GETPOST('search_endyear') != '') {
75 $search_end = dol_mktime(23, 59, 59, $search_endmonth, $search_endday, $search_endyear);
76}
77$search_code = GETPOST('search_code', 'array:alpha');
78$search_module_source = GETPOST('search_module_source', 'array:alpha');
79$search_ref = GETPOST('search_ref', 'alpha');
80$search_amount = GETPOST('search_amount', 'alpha');
81$search_signature = GETPOST('search_signature', 'alpha');
82
83if (($search_start == -1 || empty($search_start)) && !GETPOSTISSET('search_startmonth') && !GETPOSTISSET('begin')) {
84 $search_start = dol_time_plus_duree(dol_now(), -1, 'w');
85 $tmparray = dol_getdate($search_start);
86 $search_startday = $tmparray['mday'];
87 $search_startmonth = $tmparray['mon'];
88 $search_startyear = $tmparray['year'];
89}
90
91// Load variable for pagination
92$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
93$sortfield = GETPOST('sortfield', 'aZ09comma');
94$sortorder = GETPOST('sortorder', 'aZ09comma');
95$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
96if (empty($page) || $page == -1) {
97 $page = 0;
98} // If $page is not defined, or '' or -1
99$offset = $limit * $page;
100$pageprev = $page - 1;
101$pagenext = $page + 1;
102
103if (empty($sortfield)) {
104 $sortfield = 'rowid';
105}
106if (empty($sortorder)) {
107 $sortorder = 'DESC';
108}
109
110$block_static = new BlockedLog($db);
111$block_static->loadTrackedEvents();
112
113// Access Control
114if ((!$user->admin && !$user->hasRight('blockedlog', 'read')) || !isModEnabled('blockedlog')) {
116}
117
118$result = restrictedArea($user, 'blockedlog', 0, '');
119
120// Execution Time
121$max_execution_time_for_importexport = getDolGlobalInt('EXPORT_MAX_EXECUTION_TIME', 300); // 5mn if not defined
122$max_time = @ini_get("max_execution_time");
123if ($max_time && $max_time < $max_execution_time_for_importexport) {
124 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.");
125 @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300
126}
127
128$MAXLINES = getDolGlobalInt('BLOCKEDLOG_MAX_LINES', 10000);
129$MAXFORSHOWNLINKS = getDolGlobalInt('BLOCKEDLOG_MAX_FOR_SHOWN_LINKS', 100);
130
131
132/*
133 * Actions
134 */
135
136// Purge search criteria
137if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
138 $search_id = '';
139 $search_fk_user = '';
140 $search_start = -1;
141 $search_end = -1;
142 $search_code = array();
143 $search_module_source = '';
144 $search_ref = '';
145 $search_amount = '';
146 $search_signature = '';
147 $search_showonlyerrors = 0;
148 $search_startyear = '';
149 $search_startmonth = '';
150 $search_startday = '';
151 $search_endyear = '';
152 $search_endmonth = '';
153 $search_endday = '';
154 $toselect = array();
155 $search_array_options = array();
156}
157
158
159/*
160 * View
161 */
162
163$form = new Form($db);
164
165if (GETPOST('withtab', 'alpha')) {
166 $title = $langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog');
167} else {
168 $title = $langs->trans("BrowseBlockedLog");
169}
170$help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
171
172llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-blockedlog page-admin_blockedlog_list');
173
174$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);
175if (!is_array($blocks)) {
176 if ($blocks == -2) {
177 setEventMessages($langs->trans("TooManyRecordToScanRestrictFilters", $MAXLINES), null, 'errors');
178 } else {
179 dol_print_error($block_static->db, $block_static->error, $block_static->errors);
180 exit;
181 }
182}
183
184$linkback = '';
185if (GETPOST('withtab', 'alpha')) {
186 $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>';
187}
188
189$morehtmlcenter = '';
190
191$registrationnumber = getHashUniqueIdOfRegistration();
192$texttop = '<small class="opacitymedium">'.$langs->trans("RegistrationNumber").':</small> <small>'.dol_trunc($registrationnumber, 10).'</small>';
193
194print load_fiche_titre($title.'<br>'.$texttop, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter);
195
196$head = blockedlogadmin_prepare_head(GETPOST('withtab', 'alpha'));
197
198print dol_get_fiche_head($head, 'fingerprints', '', -1);
199
200//print $texttop;
201//print '<br><br>';
202
203print '<div class="opacitymedium hideonsmartphone justify">';
204
205print $langs->trans("FingerprintsDesc")."<br>";
206$s = $langs->trans("FilesIntegrityDesc", '{s}');
207$s = str_replace('{s}', DOL_URL_ROOT.'/blockedlog/admin/filecheck.php', $s);
208print $s;
209print "<br>\n";
210print "</div>\n";
211
212$htmltext = '';
213$htmltext .= $langs->trans("UnalterableLogTool2", $langs->transnoentitiesnoconv("Archives"))."<br>";
214$htmltext .= $langs->trans("UnalterableLogTool3")."<br>";
215
216print info_admin($htmltext, 0, 0, 'warning');
217
218
219print '<br>';
220
221$param = '';
222if ($contextpage != getDolDefaultContextPage(__FILE__)) {
223 $param .= '&contextpage='.urlencode($contextpage);
224}
225if ($limit > 0 && $limit != $conf->liste_limit) {
226 $param .= '&limit='.((int) $limit);
227}
228if ($search_id != '') {
229 $param .= '&search_id='.urlencode($search_id);
230}
231if ($search_ref != '') {
232 $param .= '&search_ref='.urlencode($search_ref);
233}
234if ($search_fk_user > 0) {
235 $param .= '&search_fk_user='.urlencode($search_fk_user);
236}
237if ($search_startyear > 0) {
238 $param .= '&search_startyear='.((int) $search_startyear);
239}
240if ($search_startmonth > 0) {
241 $param .= '&search_startmonth='.((int) $search_startmonth);
242}
243if ($search_startday > 0) {
244 $param .= '&search_startday='.((int) $search_startday);
245}
246if ($search_endyear > 0) {
247 $param .= '&search_endyear='.((int) $search_endyear);
248}
249if ($search_endmonth > 0) {
250 $param .= '&search_endmonth='.((int) $search_endmonth);
251}
252if ($search_endday > 0) {
253 $param .= '&search_endday='.((int) $search_endday);
254}
255if ($search_amount) {
256 $param .= '&search_amount='.urlencode($search_amount);
257}
258if ($search_signature) {
259 $param .= '&search_signature='.urlencode($search_signature);
260}
261if ($search_showonlyerrors > 0) {
262 $param .= '&search_showonlyerrors='.((int) $search_showonlyerrors);
263}
264if ($optioncss != '') {
265 $param .= '&optioncss='.urlencode($optioncss);
266}
267if (GETPOST('withtab', 'alpha')) {
268 $param .= '&withtab='.urlencode(GETPOST('withtab', 'alpha'));
269}
270
271print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
272
273if ($optioncss != '') {
274 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
275}
276print '<input type="hidden" name="token" value="'.newToken().'">';
277print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
278print '<input type="hidden" name="action" value="list">';
279print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
280print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
281print '<input type="hidden" name="page" value="'.$page.'">';
282print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
283print '<input type="hidden" name="withtab" value="'.GETPOST('withtab', 'alpha').'">';
284
285print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
286print '<table class="noborder centpercent liste">';
287
288// Line of filters
289print '<tr class="liste_titre_filter">';
290
291// Action column
292if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
293 print '<td class="liste_titre center">';
294 $searchpicto = $form->showFilterButtons();
295 print $searchpicto;
296 print '</td>';
297}
298
299print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.dol_escape_htmltag($search_id).'"></td>';
300
301print '<td class="liste_titre">';
302//print $langs->trans("from").': ';
303print $form->selectDate($search_start, 'search_start');
304//print '<br>';
305//print $langs->trans("to").': ';
306print $form->selectDate($search_end, 'search_end');
307print '</td>';
308
309// User
310print '<td class="liste_titre">';
311print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth100');
312print '</td>';
313
314// Module source
315print '<td class="liste_titre">';
316print $form->multiselectarray('search_module_source', $block_static->trackedmodules, $search_module_source, 0, 0, 'maxwidth150', 1);
317print '</td>';
318
319// Actions code
320print '<td class="liste_titre">';
321print $form->multiselectarray('search_code', $block_static->trackedevents, $search_code, 0, 0, 'maxwidth150', 1);
322print '</td>';
323
324// Ref
325print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
326
327// Amount
328print '<td class="liste_titre right"><input type="text" class="maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
329
330// Full data
331print '<td class="liste_titre"></td>';
332
333// Fingerprint
334print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_signature" value="'.dol_escape_htmltag($search_signature).'"></td>';
335
336// Status
337print '<td class="liste_titre center minwidth75imp parentonrightofpage">';
338$array = array("1" => "OnlyNonValid");
339print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1, 0, 0, '', 1, 0, 0, 'ASC', 'search_status width100 onrightofpage', 1);
340print '</td>';
341
342// Link to debug information object
343if (getDolGlobalString("BLOCKEDLOG_DEBUG")) { // If in experimental or develop mode, we add some debug information. It may help developers to find origin of bugs.
344 print '<td class="liste_titre"></td>';
345}
346
347// Action column
348if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
349 print '<td class="liste_titre center">';
350 $searchpicto = $form->showFilterButtons();
351 print $searchpicto;
352 print '</td>';
353}
354
355print '</tr>';
356
357
358print '<tr class="liste_titre">';
359// Action column
360if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
361 print getTitleFieldOfList('<span id="blockchainstatus"></span>', 0, $_SERVER["PHP_SELF"], '', '', $param, 'class="center"', $sortfield, $sortorder, '')."\n";
362}
363print getTitleFieldOfList($langs->trans('#'), 0, $_SERVER["PHP_SELF"], 'rowid', '', $param, '', $sortfield, $sortorder, 'minwidth50 ')."\n";
364print getTitleFieldOfList($langs->trans('Date'), 0, $_SERVER["PHP_SELF"], 'date_creation', '', $param, '', $sortfield, $sortorder, '')."\n";
365print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"], 'user_fullname', '', $param, '', $sortfield, $sortorder, '')."\n";
366print getTitleFieldOfList($langs->trans('POS'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n";
367print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n";
368print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n";
369print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ', 0, $langs->trans("TotalTTCIfInvoiceSeeCompleteDataForDetail").'<br>'.$langs->trans("AmountInCurrency", getDolCurrency()))."\n";
370print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp'), 1)."\n";
371print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n";
372print getTitleFieldOfList($form->textwithpicto($langs->trans('Status'), $langs->trans('DataOfArchivedEventHelp2')), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
373if (getDolGlobalString("BLOCKEDLOG_DEBUG")) { // If in experimental or develop mode, we add some debug information. It may help developers to find origin of bugs.
374 print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n";
375}
376// Action column
377if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
378 print getTitleFieldOfList('<span id="blockchainstatus"></span>', 0, $_SERVER["PHP_SELF"], '', '', $param, 'class="center"', $sortfield, $sortorder, '')."\n";
379}
380print '</tr>';
381
382$checkresult = array();
383$checkdetail = array();
384$loweridinerror = 0;
385
386if (getDolGlobalString('BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR')) {
387 // This is version that is faster but require more memory and report errors that are outside the filter range
388
389 // TODO Make a full scan of table in reverse order of id of $block, so we can use the parameter $previoushash into checkSignature to save requests
390 // to find the $loweridinerror.
391} else {
392 // This is version that optimize the memory (note: it will not report errors that are outside the filter range, but we don't need them)
393 if (is_array($blocks)) {
394 foreach ($blocks as &$block) {
395 //var_dump($block->id.' '.$block->signature, $block->object_data);
396 $tmpcheckresult = $block->checkSignature('', 1); // Note: this make a sql request at each call, we can't avoid this as the sorting order is various
397
398 $checksignature = $tmpcheckresult['checkresult'];
399
400 $checkresult[$block->id] = $checksignature; // false if error
401 $checkdetail[$block->id] = $tmpcheckresult;
402
403 if (!$checksignature) {
404 if (empty($loweridinerror)) {
405 $loweridinerror = $block->id;
406 } else {
407 $loweridinerror = min($loweridinerror, $block->id);
408 }
409 }
410 }
411 }
412}
413
414$refinvoicefound = array();
415$totalhtamount = array();
416$totalvatamount = array();
417$totalamount = array();
418
419if (is_array($blocks)) {
420 $nbshown = 0;
421 $object_link = '';
422 $object_link_title = '';
423
424 foreach ($blocks as &$block) {
425 //if (empty($search_showonlyerrors) || ! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))
426 if (empty($search_showonlyerrors) || !$checkresult[$block->id]) {
427 $nbshown++;
428
429 if (getDolGlobalString("BLOCKEDLOG_DEBUG")) {
430 if ($nbshown < $MAXFORSHOWNLINKS) { // For performance and memory purpose, we get/show the debug info link of objects only for the 100 first output
431 $object_link = $block->getObjectLink();
432 $object_link_title = '';
433 } else {
434 $object_link = $block->element.'/'.$block->fk_object;
435 $object_link_title = $langs->trans('LinkHasBeenDisabledForPerformancePurpose');
436 }
437 }
438
439 print '<tr class="oddeven">';
440
441 // Action column
442 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
443 print '<td class="liste_titre">';
444 print '</td>';
445 }
446
447 // ID
448 print '<td>'.dolPrintHTML((string) $block->id).'</td>';
449
450 // Date
451 print '<td class="nowraponall">'.dol_print_date($block->date_creation, 'dayhour').'</td>';
452
453 // User
454 print '<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($block->user_fullname).'">';
455 //print $block->getUser()
456 print dolPrintHTML($block->user_fullname);
457 print '</td>';
458
459 // ModulePOS
460 $labelofmodulesource = $block->module_source;
461 print '<td class="tdoverflowmax250" title="'.dolPrintHTMLForAttribute($labelofmodulesource).'">'.dolPrintHTML($labelofmodulesource).'</td>';
462
463 // Action
464 $labelofaction = $langs->transnoentitiesnoconv('log'.$block->action);
465 print '<td class="tdoverflowmax250" title="'.dolPrintHTMLForAttribute($labelofaction).'">'.dolPrintHTML($labelofaction).'</td>';
466
467 // Ref
468 print '<td class="nowraponall"><div class="smallheight">';
469 if (!empty($block->ref_object)) {
470 print dol_escape_htmltag($block->ref_object);
471 if ($block->linktype && $block->linktoref) {
472 if ($block->linktype == 'payment') {
473 print '<br><span class="opacitymedium small">'.$langs->trans("PaymentOf").' '.$block->linktoref.'</span>';
474 }
475 if ($block->linktype == 'replacedby') {
476 print '<br><span class="opacitymedium small">'.$langs->trans("ReplacedBy").' '.$block->linktoref.'</span>';
477 }
478 }
479 } else {
480 // Ref not stored
481 }
482 print '</div></td>';
483
484 //$tmpobj = json_decode($block->object_data);
485
486 // Define $totalhtamount, $totalvatamount, $totalamount for $block action code and module
487 $total_ht = $total_vat = $total_ttc = 0;
488 sumAmountsForUnalterableEvent($block, $refinvoicefound, $totalhtamount, $totalvatamount, $totalamount, $total_ht, $total_vat, $total_ttc);
489
490 // Amount
491 print '<td class="right nowraponall">';
492
493 if (empty($total_ttc)) {
494 print '<span class="opacitymedium">';
495 }
496 print price($total_ttc);
497 if (empty($total_ttc)) {
498 print '</span>';
499 }
500
501 print '</td>';
502
503 // Details link
504 print '<td class="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_picto($langs->trans('ShowDetails'), 'note', 'class="size15x"').'</span></td>';
505
506 // Fingerprint
507 print '<td class="nowraponall">';
508 // Note: the previous line id is not necessarily id-1, so in texttoshow we say "on previous line" without giving id to avoid a search/fetch to get previous id.
509 $texttoshow = $langs->trans("Fingerprint").' - '.$langs->trans("SavedOnLine").' =<br>'.$block->signature;
510 $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'];
511 $texttoshow .= '<br><span class="opacitymedium">'.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].'</span>';
512 $texttoshow .= '<br><span class="opacitymedium">'.$langs->trans("SecretKey").'=Not available from interface</span>';
513 //$texttoshow .= '<br>keyforsignature='.$checkdetail[$block->id]['keyforsignature'];
514 print $form->textwithpicto(dol_trunc($block->signature, 8), $texttoshow, 1, 'help', '', 0, 2, 'fingerprint'.$block->id);
515 print '</td>';
516
517 // Status
518 print '<td class="center">';
519 if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error
520 if ($checkresult[$block->id]) {
521 print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidityButChainIsKo').'">OK</span>';
522 } else {
523 print '<span class="badge badge-status8 badge-status" title="'.$langs->trans('KoCheckFingerprintValidity').'">KO</span>';
524 }
525 } else {
526 print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidity').'">OK</span>';
527 }
528
529 // Note
530 if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error
531 if ($checkresult[$block->id]) {
532 if (getDolGlobalString("BLOCKEDLOG_DEBUG")) {
533 print $form->textwithpicto('', $langs->trans('OkCheckFingerprintValidityButChainIsKo'));
534 }
535 }
536 }
537
538 /*
539 if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY') && getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL')) {
540 print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black'));
541 }
542 */
543 print '</td>';
544
545 // Link to debug information object
546 if (getDolGlobalString("BLOCKEDLOG_DEBUG")) { // If in experimental or develop mode, we add some debug information. It may help developers to find origin of bugs.
547 print '<td class="tdoverflowmax150"'.(preg_match('/<a/', $object_link) ? '' : 'title="'.dol_escape_htmltag(dol_string_nohtmltag($object_link.($object_link_title ? ' - '.$object_link_title : ''))).'"').'>';
548 print '<!-- object_link -->'; // $object_link can be a '<a href' link or a text
549 print $object_link;
550 print '</td>';
551 }
552
553 // Action column
554 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
555 print '<td class="liste_titre">';
556 print '</td>';
557 }
558
559 print '</tr>';
560 }
561 }
562
563 // Show total line
564 if ($nbshown == 0) {
565 $colspan = 11;
566 if (getDolGlobalString('MAIN_FEATURES_LEVEL') > 0) { // If in experimental or develop mode, we add some debug information. It may help developers to find origin of bugs.
567 $colspan++;
568 }
569 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
570 } else {
571 foreach ($totalamount as $key => $totalamountperref) {
572 if ($key == 'BILL_VALIDATE') {
573 // Total
574 print '<tr class="totalline">';
575
576 // Action column
577 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
578 print '<td class="liste_titre">';
579 print '</td>';
580 }
581
582 // ID
583 print '<td colspan="2">'.dolPrintHTML($langs->trans("TotalForAction").' '.$langs->trans('log'.$key)).'</td>';
584
585 // Date
586 //print '<td class="nowraponall"></td>';
587
588 // User
589 print '<td class="tdoverflowmax200">';
590 print '</td>';
591
592 // Module source
593 print '<td></td>';
594
595 // Action
596 print '<td></td>';
597
598 // Ref
599 print '<td class="nowraponall">';
600 print '</td>';
601
602 // Amount (HT)
603 print '<td class="right nowraponall">';
604 $totalhttoshow = 0;
605 foreach ($totalhtamount[$key] as $value) { // Loop on each module
606 $totalhttoshow += $value;
607 }
608 print $langs->trans("HT").': ';
609 print price($totalhttoshow);
610
611 print '<br>';
612
613 $totalvattoshow = 0;
614 foreach ($totalvatamount[$key] as $value) {
615 $totalvattoshow += $value;
616 }
617 print $langs->trans("VAT").': ';
618 print price($totalvattoshow);
619
620 print '<br>';
621
622 $totaltoshow = 0;
623 foreach ($totalamountperref as $value) {
624 $totaltoshow += $value;
625 }
626 print $langs->trans("TTC").': ';
627 print price($totaltoshow);
628 print '</td>';
629
630 // Details link
631 print '<td class="center"></td>';
632
633 // Fingerprint
634 print '<td class="nowraponall">';
635 print '</td>';
636
637 // Status
638 print '<td class="center">';
639 print '</td>';
640
641 // Link to debug information object
642 if (getDolGlobalString("BLOCKEDLOG_DEBUG")) { // If in experimental or develop mode, we add some debug information. It may help developers to find origin of bugs.
643 print '<td class="tdoverflowmax150"'.(preg_match('/<a/', $object_link) ? '' : 'title="'.dol_escape_htmltag(dol_string_nohtmltag($object_link.($object_link_title ? ' - '.$object_link_title : ''))).'"').'>';
644 print '</td>';
645 }
646
647 // Action column
648 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
649 print '<td class="liste_titre">';
650 print '</td>';
651 }
652
653 print '</tr>';
654 }
655 }
656 }
657}
658
659print '</table>';
660
661print '</div>';
662
663print '</form>';
664
665// Javascript to manage the showinfo popup
666print '<script type="text/javascript">
667
668jQuery(document).ready(function () {
669 jQuery("#dialogforpopup").dialog({
670 closeOnEscape: true,
671 classes: { "ui-dialog": "highlight" },
672 maxHeight: window.innerHeight-60,
673 height: window.innerHeight-60,
674 width: '.($conf->browser->layout == 'phone' ? 400 : 700).',
675 modal: true,
676 autoOpen: false
677 }).css("z-index: 5000");
678
679 $("a[rel=show-info]").click(function() {
680 console.log("We click on tooltip a[rel=show-info], we open popup and get content using an ajax call");
681
682 var fk_block = $(this).attr("data-blockid");
683
684 $.ajax({
685 method: "GET",
686 data: { token: \''.currentToken().'\' },
687 url: "'.DOL_URL_ROOT.'/blockedlog/ajax/block-info.php?id="+fk_block,
688 dataType: "html"
689 }).done(function(data) {
690 jQuery("#dialogforpopup").html(data);
691 });
692
693 var mydialog = jQuery("#dialogforpopup");
694 mydialog.dialog({autoOpen: false, modal: true, height: (window.innerHeight - 150), width: \'80%\', title: \''.dol_escape_js($langs->transnoentitiesnoconv("UnlaterableDataOfEvent")).'\',});
695 mydialog.dialog("open");
696 return false;
697 });
698})
699</script>'."\n";
700
701
702/*
703if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY') && getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL')) {
704 ?>
705 <script type="text/javascript">
706
707 $.ajax({
708 method: "GET",
709 data: { token: '<?php echo currentToken() ?>' },
710 url: '<?php echo DOL_URL_ROOT.'/blockedlog/ajax/check_signature.php' ?>',
711 dataType: 'html'
712 }).done(function(data) {
713 if(data == 'hashisok') {
714 $('#blockchainstatus').html('<?php echo $langs->trans('AuthorityReconizeFingerprintConformity').' '.img_picto($langs->trans('SignatureOK'), 'on') ?>');
715 }
716 else{
717 $('#blockchainstatus').html('<?php echo $langs->trans('AuthorityDidntReconizeFingerprintConformity').' '.img_picto($langs->trans('SignatureKO'), 'off') ?>');
718 }
719
720 });
721
722 </script>
723 <?php
724}
725*/
726
727print dol_get_fiche_end();
728
729print '<br><br>';
730
731// End of page
732llxFooter();
733$db->close();
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
sumAmountsForUnalterableEvent($block, &$refinvoicefound, &$totalhtamount, &$totalvatamount, &$totalamount, &$total_ht, &$total_vat, &$total_ttc)
sumAmountsForUnalterableEvent
getHashUniqueIdOfRegistration()
Return a hash unique identifier of the registration.
blockedlogadmin_prepare_head($withtabsetup)
Define head array for tabs of blockedlog tools setup pages.
Class to manage Blocked Log.
Class to manage generation of HTML components Only common components must be here.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition date.lib.php:125
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
currentToken()
Return the value of token currently saved into session with name 'token'.
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.
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_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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.