From d0d3c2fa27b2ddfc331b7a50f5ac448d074f9bb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jun 2026 16:37:37 +0200 Subject: [PATCH] Clean code --- htdocs/blockedlog/admin/blockedlog_list.php | 16 +++++++++++++++- htdocs/blockedlog/class/blockedlog.class.php | 9 +++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 06edb0ff2c9..35fd0d37af6 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -419,8 +419,22 @@ print 'trans('logPAYMENT_CUSTOMER')); + unset($actioncodetoshowincombo['PAYMENT_CUSTOMER_CREATE']); + unset($actioncodetoshowincombo['PAYMENT_CUSTOMER_DELETE']); + } else { + $actioncodetoshowincombo[$key] = $value; + } +} +$actioncodetoshowincombo['PAYMENT_CUSTOMER'] = array('id' => 'PAYMENT_CUSTOMER', 'label' => 'logPAYMENT_CUSTOMER', 'labelhtml' => img_picto('', 'bill', 'class="pictofixedwidth").').$langs->trans('logPAYMENT_CUSTOMER')); + print ''; -print $form->multiselectarray('search_code', $block_static->trackedevents, $search_code, 0, 0, 'maxwidth200', 1); +print $form->multiselectarray('search_code', $actioncodetoshowincombo, $search_code, 0, 0, 'maxwidth200', 1); print ''; // Ref diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 84f7b077886..3d3210560c4 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1793,10 +1793,6 @@ class BlockedLog if (!$errormsg && $obfuscationkey) { $this->saveHMACSecretKey((string) $hmac_secret_key, 'dolobfuscationv1-'.$mysoc->idprof1, $obfuscationkey); // gitleaks:allow } - /* We must not throw an error here, because the main goal of this function is to get the signature of the line and we got it. - else { - throw new Exception('Error: Failed to convert the old saving mode of HMAC key (crypted by $dolibarr_main_instance_unique_id) into the new saving (crypted by obfuscation key from ping.dolibarr.org). '.$errormsg); - }*/ } elseif (!preg_match('/^dolcrypt/', $hmac_encoded_secret_key)) { // For old versions, we must switch the data saving mode to use the new method. $this->saveHMACSecretKey((string) $hmac_secret_key, 'dolcrypt'); // gitleaks:allow } @@ -2226,6 +2222,11 @@ class BlockedLog } if (is_array($search_code)) { if (!empty($search_code)) { + if (in_array('PAYMENT_CUSTOMER', $search_code)) { // If we ask codes PAYMENT_CUSTOMER, it means both PAYMENT_CUSTOMER_CREATE and PAYMENT_CUSTOMER_DELETE + $search_code[] = 'PAYMENT_CUSTOMER_CREATE'; + $search_code[] = 'PAYMENT_CUSTOMER_DELETE'; + } + $sql .= natural_search("action", implode(',', $search_code), 3); } } else {