This commit is contained in:
Laurent Destailleur
2025-11-14 11:47:05 +01:00
parent 059f272b16
commit 9c85cb4be4
5 changed files with 104 additions and 11 deletions

View File

@@ -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 '<td class="right nowraponall">'.price($block->amounts).'</td>';
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 '<td class="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_picto($langs->trans('ShowDetails'), 'note', 'class="size15x"').'</span></td>';
@@ -696,8 +711,9 @@ if (is_array($blocks)) {
print '<td class="nowraponall">';
// 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").' =<br>'.$block->signature;
$texttoshow .= '<br><br>'.$langs->trans("Fingerprint").' - Recalculated sha256('.$langs->trans("PreviousHash").' on previous line + data) =<br>'.$checkdetail[$block->id]['calculatedsignature'];
$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'];
$texttoshow .= '<br><span class="opacitymedium">'.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].'</span>';
$texttoshow .= '<br><span class="opacitymedium">'.$langs->trans("SecretKey").'=Not available from interface</span>';
//$texttoshow .= '<br>keyforsignature='.$checkdetail[$block->id]['keyforsignature'];
print $form->textwithpicto(dol_trunc($block->signature, 8), $texttoshow, 1, 'help', '', 0, 2, 'fingerprint'.$block->id);
print '</td>';
@@ -752,6 +768,70 @@ if (is_array($blocks)) {
$colspan++;
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
} else {
foreach ($totalamount as $key => $totalamountperref) {
if ($key == 'BILL_VALIDATE') {
// Total
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre">';
print '</td>';
}
// ID
print '<td colspan="2">'.dolPrintHTML($langs->trans("TotalForAction").' '.$key).'</td>';
// Date
//print '<td class="nowraponall"></td>';
// User
print '<td class="tdoverflowmax200">';
print '</td>';
// Action
print '<td></td>';
// Ref
print '<td class="nowraponall">';
print '</td>';
// Amount (HT)
print '<td class="right nowraponall">';
$totaltoshow = 0;
foreach ($totalamountperref as $value) {
$totaltoshow += $value;
}
print price($totaltoshow);
print '</td>';
// Details link
print '<td class="center"></td>';
// Fingerprint
print '<td class="nowraponall">';
print '</td>';
// Status
print '<td class="center">';
print '</td>';
// 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 '<td class="tdoverflowmax150"'.(preg_match('/<a/', $object_link) ? '' : 'title="'.dol_escape_htmltag(dol_string_nohtmltag($object_link.($object_link_title ? ' - '.$object_link_title : ''))).'"').'>';
print '</td>';
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre">';
print '</td>';
}
print '</tr>';
}
}
}
}

View File

@@ -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',

View File

@@ -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',

View File

@@ -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);

View File

@@ -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