diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 80b94b047d1..a9a6fdd630e 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -16062,24 +16062,12 @@ parameters: count: 1 path: ../../../htdocs/takepos/send.php - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/takepos/smpcb.php - - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue count: 1 path: ../../../htdocs/takepos/split.php - - - message: '#^Variable \$fontlist might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/theme/eldy/btn.inc.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 0e3b1465ed9..ebc2deca917 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -263,34 +263,34 @@ if (empty($error) && !empty($xml)) { $moduledir = strtolower(preg_replace('/^mod/i', '', get_class($objMod))); $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); - $text = ''.$langs->trans("LastActivationDate").': '; + $htmltooltip = ''.$langs->trans("LastActivationDate").': '; if (getDolGlobalString($const_name)) { - $text .= dol_print_date($objMod->getLastActivationDate(), 'dayhour'); + $htmltooltip .= dol_print_date($objMod->getLastActivationDate(), 'dayhour'); } else { - $text .= $langs->trans("Disabled"); + $htmltooltip .= $langs->trans("Disabled"); } $tmp = $objMod->getLastActivationInfo(); $authorid = (empty($tmp['authorid']) ? '' : $tmp['authorid']); if ($authorid > 0) { $tmpuser = new User($db); $tmpuser->fetch($authorid); - $text .= '
'.$langs->trans("LastActivationAuthor").': '; - $text .= $tmpuser->getNomUrl(0, 'nolink', -1, 1); + $htmltooltip .= '
'.$langs->trans("LastActivationAuthor").': '; + $htmltooltip .= $tmpuser->getNomUrl(0, 'nolink', -1, 1); } $ip = (empty($tmp['ip']) ? '' : $tmp['ip']); if ($ip) { - $text .= '
'.$langs->trans("LastActivationIP").': '; - $text .= $ip; + $htmltooltip .= '
'.$langs->trans("LastActivationIP").': '; + $htmltooltip .= $ip; } $lastactivationversion = (empty($tmp['lastactivationversion']) ? '' : $tmp['lastactivationversion']); if ($lastactivationversion && $lastactivationversion != 'dolibarr') { - $text .= '
'.$langs->trans("LastActivationVersion").': '; - $text .= $lastactivationversion; + $htmltooltip .= '
'.$langs->trans("LastActivationVersion").': '; + $htmltooltip .= $lastactivationversion; } - $out .= $form->textwithpicto('', $text); + $out .= $form->textwithpicto('', $htmltooltip); - $out . ''."\n"; + $out .= "\n"; $out .= "\n"; } @@ -510,8 +510,7 @@ if (empty($error) && !empty($xml)) { // Scan scripts /* - if (is_object($xml->dolibarr_script_dir[0])) - { + if (is_object($xml->dolibarr_script_dir[0])) { $file_list = array(); $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list '@phan-var-force array{insignature:string[],missing?:array,updated:array} $file_list'; @@ -530,10 +529,6 @@ if (empty($error) && !empty($xml)) { $nameofsection = 'dolibarr_htdocs_dir_checksum'; $checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum); } - //var_dump(count($file_list['added'])); - //var_dump($checksumget); - //var_dump($checksumtoget); - //var_dump($checksumget == $checksumtoget); $resultcomment = ''; diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index ad8bd1fa159..32b3605a6b3 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -1,7 +1,8 @@ * Copyright (C) 2023-2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2025 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 @@ -163,10 +164,10 @@ abstract class DolibarrTriggers /** * setErrorsFromObject * - * @param CommonObject $object Object + * @param CommonObject|BlockedLog $object Object * @return void */ - public function setErrorsFromObject(CommonObject $object) + public function setErrorsFromObject($object) { if (!empty($object->error)) { $this->errors = array_merge($this->errors, array($object->error)); diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 03be4a3f2a6..85cf4c237dd 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -1,6 +1,7 @@ - * Copyright (C) 2017-2018 Laurent Destailleur +/* Copyright (C) 2017 ATM Consulting + * Copyright (C) 2017-2018 Laurent Destailleur + * Copyright (C) 2025 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 @@ -75,7 +76,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers if (!is_object($object) || !property_exists($object, 'element') || !in_array($object->element, $listofqualifiedelement)) { return 1; } - + /** @var Facture|Don|Paiement|PaymentDonation|Subscription|PaymentVarious|CashControl $object */ dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id); require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; @@ -104,8 +105,10 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers if (in_array($action, array( 'MEMBER_SUBSCRIPTION_CREATE', 'MEMBER_SUBSCRIPTION_MODIFY', 'MEMBER_SUBSCRIPTION_DELETE', 'DON_VALIDATE', 'DON_MODIFY', 'DON_DELETE'))) { + /** @var Don|Subscription $object */ $amounts = (float) $object->amount; } elseif ($action == 'CASHCONTROL_VALIDATE') { + /** @var CashControl $object */ $amounts = (float) $object->cash + (float) $object->cheque + (float) $object->card; } elseif (property_exists($object, 'total_ttc')) { $amounts = (float) $object->total_ttc; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index b94726695f7..f869305d9e7 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -809,7 +809,7 @@ if ($id > 0 || !empty($ref)) { * Generated documents */ $subdir = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); - $filedir = $conf->project->multidir_output[$object->entity]."/".$subdir; + $filedir = $conf->project->multidir_output[$object->entity ?? $conf->entity]."/".$subdir; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = ($user->hasRight('projet', 'lire')); $delallowed = ($user->hasRight('projet', 'creer')); diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index 543ec1b292f..5eed04f6306 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -111,14 +111,14 @@ if ($reshook < 0) { if (empty($reshook)) { $error = 0; - $backurlforlist = dol_buildpath('/recruitment/recruitmentjobposition_list.php', 1); + $backurlforlist = dolBuildUrl(DOL_URL_ROOT.'/recruitment/recruitmentjobposition_list.php'); if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + $backtopage = dolBuildUrl(DOL_URL_ROOT.'/recruitment/recruitmentjobposition_card.php', ['id' => ((!empty($id) && $id > 0) ? $id : '__ID__')]); } } } @@ -210,7 +210,7 @@ if ($action == 'create') { $_POST['fk_user_recruiter'] = $user->id; } - print dol_get_fiche_head(array(), ''); + print dol_get_fiche_head([], ''); print ''."\n"; @@ -268,7 +268,7 @@ if (($id || $ref) && $action == 'edit') { // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { $head = recruitmentjobpositionPrepareHead($object); - print dol_get_fiche_head($head, 'card', $langs->trans("RecruitmentJobPosition"), -1, $object->picto); + print dol_get_fiche_head($head, 'card', $langs->trans("RecruitmentJobPosition"), -1, $object->picto, 0, '', '', 0, '', 1); $formconfirm = ''; diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php index 4abbbc678c0..d77180e6d14 100644 --- a/htdocs/recruitment/recruitmentjobposition_document.php +++ b/htdocs/recruitment/recruitmentjobposition_document.php @@ -118,7 +118,7 @@ if ($object->id && $upload_dir !== null) { */ $head = recruitmentjobpositionPrepareHead($object); - print dol_get_fiche_head($head, 'document', $langs->trans("RecruitmentJobPosition"), -1, $object->picto); + print dol_get_fiche_head($head, 'document', $langs->trans("RecruitmentJobPosition"), -1, $object->picto, 0, '', '', 0, '', 1); // Build file list diff --git a/htdocs/takepos/smpcb.php b/htdocs/takepos/smpcb.php index 2bd67b2487d..308fbc5e4f9 100644 --- a/htdocs/takepos/smpcb.php +++ b/htdocs/takepos/smpcb.php @@ -1,5 +1,6 @@ + * Copyright (C) 2025 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 @@ -36,6 +37,9 @@ if (!defined('NOREQUIREAJAX')) { // Load Dolibarr environment require '../main.inc.php'; +/** + * @var User $user + */ if (!$user->hasRight('takepos', 'run')) { accessforbidden(); diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 40a3a6ae5db..6681248dc28 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -25,6 +25,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { * @var string $butactionbg * @var string $colortextlink * @var int $dol_optimize_smallscreen + * @var string $fontlist * @var string $textbutaction * @var int<0,max> $nbtopmenuentries * @var string $right