From e6249eee320dca967dab68fdfb8e96c2eb74a00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 5 Jan 2026 12:48:07 +0100 Subject: [PATCH] fix phpstan for v23 (#36774) * fix phpstan * Update functions.lib.php * Update admin.lang * Update errors.lang * Update fournisseur.commande.class.php * Update fournisseur.commande.class.php * Update blockedlog_archives.php * Update blockedlog_archives.php * Update blockedlog_archives.php * Update blockedlog_archives.php --- htdocs/blockedlog/admin/blockedlog_archives.php | 4 +++- htdocs/core/lib/functions.lib.php | 10 +++++----- htdocs/fourn/class/fournisseur.commande.class.php | 6 +++--- htdocs/user/group/list.php | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_archives.php b/htdocs/blockedlog/admin/blockedlog_archives.php index fcf97c60120..8337cb5f5ee 100644 --- a/htdocs/blockedlog/admin/blockedlog_archives.php +++ b/htdocs/blockedlog/admin/blockedlog_archives.php @@ -141,6 +141,8 @@ $upload_dir = getMultidirOutput($block_static, 'blockedlog').'/archives'; dol_mkdir($upload_dir); +$fh = null; + /* * Actions @@ -306,7 +308,7 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { / $block_static->module_source = $obj->module_source; - $block_static->amounts_excl = (float) $obj->amounts_excl; // Database store value with 8 digits, we cut ending 0 them with (flow) + $block_static->amounts_taxexcl = (float) $obj->amounts_taxexcl; // Database store value with 8 digits, we cut ending 0 them with (flow) $block_static->amounts = (float) $obj->amounts; // Database store value with 8 digits, we cut ending 0 them with (flow) $block_static->action = $obj->action; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 060efa02268..69422025a29 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -126,11 +126,11 @@ if (!function_exists('str_contains')) { * Return the full path of the directory where a module (or an object of a module) stores its files. * Path may depends on the entity if a multicompany module is enabled. * - * @param CommonObject|BlockedLog $object Dolibarr common object. - * @param string $module Override object element, for example to use 'mycompany' instead of 'societe' - * @param int $forobject Return the more complete path for the given object instead of for the module only. - * @param string $mode 'output' (full main dir) or 'outputrel' (relative dir) or 'temp' (full dir for temporary files) or 'version' (full dir for archived files) - * @return string|null The path of the relative directory of the module, ending with / + * @param CommonObject|BlockedLog|null $object Dolibarr common object. + * @param string $module Override object element, for example to use 'mycompany' instead of 'societe' + * @param int $forobject Return the more complete path for the given object instead of for the module only. + * @param string $mode 'output' (full main dir) or 'outputrel' (relative dir) or 'temp' (full dir for temporary files) or 'version' (full dir for archived files) + * @return string|null The path of the relative directory of the module, ending with / * @since Dolibarr V18 */ function getMultidirOutput($object, $module = '', $forobject = 0, $mode = 'output') diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4197a85f9bb..ce9908469f4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3941,10 +3941,10 @@ class CommandeFournisseur extends CommonOrder if (!empty($arraydata['thirdparty'])) { $return .= '
'.$arraydata['thirdparty'].''; } - if (property_exists($this, 'date')) { - $return .= '
'.dol_print_date($this->date ? $this->date : $this->date_creation, 'day').''; + if (!empty($this->date)) { + $return .= '
'.dol_print_date($this->date, 'day').''; } - if (property_exists($this, 'total_ht')) { + if (!empty($this->total_ht)) { $return .= '   '.price($this->total_ht); $return .= ' '.$langs->trans("HT"); $return .= ''; diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index d7134eb28cd..7de4e29b1e4 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -377,7 +377,7 @@ if ($conf->main_checkbox_left_column) { print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", '', $param, "", $sortfield, $sortorder); $totalarray['nbfield']++; //multicompany -if (isModEnabled('multicompany') && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { +if (isModEnabled('multicompany') && isset($mc) && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } @@ -476,7 +476,7 @@ while ($i < $imaxinloop) { } // Multicompany column - if (isModEnabled('multicompany') && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { + if (isModEnabled('multicompany') && isset($mc) && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { $mc->getInfo($obj->entity); print ''.dol_escape_htmltag($mc->label).''; if (!$i) {