From 3245e225b09ecb48d16b95df251ef21c2e78b094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 26 Mar 2026 02:40:24 +0100 Subject: [PATCH] fix phpstan (#37614) * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix * fix * fix --------- Co-authored-by: Laurent Destailleur --- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/blockedlog/admin/blockedlog_archives.php | 4 ++-- htdocs/blockedlog/admin/blockedlog_list.php | 7 ++++--- htdocs/blockedlog/admin/lifetimeamount.inc.php | 3 +++ htdocs/document.php | 11 +++++------ 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 18a542626f6..bfff768ca91 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -8,7 +8,7 @@ * Copyright (C) 2013-2025 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy - * Copyright (C) 2017-2025 Frédéric France + * Copyright (C) 2017-2026 Frédéric France * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018-2024 Eric Seigne * Copyright (C) 2021 Gauthier VERDOL diff --git a/htdocs/blockedlog/admin/blockedlog_archives.php b/htdocs/blockedlog/admin/blockedlog_archives.php index 619641a7d5c..9110ab2c3b8 100644 --- a/htdocs/blockedlog/admin/blockedlog_archives.php +++ b/htdocs/blockedlog/admin/blockedlog_archives.php @@ -1,7 +1,7 @@ * Copyright (C) 2017-2018 Laurent Destailleur - * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * @@ -535,7 +535,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is $foundoldformat = 0; $firstrecorddate = 0; global $foundoldformat, $firstrecorddate; - include_once DOL_DOCUMENT_ROOT.'/blockedlog/admin/lifetimeamount.inc.php'; + include DOL_DOCUMENT_ROOT.'/blockedlog/admin/lifetimeamount.inc.php'; // Add a final line with perpetual total for invoice validations diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 37b001ac8a5..5ceaed2e3ad 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -1,7 +1,7 @@ * Copyright (C) 2017-2018 Laurent Destailleur - * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Alexandre Spangaro * @@ -200,7 +200,7 @@ $morehtmlcenter = ''; $texttop = ''; $registrationnumber = getHashUniqueIdOfRegistration(); -if (!userIsTaxAuditor()) { +if (!userIsTaxAuditor()) { // @phpstan-ignore-line as it is already checked before $texttop = ''.$langs->trans("RegistrationNumber").': '.dol_trunc($registrationnumber, 10).''; if (!isRegistrationDataSavedAndPushed()) { $texttop = ''; @@ -708,7 +708,8 @@ if (is_array($blocks)) { if (empty($search_end) || $search_end == -1) { $search_end = dol_now(); } - include_once DOL_DOCUMENT_ROOT.'/blockedlog/admin/lifetimeamount.inc.php'; + global $foundoldformat, $firstrecorddate; + include DOL_DOCUMENT_ROOT.'/blockedlog/admin/lifetimeamount.inc.php'; if (empty($search_code) || in_array('BILL_VALIDATE', $search_code)) { // Total diff --git a/htdocs/blockedlog/admin/lifetimeamount.inc.php b/htdocs/blockedlog/admin/lifetimeamount.inc.php index 1acfd7c8674..94761f07985 100644 --- a/htdocs/blockedlog/admin/lifetimeamount.inc.php +++ b/htdocs/blockedlog/admin/lifetimeamount.inc.php @@ -1,5 +1,6 @@ + * Copyright (C) 2026 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +36,8 @@ */ '@phan-var-force array $totalamountlifetime'; '@phan-var-force array $totalhtamountlifetime'; +'@phan-var-force int $error'; +global $foundoldformat, $firstrecorddate, $error; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { diff --git a/htdocs/document.php b/htdocs/document.php index 3354512f52c..b10869592b9 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -6,7 +6,7 @@ * Copyright (C) 2010 Pierre Morin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2022 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -409,7 +409,6 @@ if ($modulepart == 'facture') { $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET pos_print_counter = pos_print_counter + 1"; $sql .= " WHERE rowid = ".((int) $invoice->id); $db->query($sql); - //var_dump($invoice);exit; $invoice->pos_print_counter += 1; //$invoice->update($user, 1); // disabled update, we already did a direct sql update before. We disable trigger here because we already call the trigger $action = DOC_PREVIEW or DOC_DOWNLOAD just after. @@ -424,10 +423,10 @@ if ($modulepart == 'facture') { $hidedesc = 0; $hideref = 0; $moreparams = ''; - $hidedetails = isset($hidedetails) ? $hidedetails : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0); - $hidedesc = isset($hidedesc) ? $hidedesc : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0); - $hideref = isset($hideref) ? $hideref : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0); - $moreparams = isset($moreparams) ? $moreparams : null; + $hidedetails = isset($hidedetails) ? $hidedetails : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0); // @phpstan-ignore-line as variable $hidedetails is forced + $hidedesc = isset($hidedesc) ? $hidedesc : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0); // @phpstan-ignore-line as variable $hidedesc is forced + $hideref = isset($hideref) ? $hideref : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0); // @phpstan-ignore-line as variable $hideref is forced + $moreparams = isset($moreparams) ? $moreparams : null; // @phpstan-ignore-line as variable $moreparams is forced $result = $invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); if ($result < 0) {