diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 208cb94d83e..460232bae14 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -169,7 +169,7 @@ if (!getDolGlobalString('MAIN_MAIL_SENDMODE')) { $conf->global->MAIN_MAIL_SENDMODE = 'mail'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 183c3b9341c..77f5d942497 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -140,7 +140,7 @@ if (preg_match('/^mac/i', PHP_OS)) { if (!getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')) { $conf->global->MAIN_MAIL_SENDMODE_EMAILING = 'default'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_EMAILING', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_EMAILING', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index adcb1ea1fc6..02e0ef24be1 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -138,7 +138,7 @@ if (preg_match('/^mac/i', PHP_OS)) { if (!getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET')) { $conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET = 'default'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_PASSWORDRESET', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_PASSWORDRESET', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 2715f032ed8..29e97f93504 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -138,7 +138,7 @@ if (preg_match('/^mac/i', PHP_OS)) { if (!getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')) { $conf->global->MAIN_MAIL_SENDMODE_TICKET = 'default'; } -$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_TICKET', ini_get('smtp_port')); +$port = getDolGlobalInt('MAIN_MAIL_SMTP_PORT_TICKET', (int) ini_get('smtp_port')); if (!$port) { $port = 25; } diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php index d3efc65056f..f13d1ffad9c 100644 --- a/htdocs/bookcal/availabilities_card.php +++ b/htdocs/bookcal/availabilities_card.php @@ -1,6 +1,7 @@ - * Copyright (C) 2022 Alice Adminson +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2022 Alice Adminson + * Copyright (C) 2024 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 @@ -248,7 +249,7 @@ if ($action == 'create') { exit; } - print load_fiche_titre($langs->trans("NewAvailabilities"), '', '', 'object_'.$object->picto); + print load_fiche_titre($langs->trans("NewAvailabilities"), '', 'object_'.$object->picto); print '
'; print ''; if ($error != 0) { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 776b9c776f1..58948ec2aa8 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -309,7 +309,8 @@ abstract class CommonDocGenerator $mysoc->country = $outputlangs->transnoentitiesnoconv("Country".$mysoc->country_code); } if (empty($mysoc->state) && !empty($mysoc->state_code)) { - $mysoc->state = getState($mysoc->state_code, '0'); + $state_id = dol_getIdFromCode($this->db, $mysoc->state_code, 'c_departements', 'code_departement', 'rowid'); + $mysoc->state = getState($state_id, '0'); } $logotouse = $conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small; @@ -365,7 +366,8 @@ abstract class CommonDocGenerator $object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code); } if (empty($object->state) && !empty($object->state_code)) { - $object->state = getState($object->state_code, '0'); + $state_id = dol_getIdFromCode($this->db, $object->state_code, 'c_departements', 'code_departement', 'rowid'); + $object->state = getState($state_id, '0'); } $array_thirdparty = array( @@ -431,7 +433,8 @@ abstract class CommonDocGenerator $object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code); } if (empty($object->state) && !empty($object->state_code)) { - $object->state = getState($object->state_code, '0'); + $state_id = dol_getIdFromCode($this->db, $object->state_code, 'c_departements', 'code_departement', 'rowid'); + $object->state = getState($state_id, '0'); } $array_contact = array( diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 1323dc311c0..2846e939f98 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 920a815f429..b4fe047978a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Gauthier VERDOL * Copyright (C) 2024 MDW @@ -2385,7 +2385,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & // Fields to show current time $tableCell = ''; $modeinput = 'hours'; - $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); + $TFirstDay = getFirstDayOfEachWeek($TWeek, (int) date('Y', $firstdaytoshow)); $TFirstDay[reset($TWeek)] = 1; $firstdaytoshowarray = dol_getdate($firstdaytoshow); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ba01c1c89ea..f60cb68a325 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1260,7 +1260,7 @@ class pdf_crabe extends ModelePDFFactures $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', ''); + $paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 6cf64cbba58..7ddafc39eb3 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1462,7 +1462,7 @@ class pdf_octopus extends ModelePDFFactures $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', ''); + $paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 6f605ea38a2..3183e69484a 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1360,7 +1360,7 @@ class pdf_sponge extends ModelePDFFactures $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, 0, '', ''); + $paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, 0, '', 0); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); diff --git a/htdocs/emailcollector/lib/emailcollector.lib.php b/htdocs/emailcollector/lib/emailcollector.lib.php index befbbef16b2..34638e7f1d1 100644 --- a/htdocs/emailcollector/lib/emailcollector.lib.php +++ b/htdocs/emailcollector/lib/emailcollector.lib.php @@ -113,7 +113,7 @@ function getDParameters($part) * * @param integer $jk Number of email * @param object $mbox object connection imap - * @return array type, filename, pos + * @return array type, filename, pos */ function getAttachments($jk, $mbox) { diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 316efd3bffe..f33b4b08337 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2224,7 +2224,7 @@ class Project extends CommonObject $obj = $this->db->fetch_object($resql); if (!empty($obj->element_date)) { $date = explode('-', $obj->element_date); - $week_number = getWeekNumber($date[2], $date[1], $date[0]); + $week_number = getWeekNumber((int) $date[2], (int) $date[1], (int) $date[0]); } '@phan-var-force int $week_number'; // Needed because phan considers it might be null if (empty($weekalreadyfound[$week_number])) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 226a08d8c21..86e7771c855 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -910,7 +910,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- $linktotasks .= dolGetButtonTitle($langs->trans('ViewGantt'), '', 'fa fa-stream imgforviewmode', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1', '', 1, array('morecss' => 'reposition marginleftonly')); //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'generic', 0, '', '', 0, 1); - print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'projecttask', '', '', '', $massactionbutton); + print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'projecttask', 0, '', '', $massactionbutton); $objecttmp = new Task($db); $trackid = 'task'.$taskstatic->id; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index cc000d0fb8f..68a6518c7d3 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4381,10 +4381,11 @@ class Societe extends CommonObject //TODO This could be replicated for region but function `getRegion` didn't exist, so I didn't added it. // We define state_id, state_code and state $state_id = 0; - $state_code = $state_label = ''; + $state_code = ''; + $state_label = ''; if (getDolGlobalString('MAIN_INFO_SOCIETE_STATE')) { $tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_STATE')); - $state_id = $tmp[0]; + $state_id = (int) $tmp[0]; if (!empty($tmp[1])) { // If $conf->global->MAIN_INFO_SOCIETE_STATE is "id:code:label" $state_code = $tmp[1]; $state_label = $tmp[2]; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 07524a8b99a..aa7e18a45ec 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -72,17 +72,13 @@ parameters: - '#expects int\|null#' - '#expects int<-2, 2>, bool given.#' - '#expects int<0, 1>#' - - '#load.* expects int, string#' - '#ajax.* expects int, string#' - '#measu.* expects int, string#' - '#color.* expects int, string#' - '#imap.* expects int, string#' - '#show.* expects int, string#' - '#dol.* expects int, string#' - - '#get.* expects int, string#' - - '#send.* expects int, string#' - '#convert.* expects int, string#' - #- '#constructor expects int, string#' - '#\(\) expects int, string#' - '#run_sql expects int, string#' - '#expects int, float#' diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index 60aa2b1cbcb..f4a6e136e69 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -1,10 +1,11 @@ #!/usr/bin/env php - * Copyright (C) 2005-2013 Laurent Destailleur - * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 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 @@ -153,7 +154,7 @@ if ($resql) { if ($startbreak) { // Break onto sales representative (new email or cid) if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) { - sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, $duration_value); + sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, (int) $duration_value); $trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid; } else { if ($oldemail != 'none') { @@ -207,7 +208,7 @@ if ($resql) { // If there are remaining messages to send in the buffer if ($foundtoprocess) { if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) { // Break onto email (new email) - sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, $duration_value); + sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, (int) $duration_value); $trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid; } else { if ($oldemail != 'none') {