From ca850421f093db68ee5e136901eda23ce6e131b8 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 20 Apr 2026 12:35:28 +0200 Subject: [PATCH 1/4] Qual: Fix phpstan notices (#37932) * Qual: Fix phpstan notices # Qual: Fix phpstan notices. - Fix ModeleBoxes::$info_box_contents typing; - Fix validate value to non-string (htdocs/asset/card.php) - Fix type for lines_model in FormMail * Qual: Fix get_tz_array() return typehint * Qual: Fix arguments types to mktime, dol_time --------- Co-authored-by: Laurent Destailleur --- htdocs/asset/card.php | 4 ++-- htdocs/core/boxes/modules_boxes.php | 7 +++---- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/core/lib/date.lib.php | 4 ++-- htdocs/opensurvey/wizard/choix_date.php | 8 ++++---- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 6d7c7b9ad60..626f315b22c 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018-2025 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -198,7 +198,7 @@ if ($action == 'create') { print ''; } if (GETPOSTISSET('supplier_invoice_id')) { - $object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => 1, 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => '1',); + $object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => 1, 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => 1,); print ''; } diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index d7d85fbe8b6..dff0b0dc257 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -52,12 +52,12 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo public $param; /** - * @var array,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string}>|array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string} box info heads. Example: array('text' => $langs->trans("BoxScheduledJobs", $max), 'nbcol' => 4); + * @var array,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string}>|array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string} box info heads. Example: array('text' =>->trans("BoxScheduledJobs",), 'nbcol' => 4); */ public $info_box_head = array(); /** - * @var array,maxlength?:int}>>|array,maxlength?:int}> box info content + * @var array,maxlength?:int}|array{td?:string,textnoformat:string,asis?:int<0,1>,maxlength?:int}>>|array,maxlength?:int}|array{td?:string,textnoformat:string,asis?:int<0,1>,maxlength?:int}> box info content */ public $info_box_contents = array(); @@ -487,7 +487,6 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo * * @param ?string[] $forcedirwidget null=All default directories. This parameter is used by modulebuilder module only. * @return array Array list of widgets - * */ public static function getWidgetsList($forcedirwidget = null) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 80ab6189190..2bf8b35d575 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -266,7 +266,7 @@ class FormMail extends Form public $withtoccuser = array(); /** - * @var ModelMail[] + * @var CEmailTemplate[] */ public $lines_model; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 34eff7dc3c4..9e5ef6f8596 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -4,7 +4,7 @@ * Copyright (C) 2011-2015 Juanjo Menent * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Charlene Benke - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ /** * Return an array with timezone values * - * @return array,string> Array with timezone values + * @return array,string> Array with timezone values */ function get_tz_array() { diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 2fb2ac4b67f..4bae05abb1a 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -427,7 +427,7 @@ if (issetAndNoEmpty('choixjourajout')) { $nbofchoice = count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { $choixjourajout = GETPOST("choixjourajout"); - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])) { + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"])) { $journeuf = false; } } @@ -436,9 +436,9 @@ if (issetAndNoEmpty('choixjourajout')) { // If the validation is ok, add a field to the session variables that holds all the dates if ($journeuf && issetAndNoEmpty('choixjourajout') === true) { $choixjourajout = GETPOST("choixjourajout"); - array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])); + array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"])); sort($_SESSION["totalchoixjour"]); - $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); + $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); //On sauvegarde les heures deja entrées for ($i = 0; $i < $cle; $i++) { @@ -479,7 +479,7 @@ if (issetAndNoEmpty('choixjourretrait')) { for ($i = 0; $i < $nbofchoice; $i++) { $choixjourretrait = GETPOST('choixjourretrait'); - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourretrait[0], $_SESSION["annee"])) { + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourretrait[0], $_SESSION["annee"])) { for ($j = $i; $j < $nbofchoice; $j++) { $k = $j + 1; $_SESSION["horaires$j"] = $_SESSION["horaires$k"]; From 1743565a50c340ee612129c1abae0cbaa2e03a36 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 20 Apr 2026 12:36:21 +0200 Subject: [PATCH 2/4] Qual: Fix PHPStan notices (#37933) * Qual: Fix phpstan notice with cast * Qual: Fix initialiser (phpstan) and narrow some types * Qual: Fix typing for object->type field (phpstan) * Qual: Update preg_quote usage in step2.php # Qual: Ignore false phpstan positive for preg_match Add comment to ignore phpstan warning for preg_match argument * Qual: Extend accepted types for arrayoptions (phpstan) * Qual: Fix type hint typo * Qual: Fix type for contact_id assignment * Qual: Add menuonly as allowed reloadmode * Qual: Add PHPStan ignore comments for argument.type * Qual: Ignore unused parameter in constructors (PHPStan) * Qual: Add type hint for $TMsg (PHPStan) * Qual: Cast array values to match expected type (PHPStan) * Qual: Cast $remise_percent_ligne to float (PHPStan) * Qual: Add array specifier to GETPOST for correct type (PHPStan) * Qual: Update sumSituation() argument types * Qual: Cast value to string for printStdColumnContent (PHPStan) * Qual: Ignore PHPStan notice for autoload function return value * Qual: Fix type of argument to Menubase::recur (PHPStan) * Qual: Fix return type hint (PHPStan) * Qual: Add $dolibarr_main_db_type as default global * Qual: Update Phan baseline (due to PHPStan fix) --- dev/tools/phan/baseline.txt | 1 - dev/tools/phan/config.php | 3 +- .../accountancy/class/bookkeeping.class.php | 34 +++++++++++-------- htdocs/accountancy/closure/index.php | 6 ++-- htdocs/comm/action/card.php | 8 ++--- htdocs/core/actions_massactions.inc.php | 15 +++++--- htdocs/core/ajax/selectobject.php | 2 +- .../box_accountancy_last_manual_entries.php | 4 +-- .../box_accountancy_suspense_account.php | 4 +-- htdocs/core/boxes/box_actions.php | 4 +-- htdocs/core/boxes/box_actions_future.php | 4 +-- htdocs/core/boxes/box_activity.php | 4 +-- htdocs/core/boxes/box_birthdays.php | 4 +-- htdocs/core/boxes/box_birthdays_members.php | 4 +-- htdocs/core/boxes/box_boms.php | 4 +-- htdocs/core/boxes/box_bookmarks.php | 4 +-- htdocs/core/boxes/box_clients.php | 4 +-- htdocs/core/boxes/box_commandes.php | 4 +-- htdocs/core/boxes/box_comptes.php | 4 +-- htdocs/core/boxes/box_contacts.php | 4 +-- htdocs/core/boxes/box_contracts.php | 4 +-- ...box_customers_outstanding_bill_reached.php | 4 +-- .../core/boxes/box_dolibarr_state_board.php | 4 +-- htdocs/core/boxes/box_factures.php | 4 +-- htdocs/core/boxes/box_factures_fourn.php | 2 +- htdocs/core/boxes/box_factures_fourn_imp.php | 4 +-- htdocs/core/boxes/box_factures_imp.php | 4 +-- htdocs/core/boxes/box_ficheinter.php | 4 +-- htdocs/core/boxes/box_fournisseurs.php | 4 +-- .../core/boxes/box_funnel_of_prospection.php | 4 +-- htdocs/core/boxes/box_goodcustomers.php | 4 +-- .../boxes/box_graph_invoices_permonth.php | 4 +-- .../core/boxes/box_graph_invoices_peryear.php | 4 +-- .../box_graph_invoices_supplier_permonth.php | 4 +-- .../boxes/box_graph_nb_ticket_last_x_days.php | 4 +-- .../core/boxes/box_graph_nb_tickets_type.php | 4 +-- .../boxes/box_graph_new_vs_close_ticket.php | 4 +-- .../core/boxes/box_graph_orders_permonth.php | 4 +-- .../box_graph_orders_supplier_permonth.php | 4 +-- .../boxes/box_graph_product_distribution.php | 4 +-- .../boxes/box_graph_propales_permonth.php | 4 +-- .../boxes/box_graph_ticket_by_severity.php | 4 +-- .../core/boxes/box_last_knowledgerecord.php | 4 +-- .../box_last_modified_knowledgerecord.php | 4 +-- .../core/boxes/box_last_modified_ticket.php | 4 +-- htdocs/core/boxes/box_last_ticket.php | 4 +-- htdocs/core/boxes/box_lastlogin.php | 4 +-- htdocs/core/boxes/box_members_by_tags.php | 4 +-- htdocs/core/boxes/box_members_by_type.php | 4 +-- .../core/boxes/box_members_last_modified.php | 6 ++-- .../boxes/box_members_last_subscriptions.php | 4 +-- .../box_members_subscriptions_by_year.php | 4 +-- htdocs/core/boxes/box_mos.php | 4 +-- htdocs/core/boxes/box_produits.php | 2 +- .../core/boxes/box_produits_alerte_stock.php | 2 +- htdocs/core/boxes/box_project.php | 4 +-- .../core/boxes/box_project_opportunities.php | 4 +-- htdocs/core/boxes/box_propales.php | 4 +-- htdocs/core/boxes/box_prospect.php | 4 +-- htdocs/core/boxes/box_scheduled_jobs.php | 4 +-- htdocs/core/boxes/box_services_contracts.php | 2 +- htdocs/core/boxes/box_services_expired.php | 4 +-- htdocs/core/boxes/box_shipments.php | 4 +-- htdocs/core/boxes/box_supplier_orders.php | 4 +-- ...box_supplier_orders_awaiting_reception.php | 4 +-- htdocs/core/boxes/box_task.php | 4 +-- htdocs/core/boxes/box_validated_projects.php | 4 +-- htdocs/core/boxes/modules_boxes.php | 2 +- htdocs/core/class/doleditor.class.php | 4 +-- htdocs/core/class/menubase.class.php | 4 +-- htdocs/core/class/smtps.class.php | 6 ++-- htdocs/core/db/mysqli.class.php | 4 +-- htdocs/core/db/pgsql.class.php | 2 +- htdocs/core/db/sqlite3.class.php | 2 +- htdocs/core/lib/ajax.lib.php | 12 +++---- .../expedition/doc/pdf_espadon.modules.php | 4 +-- .../facture/doc/pdf_octopus.modules.php | 22 +++++++----- htdocs/dav/dav.class.php | 6 ++-- htdocs/debugbar/class/autoloader.php | 3 +- .../class/fournisseur.commande.class.php | 6 ++-- .../fourn/class/fournisseur.facture.class.php | 6 ++-- htdocs/fourn/facture/card.php | 24 ++++++------- htdocs/holiday/define_holiday.php | 8 ++--- htdocs/install/step2.php | 2 +- htdocs/install/upgrade2.php | 7 ++-- htdocs/public/payment/newpayment.php | 10 +++--- 86 files changed, 229 insertions(+), 208 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 40682345aa6..62f3427736b 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -89,7 +89,6 @@ return [ 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/modules/expedition/doc/pdf_espadon.modules.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/core/modules/holiday/mod_holiday_immaculate.php' => ['PhanTypeMismatchArgument'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 46d1d9335e9..0bc6b843033 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2025 Frédéric France * * This is the phan config file used by .github/workflows/phan.yml @@ -279,6 +279,7 @@ return [ 'dolibarr_main_db_encrypted_pass' => 'string', 'dolibarr_main_db_host' => 'string', 'dolibarr_main_db_pass' => 'string', + 'dolibarr_main_db_type' => '?string', 'dolibarr_main_demo' => 'string', 'dolibarr_main_document_root' => 'string', 'dolibarr_main_url_root' => 'string', diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index cd88e050ded..97382861d7a 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2015-2026 Alexandre Spangaro * Copyright (C) 2015-2020 Florian Henry * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Jose MARTINEZ * Copyright (C) 2025 Nicolas Barrouillet * @@ -2947,7 +2947,7 @@ class BookKeeping extends CommonObject $income_statement_amount = 0; if (getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) { - $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); + $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); // @phpstan-ignore argument.type $pcg_type_filter = array(); foreach ($accounting_groups_used_for_income_statement as $item) { @@ -3073,8 +3073,8 @@ class BookKeeping extends CommonObject } if (!$error && is_object($journal)) { - $accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); - $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); + $accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); // @phpstan-ignore argument.type + $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); // @phpstan-ignore argument.type $pcg_type_filter = array(); $tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement); @@ -3217,8 +3217,8 @@ class BookKeeping extends CommonObject $bookkeeping->subledger_label = null; } else { */ - $bookkeeping->subledger_account = null; - $bookkeeping->subledger_label = null; + $bookkeeping->subledger_account = null; + $bookkeeping->subledger_label = null; //} $bookkeeping->numero_compte = $accountingaccount->account_number; @@ -3422,16 +3422,20 @@ class BookKeeping extends CommonObject $echecT = []; foreach ($toselect as $id) { if ($bookkeeping->fetch($id)) { - if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) { + if (!getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) { $accountcustcode = '411'; - } else $accountcustcode = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); + } else { + $accountcustcode = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); + } - if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) { + if (!getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) { $accountsuppcode = '401'; - } else $accountsuppcode = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); + } else { + $accountsuppcode = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); + } if (strpos($bookkeeping->numero_compte, $accountcustcode) === 0 || strpos($bookkeeping->numero_compte, $accountsuppcode) === 0) { - $echecT[]=$bookkeeping->numero_compte; + $echecT[] = $bookkeeping->numero_compte; continue; } @@ -3468,7 +3472,10 @@ class BookKeeping extends CommonObject if (!empty($echecImplode)) { $nbEchec = count(explode(',', $echecImplode)); - setEventMessages($nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber') . ' ' . $echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber') . ' ' . $echecImplode, null, 'errors' + setEventMessages( + $nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber') . ' ' . $echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber') . ' ' . $echecImplode, + null, + 'errors' ); } @@ -3731,7 +3738,6 @@ class BookKeeping extends CommonObject * @param string $code_journal Accounting journal code * @param int $docdate Date of the document * @return int int Return integer -1 if KO, 1 if OK - * */ public function newReturnAccount(array $toselect, $code_journal, $docdate) { @@ -3753,7 +3759,7 @@ class BookKeeping extends CommonObject $alreadyExtourneT = array(); if ($resqlAlreadyExtourne) { while ($obj4 = $this->db->fetch_object($resqlAlreadyExtourne)) { - $alreadyExtourneT []= $obj4->piece_num; + $alreadyExtourneT [] = $obj4->piece_num; } } diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 8b8e64cf625..e56a49e9138 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2019-2023 Open-DSI * Copyright (C) 2024 Frédéric France * Copyright (C) 2025-2026 Alexandre Spangaro - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -122,8 +122,8 @@ if (empty($current_fiscal_period) && !empty($first_active_fiscal_period)) { } } -$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); -$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); +$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); // @phpstan-ignore argument.type +$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); // @phpstan-ignore argument.type /* diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index ab35d5e3aa0..9aa1f963be8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -9,7 +9,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -332,7 +332,7 @@ if (empty($reshook) && $action == 'confirm_clone' && $confirm == 'yes' && $userc //$object->fetch($id); if (!empty($object->socpeopleassigned)) { reset($object->socpeopleassigned); - $object->contact_id = key($object->socpeopleassigned); + $object->contact_id = (int) key($object->socpeopleassigned); } $result = $object->createFromClone($user, GETPOSTINT('socid')); if ($result > 0) { @@ -980,7 +980,7 @@ if (empty($reshook) && $action == 'update' && $usercancreate) { $object->contact_id = GETPOSTINT("contactid"); if (empty($object->contact_id) && !empty($object->socpeopleassigned)) { reset($object->socpeopleassigned); - $object->contact_id = key($object->socpeopleassigned); + $object->contact_id = (int) key($object->socpeopleassigned); } $object->fk_project = GETPOSTINT("projectid"); $taskid = GETPOSTINT('taskid'); @@ -1583,7 +1583,7 @@ if ($action == 'create') { */ // limit date - $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; + $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; print '