From 9c85cb4be4bacfe041ee5dfefb26d64f2c809774 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Nov 2025 11:47:05 +0100 Subject: [PATCH] WIP LNE --- htdocs/blockedlog/admin/blockedlog_list.php | 96 ++++++++++++++++++-- htdocs/blockedlog/ajax/block-info.php | 8 +- htdocs/blockedlog/class/blockedlog.class.php | 6 +- htdocs/core/modules/modBlockedLog.class.php | 1 + htdocs/langs/en_US/blockedlog.lang | 4 + 5 files changed, 104 insertions(+), 11 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 9284c58df00..a21cdf0c883 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -27,12 +27,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -43,6 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; * * @var string $dolibarr_main_db_name */ +require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'banks', 'bills', 'blockedlog', 'other')); @@ -590,7 +589,7 @@ print getTitleFieldOfList($langs->trans('Date'), 0, $_SERVER["PHP_SELF"], 'date_ print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"], 'user_fullname', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n"; -print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ')."\n"; +print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ', 0, $langs->trans("TotalTTCIfInvoiceSeeCompleteDataForDetail"))."\n"; print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp'), 1)."\n"; print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($form->textwithpicto($langs->trans('Status'), $langs->trans('DataOfArchivedEventHelp2')), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; @@ -635,6 +634,8 @@ if (getDolGlobalString('BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR')) { } } +$totalamount = array(); + if (is_array($blocks)) { $nbshown = 0; $object_link = ''; @@ -688,6 +689,20 @@ if (is_array($blocks)) { // Amount print ''.price($block->amounts).''; + if (empty($totalamount[$block->action])) { + $totalamount[$block->action] = array(); + } + if ($block->action == 'BILL_VALIDATE') { + if (empty($totalamount[$block->action][$block->ref_object])) { // If not, we already met the event for this object, we keep only first one. + $totalamount[$block->action][$block->ref_object] = $block->amounts; + } + } + if ($block->action == 'PAYMENT_CUSTOMER_CREATE') { + if (empty($totalamount[$block->action][$block->ref_object])) { + $totalamount[$block->action][$block->ref_object] = 0; + } + $totalamount[$block->action][$block->ref_object] = $block->amounts; + } // Details link print ''.img_picto($langs->trans('ShowDetails'), 'note', 'class="size15x"').''; @@ -696,8 +711,9 @@ if (is_array($blocks)) { print ''; // 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. $texttoshow = $langs->trans("Fingerprint").' - '.$langs->trans("SavedOnLine").' =
'.$block->signature; - $texttoshow .= '

'.$langs->trans("Fingerprint").' - Recalculated sha256('.$langs->trans("PreviousHash").' on previous line + data) =
'.$checkdetail[$block->id]['calculatedsignature']; + $texttoshow .= '

'.$langs->trans("Fingerprint").' - Recalculated hash_hmac(\'sha256\', '.strtolower($langs->trans("PreviousHash").' on previous line').' + data, secret key) =
'.$checkdetail[$block->id]['calculatedsignature']; $texttoshow .= '
'.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].''; + $texttoshow .= '
'.$langs->trans("SecretKey").'=Not available from interface'; //$texttoshow .= '
keyforsignature='.$checkdetail[$block->id]['keyforsignature']; print $form->textwithpicto(dol_trunc($block->signature, 8), $texttoshow, 1, 'help', '', 0, 2, 'fingerprint'.$block->id); print ''; @@ -752,6 +768,70 @@ if (is_array($blocks)) { $colspan++; } print ''.$langs->trans("NoRecordFound").''; + } else { + foreach ($totalamount as $key => $totalamountperref) { + if ($key == 'BILL_VALIDATE') { + // Total + print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + print ''; + } + + // ID + print ''.dolPrintHTML($langs->trans("TotalForAction").' '.$key).''; + + // Date + //print ''; + + // User + print ''; + print ''; + + // Action + print ''; + + // Ref + print ''; + print ''; + + // Amount (HT) + print ''; + $totaltoshow = 0; + foreach ($totalamountperref as $value) { + $totaltoshow += $value; + } + print price($totaltoshow); + print ''; + + // Details link + print ''; + + // Fingerprint + print ''; + print ''; + + // Status + print ''; + print ''; + + // Link to debug information object + 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. + print ''; + print ''; + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + print ''; + } + + print ''; + } + } } } diff --git a/htdocs/blockedlog/ajax/block-info.php b/htdocs/blockedlog/ajax/block-info.php index be3a45ef37c..24dbcaddad2 100644 --- a/htdocs/blockedlog/ajax/block-info.php +++ b/htdocs/blockedlog/ajax/block-info.php @@ -41,7 +41,6 @@ if (!defined('NOREQUIREHTML')) { // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; /** * @var Conf $conf * @var DoliDB $db @@ -49,6 +48,8 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; + $id = GETPOSTINT('id'); $block = new BlockedLog($db); @@ -57,7 +58,7 @@ if ((!$user->admin && !$user->hasRight('blockedlog', 'read')) || empty($conf->bl accessforbidden(); } -$langs->loadLangs(array("admin", "bills", "cashdesk", "companies", "members", "products")); +$langs->loadLangs(array("admin", "bills", "blockedlog", "cashdesk", "companies", "members", "products")); /* @@ -137,6 +138,9 @@ function formatObject($objtoshow, $prefix) 'amount' => 'Amount', 'id' => 'ID', 'ref' => 'Ref', + 'element' => 'TypeOfEvent', + 'entity' => 'Entity', + 'label' => 'Label', 'date' => 'Date', 'total_ht' => 'TotalHT', 'total_ttc' => 'TotalTTC', diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 13fbbc93152..86141ed72bd 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -512,12 +512,16 @@ class BlockedLog $this->object_data = new stdClass(); // Add fields to exclude $arrayoffieldstoexclude = array( - 'table_element', 'fields', 'ref_previous', 'ref_next', 'origin', 'origin_id', 'oldcopy', 'picto', 'error', 'errors', 'model_pdf', 'modelpdf', 'last_main_doc', 'civility_id', 'contact', 'contact_id', + 'table_element', 'fields', + 'ref_previous', 'ref_next', + 'origin', 'origin_id', + 'oldcopy', 'picto', 'error', 'errors', 'model_pdf', 'modelpdf', 'last_main_doc', 'civility_id', 'contact', 'contact_id', 'table_element_line', 'ismultientitymanaged', 'isextrafieldmanaged', 'array_languages', 'childtables', 'contact_ids', 'context', + 'element', 'labelStatus', 'labelStatusShort', 'linkedObjectsIds', diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index b9131cbe780..1b585a1e976 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -259,6 +259,7 @@ class modBlockedLog extends DolibarrModules $object->ref = 'systemevent'; $object->entity = $conf->entity; $object->date = dol_now(); + $object->label = 'Module disabled'; $b = new BlockedLog($this->db); $result = $b->setObjectData($object, 'MODULE_RESET', 0); diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index bdd02a5511a..8f65e1b4a5a 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -43,6 +43,10 @@ YourCountryCode=Your country code DisablingBlockedLogIsNotallowedOnceUsedExceptOnFullreset=Disabling %s module is not allowed once it has been used, except for a full database reset. Ask your integrator or reseller if you need such a reset. LNECertifiedPOSSystem=LNE Certified POS system InvoiceGeneratedWithLNECertifiedPOSSystem=Invoice generated with a LNE certified POS system +TotalTTCIfInvoiceSeeCompleteDataForDetail=Amount of event. Total including tax if invoice. See the column "complete data" for details. +TypeOfEvent=Type of event +TotalForAction=Total for event %s +SecretKey=Secret key ## logTypes logBILL_DELETE=Customer invoice logically deleted