From b428dfc9e9eeea746d117b78bab2e23b9305fa60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jun 2026 20:53:27 +0200 Subject: [PATCH] Debug v24 --- htdocs/blockedlog/admin/blockedlog_list.php | 22 ++++++++++++------- .../blockedlog/admin/lifetimeamount.inc.php | 11 ++++++---- htdocs/blockedlog/class/blockedlog.class.php | 4 ++-- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 7ece9f80da3..5b97e62c8aa 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -831,6 +831,13 @@ if (is_array($blocks)) { print ''; foreach ($totalamount as $actioncode => $totalamountofcodepersource) { + if ($actioncode == 'BILL_VALIDATE' && (!empty($search_code) && !in_array('BILL_VALIDATE', $search_code))) { + continue; + } + if ($actioncode == 'PAYMENT_CUSTOMER' && (!empty($search_code) && !in_array('PAYMENT_CUSTOMER', $search_code))) { + continue; + } + // Total print ''; @@ -875,18 +882,18 @@ if (is_array($blocks)) { } if ($actioncode == 'BILL_VALIDATE') { - print price($totalhttoshow); + print ''.price($totalhttoshow).''; print ' '.$langs->trans("HT"); print ' - '; - print price($totalvattoshow); + print ''.price($totalvattoshow).''; print ' '.$langs->trans("VAT"); print ' - '; } - print price($totaltoshow); + print ''.price($totaltoshow).''; if ($actioncode == 'BILL_VALIDATE') { print ' '.$langs->trans("TTC"); } @@ -930,8 +937,8 @@ if (is_array($blocks)) { // Get lifetime amount of all invoices validated and payments created/deleted. // We do not use $totalamountalllines because it is only for the period, but we want lifetime amount since the first record to now. - $totalamountlifetime = array('BILL_VALIDATE' => 0, 'PAYMENT_CUSTOMER_CREATE' => 0, 'PAYMENT_CUSTOMER_DELETE' => 0); - $totalhtamountlifetime = array('BILL_VALIDATE' => 0, 'PAYMENT_CUSTOMER_CREATE' => 0, 'PAYMENT_CUSTOMER_DELETE' => 0); + $totalamountlifetime = array('BILL_VALIDATE' => array(), 'PAYMENT_CUSTOMER_CREATE' => array(), 'PAYMENT_CUSTOMER_DELETE' => array()); + $totalhtamountlifetime = array('BILL_VALIDATE' => array(), 'PAYMENT_CUSTOMER_CREATE' => array(), 'PAYMENT_CUSTOMER_DELETE' => array()); $foundoldformat = 0; $firstrecorddate = 0; if (empty($search_end) || $search_end == -1) { @@ -940,7 +947,6 @@ if (is_array($blocks)) { global $foundoldformat, $firstrecorddate; include DOL_DOCUMENT_ROOT.'/blockedlog/admin/lifetimeamount.inc.php'; - print ''; print ''; @@ -994,7 +1000,7 @@ if (is_array($blocks)) { // Amount (HT) print ''; - print ($foundoldformat ? '' : price($totalhtamountlifetime['BILL_VALIDATE']).' '.$langs->trans("HT")).($foundoldformat ? '' : " - ".price($totalamountlifetime['BILL_VALIDATE'] - $totalhtamountlifetime['BILL_VALIDATE']).' '.$langs->transnoentitiesnoconv("VAT")).($foundoldformat ? '' : " - ").price($totalamountlifetime['BILL_VALIDATE']).' '.$langs->trans("TTC"); + print ($foundoldformat ? '' : ''.price($totalhtamountlifetime['BILL_VALIDATE'][$source]).' '.$langs->trans("HT")).($foundoldformat ? '' : ' - '.price((float) $totalamountlifetime['BILL_VALIDATE'][$source] - (float) $totalhtamountlifetime['BILL_VALIDATE'][$source]).' '.$langs->transnoentitiesnoconv("VAT")).($foundoldformat ? '' : " - ").''.price($totalamountlifetime['BILL_VALIDATE'][$source]).' '.$langs->trans("TTC"); print ''; // Details link @@ -1049,7 +1055,7 @@ if (is_array($blocks)) { // Amount (HT) print ''; - print price($totalamountlifetime['PAYMENT_CUSTOMER_CREATE'] + $totalamountlifetime['PAYMENT_CUSTOMER_DELETE']); + print ''.price((float) $totalamountlifetime['PAYMENT_CUSTOMER_CREATE'][$source] + (float) $totalamountlifetime['PAYMENT_CUSTOMER_DELETE'][$source]).''; print ''; // Details link diff --git a/htdocs/blockedlog/admin/lifetimeamount.inc.php b/htdocs/blockedlog/admin/lifetimeamount.inc.php index 09fc80f163d..2170604c936 100644 --- a/htdocs/blockedlog/admin/lifetimeamount.inc.php +++ b/htdocs/blockedlog/admin/lifetimeamount.inc.php @@ -84,18 +84,21 @@ if ($resql) { $firstrecorddate = $db->jdate($obj->datemin, 'gmt'); } - if (!isset($totalamountlifetime[$obj->action])) { - $totalamountlifetime[$obj->action] = 0; + if (!isset($totalamountlifetime[$obj->action][$obj->module_source])) { + $totalamountlifetime[$obj->action][$obj->module_source] = 0; + } + if (!isset($totalhtamountlifetime[$obj->action][$obj->module_source])) { + $totalhtamountlifetime[$obj->action][$obj->module_source] = 0; } // Total per action code and module - $totalamountlifetime[$obj->action] += $obj->sumamounts; + $totalamountlifetime[$obj->action][$obj->module_source] += $obj->sumamounts; // If format of line is old, the sumamounts_taxexcl was not recorded. So we flag this case. if (empty($obj->object_format) || $obj->object_format === 'V1') { $foundoldformat = 1; } else { - $totalhtamountlifetime[$obj->action] += $obj->sumamounts_taxexcl; + $totalhtamountlifetime[$obj->action][$obj->module_source] += $obj->sumamounts_taxexcl; } } } else { diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 1e8e1739347..81f72d90319 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -650,11 +650,11 @@ class BlockedLog // For customer payment and supplier payment, the thirdparty can be added in payment detail $addthirdpartyatpaymentlevel = 0; - if (!empty($object->thirdparty) && !in_array($this->element, array('payment', 'payment_supplier'))) { + if (!empty($object->thirdparty) && in_array($this->element, array('payment', 'payment_supplier'))) { $addthirdpartyatpaymentlevel = 1; } - if (!empty($object->thirdparty) && !$addthirdpartyatpaymentlevel) { + if (!empty($object->thirdparty) && !$addthirdpartyatpaymentlevel) { // If $addthirdpartyatpaymentlevel is set, we will add thirdparty on payments later. $this->object_data->thirdparty = new stdClass(); foreach ($object->thirdparty as $key => $value) {