Merge pull request #33283 from frederic34/phpstan_collab

fix phpstan
This commit is contained in:
Laurent Destailleur
2025-03-02 17:00:34 +01:00
committed by GitHub
23 changed files with 199 additions and 294 deletions

View File

@@ -3492,18 +3492,6 @@ parameters:
count: 2
path: ../../../htdocs/categories/photos.php
-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/collab/index.php
-
message: '#^Variable \$objectpage might not be defined\.$#'
identifier: variable.undefined
count: 11
path: ../../../htdocs/collab/index.php
-
message: '#^Loose comparison using \=\= between ''create'' and ''create'' will always evaluate to true\.$#'
identifier: equal.alwaysTrue
@@ -10812,96 +10800,6 @@ parameters:
count: 1
path: ../../../htdocs/core/db/sqlite3.class.php
-
message: '#^Cannot access property \$db on mixed\.$#'
identifier: property.nonObject
count: 3
path: ../../../htdocs/core/extrafieldsinexport.inc.php
-
message: '#^Cannot access property \$export_TypeFields_array on mixed\.$#'
identifier: property.nonObject
count: 2
path: ../../../htdocs/core/extrafieldsinexport.inc.php
-
message: '#^Cannot access property \$export_entities_array on mixed\.$#'
identifier: property.nonObject
count: 2
path: ../../../htdocs/core/extrafieldsinexport.inc.php
-
message: '#^Cannot access property \$export_fields_array on mixed\.$#'
identifier: property.nonObject
count: 2
path: ../../../htdocs/core/extrafieldsinexport.inc.php
-
message: '#^Cannot access property \$export_special_array on mixed\.$#'
identifier: property.nonObject
count: 1
path: ../../../htdocs/core/extrafieldsinexport.inc.php
-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/extrafieldsinexport.inc.php
-
message: '#^Variable \$r might not be defined\.$#'
identifier: variable.undefined
count: 7
path: ../../../htdocs/core/extrafieldsinexport.inc.php
-
message: '#^Variable \$this might not be defined\.$#'
identifier: variable.undefined
count: 10
path: ../../../htdocs/core/extrafieldsinexport.inc.php
-
message: '#^Cannot access property \$db on mixed\.$#'
identifier: property.nonObject
count: 3
path: ../../../htdocs/core/extrafieldsinimport.inc.php
-
message: '#^Cannot access property \$import_TypeFields_array on mixed\.$#'
identifier: property.nonObject
count: 2
path: ../../../htdocs/core/extrafieldsinimport.inc.php
-
message: '#^Cannot access property \$import_entities_array on mixed\.$#'
identifier: property.nonObject
count: 2
path: ../../../htdocs/core/extrafieldsinimport.inc.php
-
message: '#^Cannot access property \$import_fields_array on mixed\.$#'
identifier: property.nonObject
count: 2
path: ../../../htdocs/core/extrafieldsinimport.inc.php
-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/extrafieldsinimport.inc.php
-
message: '#^Variable \$r might not be defined\.$#'
identifier: variable.undefined
count: 6
path: ../../../htdocs/core/extrafieldsinimport.inc.php
-
message: '#^Variable \$this might not be defined\.$#'
identifier: variable.undefined
count: 9
path: ../../../htdocs/core/extrafieldsinimport.inc.php
-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
@@ -11178,12 +11076,6 @@ parameters:
count: 1
path: ../../../htdocs/core/lib/functions.lib.php
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 24
path: ../../../htdocs/core/lib/functions.lib.php
-
message: '#^Comparison operation "\>" between int\<1, max\> and 0 is always true\.$#'
identifier: greater.alwaysTrue
@@ -11292,12 +11184,6 @@ parameters:
count: 3
path: ../../../htdocs/core/lib/functions.lib.php
-
message: '#^Property CommonObject\:\:\$state \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../../htdocs/core/lib/functions.lib.php
-
message: '#^Result of && is always true\.$#'
identifier: booleanAnd.alwaysTrue
@@ -25626,12 +25512,6 @@ parameters:
count: 2
path: ../../../htdocs/resource/class/dolresource.class.php
-
message: '#^Property Dolresource\:\:\$address \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../../htdocs/resource/class/dolresource.class.php
-
message: '#^Property Dolresource\:\:\$busy \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@@ -25656,12 +25536,6 @@ parameters:
count: 2
path: ../../../htdocs/resource/class/dolresource.class.php
-
message: '#^Property Dolresource\:\:\$email \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../../htdocs/resource/class/dolresource.class.php
-
message: '#^Property Dolresource\:\:\$fk_code_type_resource \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@@ -25686,24 +25560,6 @@ parameters:
count: 2
path: ../../../htdocs/resource/class/dolresource.class.php
-
message: '#^Property Dolresource\:\:\$town \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../../htdocs/resource/class/dolresource.class.php
-
message: '#^Property Dolresource\:\:\$url \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../../htdocs/resource/class/dolresource.class.php
-
message: '#^Property Dolresource\:\:\$zip \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../../htdocs/resource/class/dolresource.class.php
-
message: '#^Call to function is_numeric\(\) with float\|int\<min, \-1\>\|int\<1, max\>\|\(non\-falsy\-string&numeric\-string\) will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType

View File

@@ -167,7 +167,7 @@ print '</form><br><br>';
if (getDolGlobalString('CLICKTODIAL_URL')) {
$user->fetch_clicktodial();
$phonefortest = $mysoc->phone;
$phonefortest = $mysoc->phone ?? '';
if (GETPOST('phonefortest')) {
$phonefortest = GETPOST('phonefortest');
}

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
* @var Website $object
* @var WebsitePage $objectpage
*/
// Load translation files required by the page
@@ -46,7 +48,10 @@ if (!$user->admin) {
accessforbidden();
}
'@phan-var-force WebsitePage $objectpage';
'
@phan-var-force Website $object
@phan-var-force WebsitePage $objectpage
';
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.

View File

@@ -11,7 +11,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -175,17 +175,17 @@ class Contact extends CommonObject
public $name_alias;
/**
* @var string Address
* @var ?string Address
*/
public $address;
/**
* @var string zip code
* @var ?string zip code
*/
public $zip;
/**
* @var string Town
* @var ?string Town
*/
public $town;
@@ -235,13 +235,13 @@ class Contact extends CommonObject
/**
* Email
* @var string
* @var ?string
*/
public $email;
/**
* Email
* @var string
* @var ?string
* @deprecated Use $email
* @see $email
*/
@@ -249,7 +249,7 @@ class Contact extends CommonObject
/**
* URL
* @var string
* @var ?string
*/
public $url;
@@ -623,7 +623,7 @@ class Contact extends CommonObject
$this->name_alias = trim($this->name_alias);
$this->lastname = trim($this->lastname) ? trim($this->lastname) : trim($this->lastname);
$this->firstname = trim($this->firstname);
$this->email = trim($this->email);
$this->email = trim($this->email ?? '');
$this->phone_pro = trim($this->phone_pro);
$this->phone_perso = trim($this->phone_perso);
$this->phone_mobile = trim($this->phone_mobile);

View File

@@ -1900,9 +1900,10 @@ abstract class CommonInvoice extends CommonObject
$s .= ''; // ecda signature of public key stamp
*/
$mysocname = $mysoc->name ?? '';
$mysoctva_intra = $mysoc->tva_intra ?? '';
// Using TLV format
$s = pack('C1', 1).pack('C1', strlen($mysocname)).$mysocname;
$s .= pack('C1', 2).pack('C1', strlen($mysoc->tva_intra)).$mysoc->tva_intra;
$s .= pack('C1', 2).pack('C1', strlen($mysoctva_intra)).$mysoctva_intra;
$s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring;
$s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring;
$s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring;

View File

@@ -12,7 +12,7 @@
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2017-2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
@@ -361,7 +361,6 @@ abstract class CommonObject
*/
public $status;
/**
* @var string Country name
* @see getFullAddress()
@@ -381,7 +380,7 @@ abstract class CommonObject
public $country_code;
/**
* @var string State name
* @var ?string State name
* @see getFullAddress()
*/
public $state;

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2023-2024 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2023-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -57,17 +57,17 @@
trait CommonPeople
{
/**
* @var string Address
* @var ?string Address
*/
public $address;
/**
* @var string zip code
* @var ?string zip code
*/
public $zip;
/**
* @var string town
* @var ?string town
*/
public $town;
@@ -79,18 +79,19 @@ trait CommonPeople
* @var string
*/
public $state_code;
/**
* @var string
* @var ?string
*/
public $state;
/**
* @var string email
* @var ?string email
*/
public $email;
/**
* @var string url
* @var ?string url
*/
public $url;
@@ -388,8 +389,8 @@ trait CommonPeople
}
}
if (getDolGlobalString('MAIN_ALL_TOWN_TO_UPPER')) {
$this->address = dol_strtoupper($this->address);
$this->town = dol_strtoupper($this->town);
$this->address = dol_strtoupper($this->address ?? '');
$this->town = dol_strtoupper($this->town ?? '');
}
if (!empty($this->email)) {
$this->email = dol_strtolower($this->email);

View File

@@ -3,7 +3,7 @@
* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -506,7 +506,7 @@ class vCard
// For user, $object->url is not defined
// For contact, $object->url is not defined
if (!empty($object->url)) {
$this->setURL($object->url, "");
$this->setURL($object->url ?? "");
}
if (is_object($company)) {

View File

@@ -1,5 +1,27 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @var Conf $conf
* @var DolibarrModules $this
* @var string $keyforselect
* @var string $keyforelement
* @var string $keyforaliasextra
* @var int $r
*/
'
@phan-var-force DolibarrModules $this

View File

@@ -1,5 +1,27 @@
<?php
/* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @var Conf $conf
* @var DolibarrModules $this
* @var string $keyforselect
* @var string $keyforelement
* @var string $keyforaliasextra
* @var int $r
*/
'@phan-var-force DolibarrModules $this';

View File

@@ -13,7 +13,7 @@
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2023 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
@@ -9303,56 +9303,57 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
}
if (is_object($object) && $object->element == 'societe') {
/** @var Societe $object */
'@phan-var-force Societe $object';
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object) ? $object->id : '');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object) ? $object->name : '');
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object) ? $object->name_alias : '');
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object) ? $object->code_client : '');
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object) ? $object->code_fournisseur : '');
$substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object) ? $object->email : '');
$substitutionarray['__THIRDPARTY_EMAIL_URLENCODED__'] = urlencode(is_object($object) ? $object->email : '');
$substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object) ? dol_print_phone($object->phone) : '');
$substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object) ? dol_print_phone($object->fax) : '');
$substitutionarray['__THIRDPARTY_ADDRESS__'] = (is_object($object) ? $object->address : '');
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object) ? $object->zip : '');
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object) ? $object->town : '');
$substitutionarray['__THIRDPARTY_STATE__'] = (is_object($object) ? $object->state : '');
$substitutionarray['__THIRDPARTY_COUNTRY_ID__'] = (is_object($object) ? $object->country_id : '');
$substitutionarray['__THIRDPARTY_COUNTRY_CODE__'] = (is_object($object) ? $object->country_code : '');
$substitutionarray['__THIRDPARTY_IDPROF1__'] = (is_object($object) ? $object->idprof1 : '');
$substitutionarray['__THIRDPARTY_IDPROF2__'] = (is_object($object) ? $object->idprof2 : '');
$substitutionarray['__THIRDPARTY_IDPROF3__'] = (is_object($object) ? $object->idprof3 : '');
$substitutionarray['__THIRDPARTY_IDPROF4__'] = (is_object($object) ? $object->idprof4 : '');
$substitutionarray['__THIRDPARTY_IDPROF5__'] = (is_object($object) ? $object->idprof5 : '');
$substitutionarray['__THIRDPARTY_IDPROF6__'] = (is_object($object) ? $object->idprof6 : '');
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object) ? $object->tva_intra : '');
$substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = (is_object($object) ? dol_htmlentitiesbr($object->note_public) : '');
$substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = (is_object($object) ? dol_htmlentitiesbr($object->note_private) : '');
} elseif (is_object($object->thirdparty)) {
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty) ? $object->thirdparty->id : '');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty) ? $object->thirdparty->name : '');
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object->thirdparty) ? $object->thirdparty->name_alias : '');
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object->thirdparty) ? $object->thirdparty->code_client : '');
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object->thirdparty) ? $object->thirdparty->code_fournisseur : '');
$substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object->thirdparty) ? $object->thirdparty->email : '');
$substitutionarray['__THIRDPARTY_EMAIL_URLENCODED__'] = urlencode(is_object($object->thirdparty) ? $object->thirdparty->email : '');
$substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object->thirdparty) ? dol_print_phone($object->thirdparty->phone) : '');
$substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object->thirdparty) ? dol_print_phone($object->thirdparty->fax) : '');
$substitutionarray['__THIRDPARTY_ADDRESS__'] = (is_object($object->thirdparty) ? $object->thirdparty->address : '');
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object->thirdparty) ? $object->thirdparty->zip : '');
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object->thirdparty) ? $object->thirdparty->town : '');
$substitutionarray['__THIRDPARTY_STATE__'] = (is_object($object->thirdparty) ? $object->thirdparty->state : '');
$substitutionarray['__THIRDPARTY_COUNTRY_ID__'] = (is_object($object->thirdparty) ? $object->thirdparty->country_id : '');
$substitutionarray['__THIRDPARTY_COUNTRY_CODE__'] = (is_object($object->thirdparty) ? $object->thirdparty->country_code : '');
$substitutionarray['__THIRDPARTY_IDPROF1__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof1 : '');
$substitutionarray['__THIRDPARTY_IDPROF2__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof2 : '');
$substitutionarray['__THIRDPARTY_IDPROF3__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof3 : '');
$substitutionarray['__THIRDPARTY_IDPROF4__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof4 : '');
$substitutionarray['__THIRDPARTY_IDPROF5__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof5 : '');
$substitutionarray['__THIRDPARTY_IDPROF6__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof6 : '');
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object->thirdparty) ? $object->thirdparty->tva_intra : '');
$substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = (is_object($object->thirdparty) ? dol_htmlentitiesbr($object->thirdparty->note_public) : '');
$substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = (is_object($object->thirdparty) ? dol_htmlentitiesbr($object->thirdparty->note_private) : '');
$substitutionarray['__THIRDPARTY_ID__'] = $object->id ?? '';
$substitutionarray['__THIRDPARTY_NAME__'] = $object->name ?? '';
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = $object->name_alias ?? '';
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = $object->code_client ?? '';
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = $object->code_fournisseur ?? '';
$substitutionarray['__THIRDPARTY_EMAIL__'] = $object->email ?? '';
$substitutionarray['__THIRDPARTY_EMAIL_URLENCODED__'] = urlencode($object->email ?? '');
$substitutionarray['__THIRDPARTY_PHONE__'] = dol_print_phone($object->phone ?? '');
$substitutionarray['__THIRDPARTY_FAX__'] = dol_print_phone($object->fax ?? '');
$substitutionarray['__THIRDPARTY_ADDRESS__'] = $object->address ?? '';
$substitutionarray['__THIRDPARTY_ZIP__'] = $object->zip ?? '';
$substitutionarray['__THIRDPARTY_TOWN__'] = $object->town ?? '';
$substitutionarray['__THIRDPARTY_STATE__'] = $object->state ?? '';
$substitutionarray['__THIRDPARTY_COUNTRY_ID__'] = ($object->country_id > 0 ?: '');
$substitutionarray['__THIRDPARTY_COUNTRY_CODE__'] = $object->country_code ?? '';
$substitutionarray['__THIRDPARTY_IDPROF1__'] = $object->idprof1 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF2__'] = $object->idprof2 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF3__'] = $object->idprof3 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF4__'] = $object->idprof4 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF5__'] = $object->idprof5 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF6__'] = $object->idprof6 ?? '';
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = $object->tva_intra ?? '';
$substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = dol_htmlentitiesbr($object->note_public ?? '');
$substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = dol_htmlentitiesbr($object->note_private ?? '');
} elseif (is_object($object) && is_object($object->thirdparty)) {
$substitutionarray['__THIRDPARTY_ID__'] = $object->thirdparty->id ?? '';
$substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name ?? '';
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = $object->thirdparty->name_alias ?? '';
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = $object->thirdparty->code_client ?? '';
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = $object->thirdparty->code_fournisseur ?? '';
$substitutionarray['__THIRDPARTY_EMAIL__'] = $object->thirdparty->email ?? '';
$substitutionarray['__THIRDPARTY_EMAIL_URLENCODED__'] = urlencode($object->thirdparty->email ?? '');
$substitutionarray['__THIRDPARTY_PHONE__'] = dol_print_phone($object->thirdparty->phone ?? '');
$substitutionarray['__THIRDPARTY_FAX__'] = dol_print_phone($object->thirdparty->fax ?? '');
$substitutionarray['__THIRDPARTY_ADDRESS__'] = $object->thirdparty->address ?? '';
$substitutionarray['__THIRDPARTY_ZIP__'] = $object->thirdparty->zip ?? '';
$substitutionarray['__THIRDPARTY_TOWN__'] = $object->thirdparty->town ?? '';
$substitutionarray['__THIRDPARTY_STATE__'] = $object->thirdparty->state ?? '';
$substitutionarray['__THIRDPARTY_COUNTRY_ID__'] = ($object->thirdparty->country_id > 0 ?: '');
$substitutionarray['__THIRDPARTY_COUNTRY_CODE__'] = $object->thirdparty->country_code ?? '';
$substitutionarray['__THIRDPARTY_IDPROF1__'] = $object->thirdparty->idprof1 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF2__'] = $object->thirdparty->idprof2 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF3__'] = $object->thirdparty->idprof3 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF4__'] = $object->thirdparty->idprof4 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF5__'] = $object->thirdparty->idprof5 ?? '';
$substitutionarray['__THIRDPARTY_IDPROF6__'] = $object->thirdparty->idprof6 ?? '';
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = $object->thirdparty->tva_intra ?? '';
$substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = dol_htmlentitiesbr($object->thirdparty->note_public ?? '');
$substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = dol_htmlentitiesbr($object->thirdparty->note_private ?? '');
}
if (is_object($object) && $object->element == 'recruitmentcandidature') {

View File

@@ -331,8 +331,8 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepaname, 0, 'L');
$sepavatid = '__________________________________________________';
if (!empty($thirdparty->idprof1)) {
$sepavatid = $thirdparty->idprof1;
if (!is_null($thirdparty->idprof1) && !empty($thirdparty->idprof1)) {
$sepavatid = (string) $thirdparty->idprof1;
}
$posY = $pdf->GetY();
$posY += 1;

View File

@@ -188,18 +188,18 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
// Remove special char if COMPANY_AQUARIUM_REMOVE_SPECIAL is set to 1 or not set (default)
if (!isset($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL) || getDolGlobalString('COMPANY_AQUARIUM_REMOVE_SPECIAL')) {
$codetouse = preg_replace('/([^a-z0-9])/i', '', $codetouse);
$codetouse = preg_replace('/([^a-z0-9])/i', '', (string) $codetouse);
}
// Remove special alpha if COMPANY_AQUARIUM_REMOVE_ALPHA is set to 1
if (getDolGlobalString('COMPANY_AQUARIUM_REMOVE_ALPHA')) {
$codetouse = preg_replace('/([a-z])/i', '', $codetouse);
$codetouse = preg_replace('/([a-z])/i', '', (string) $codetouse);
}
// Apply a regex replacement pattern on code if COMPANY_AQUARIUM_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed.
if (getDolGlobalString('COMPANY_AQUARIUM_CLEAN_REGEX')) { // Example: $conf->global->COMPANY_AQUARIUM_CLEAN_REGEX='^..(..)..';
$codetouse = preg_replace('/' . getDolGlobalString('COMPANY_AQUARIUM_CLEAN_REGEX').'/', '\1\2\3', $codetouse);
$codetouse = preg_replace('/' . getDolGlobalString('COMPANY_AQUARIUM_CLEAN_REGEX').'/', '\1\2\3', (string) $codetouse);
}
$codetouse = $prefix.strtoupper($codetouse);
$codetouse = $prefix.strtoupper((string) $codetouse);
$is_dispo = $this->verif($db, $codetouse, $societe, $type);
$this->code = $codetouse;

View File

@@ -6,7 +6,7 @@
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
@@ -98,22 +98,22 @@ class Don extends CommonObject
public $societe;
/**
* @var string Address
* @var ?string Address
*/
public $address;
/**
* @var string Zipcode
* @var ?string Zipcode
*/
public $zip;
/**
* @var string Town
* @var ?string Town
*/
public $town;
/**
* @var string Email
* @var ?string Email
*/
public $email;

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2019-2020 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2020-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -298,7 +298,7 @@ class IntracommReport extends CommonObject
global $conf, $mysoc;
/**************Construction de quelques variables********************/
$party_id = substr(strtr($mysoc->tva_intra, array(' ' => '')), 0, 4).$mysoc->idprof2;
$party_id = substr(strtr($mysoc->tva_intra ?? '', array(' ' => '')), 0, 4).$mysoc->idprof2;
$declarant = substr($mysoc->managers, 0, 14);
$id_declaration = self::getDeclarationNumber($this->numero_declaration);
/********************************************************************/
@@ -362,7 +362,7 @@ class IntracommReport extends CommonObject
$declaration_des = $e->addChild('declaration_des');
$declaration_des->addChild('num_des', self::getDeclarationNumber($this->numero_declaration));
$declaration_des->addChild('num_tvaFr', $mysoc->tva_intra); // /^FR[a-Z0-9]{2}[0-9]{9}$/ // Doit faire 13 caractères
$declaration_des->addChild('num_tvaFr', $mysoc->tva_intra ?? ''); // /^FR[a-Z0-9]{2}[0-9]{9}$/ // Doit faire 13 caractères
$declaration_des->addChild('mois_des', (string) $period_month);
$declaration_des->addChild('an_des', (string) $period_year);

View File

@@ -1478,7 +1478,7 @@ if ($ispaymentok) {
$sendto = $attendeetovalidate->email;
$cc = '';
if ($thirdparty->email) {
$cc = $thirdparty->email;
$cc = $thirdparty->email ?? '';
}
if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) {
$cc = ($cc ? ', ' : '').$attendeetovalidate->email_company;

View File

@@ -258,9 +258,9 @@ if (is_array($results)) {
print $langs->trans("ContactForRecruitment").' : ';
$emailforcontact = $object->email_recruiter;
if (empty($emailforcontact)) {
$emailforcontact = $tmpuser->email;
$emailforcontact = $tmpuser->email ?? '';
if (empty($emailforcontact)) {
$emailforcontact = $mysoc->email;
$emailforcontact = $mysoc->email ?? '';
}
}
print '<b class="wordbreak">';

View File

@@ -357,9 +357,9 @@ $tmpuser->fetch($object->fk_user_recruiter);
print $langs->trans("ContactForRecruitment").' : ';
$emailforcontact = $object->email_recruiter;
if (empty($emailforcontact)) {
$emailforcontact = $tmpuser->email;
$emailforcontact = $tmpuser->email ?? '';
if (empty($emailforcontact)) {
$emailforcontact = $mysoc->email;
$emailforcontact = $mysoc->email ?? '';
}
}
print '<b class="wordbreak">';

View File

@@ -343,7 +343,7 @@ if ($object->email && !getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) {
if ($object->url && !getDolUserInt('USER_PUBLIC_HIDE_URL', 0, $object)) {
$usersection .= '<div class="flexitemsmall">';
$usersection .= img_picto('', 'globe', 'class="pictofixedwidth"');
$usersection .= dol_print_url($object->url, '_blank', 0, 0, '');
$usersection .= dol_print_url($object->url ?? '', '_blank', 0, 0, '');
$usersection .= '</div>';
}

View File

@@ -1554,7 +1554,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print '<tr>';
print '<td>'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).'</td><td>';
print '<table class="nobordernopadding"><tr><td>';
$tmpcode = $object->code_client;
$tmpcode = $object->code_client ?? '';
if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
$tmpcode = $modCodeClient->getNextValue($object, 0);
}
@@ -1573,7 +1573,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
}
print '<td>'.$form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0).'</td><td>';
print '<table class="nobordernopadding"><tr><td>';
$tmpcode = $object->code_fournisseur;
$tmpcode = $object->code_fournisseur ?? '';
if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
$tmpcode = $modCodeFournisseur->getNextValue($object, 1);
}
@@ -2400,7 +2400,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print '<tr><td>'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).'</td><td colspan="3">';
print '<table class="nobordernopadding"><tr><td>';
$tmpcode = $object->code_client;
$tmpcode = $object->code_client ?? '';
if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
$tmpcode = $modCodeClient->getNextValue($object, 0);
}
@@ -2419,7 +2419,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
print '<table class="nobordernopadding"><tr><td>';
$tmpcode = $object->code_fournisseur;
$tmpcode = $object->code_fournisseur ?? '';
if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
$tmpcode = $modCodeFournisseur->getNextValue($object, 1);
}

View File

@@ -16,7 +16,7 @@
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2019-2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2022 ButterflyOfFire <butterflyoffire+dolibarr@protonmail.com>
* Copyright (C) 2023-2024 Alexandre Janniaux <alexandre.janniaux@gmail.com>
@@ -314,21 +314,21 @@ class Societe extends CommonObject
public $country_id;
/**
* @var string State code
* @var ?string State code
* @deprecated Use $state_code instead
* @see $state_code
*/
public $departement_code;
/**
* @var string
* @var ?string
* @deprecated Use $state instead
* @see $state
*/
public $departement;
/**
* @var string
* @var ?string
* @deprecated Use $country instead
* @see $country
*/
@@ -336,23 +336,23 @@ class Societe extends CommonObject
/**
* Phone number
* @var string
* @var ?string
*/
public $phone;
/**
* PhoneMobile number
* @var string
* @var ?string
*/
public $phone_mobile;
/**
* Fax number
* @var string
* @var ?string
*/
public $fax;
/**
* Email
* @var string
* @var ?string
*/
public $email;
@@ -392,7 +392,7 @@ class Societe extends CommonObject
/**
* Webpage
* @var string
* @var ?string
*/
public $url;
@@ -406,12 +406,12 @@ class Societe extends CommonObject
/**
* Professional ID 1 (Ex: Siren in France)
* @var string
* @var ?string
*/
public $idprof1;
/**
* @var string Professional ID 1
* @var ?string Professional ID 1
* @deprecated Use $idprof1 instead
* @see $idprof1
*/
@@ -420,12 +420,12 @@ class Societe extends CommonObject
/**
* Professional ID 2 (Ex: Siret in France)
* @var string
* @var ?string
*/
public $idprof2;
/**
* @var string Professional ID 2
* @var ?string Professional ID 2
* @deprecated Use $idprof2 instead
* @see $idprof2
*/
@@ -433,12 +433,12 @@ class Societe extends CommonObject
/**
* Professional ID 3 (Ex: Ape in France)
* @var string
* @var ?string
*/
public $idprof3;
/**
* @var string Professional ID 3
* @var ?string Professional ID 3
* @deprecated Use $idprof3 instead
* @see $idprof3
*/
@@ -446,43 +446,43 @@ class Societe extends CommonObject
/**
* Professional ID 4 (Ex: RCS in France)
* @var string
* @var ?string
*/
public $idprof4;
/**
* Professional ID 5
* @var string
* @var ?string
*/
public $idprof5;
/**
* Professional ID 6
* @var string
* @var ?string
*/
public $idprof6;
/**
* Professional ID 7
* @var string
* @var ?string
*/
public $idprof7;
/**
* Professional ID 8
* @var string
* @var ?string
*/
public $idprof8;
/**
* Professional ID 9
* @var string
* @var ?string
*/
public $idprof9;
/**
* Professional ID 10
* @var string
* @var ?string
*/
public $idprof10;
@@ -503,7 +503,7 @@ class Societe extends CommonObject
public $tva_assuj = 1;
/**
* @var string Intracommunitary VAT ID
* @var ?string Intracommunitary VAT ID
*/
public $tva_intra;
@@ -644,49 +644,49 @@ class Societe extends CommonObject
/**
* Client code. E.g: CU2014-003
* @var string
* @var ?string
*/
public $code_client;
/**
* Supplier code. E.g: SU2014-003
* @var string
* @var ?string
*/
public $code_fournisseur;
/**
* Accounting code for client
* @var string
* @var ?string
*/
public $code_compta_client;
/**
* Accounting general account for customer
* @var string
* @var ?string
*/
public $accountancy_code_customer_general;
/**
* Accounting auxiliary account for customer
* @var string
* @var ?string
*/
public $accountancy_code_customer;
/**
* Accounting code for supplier
* @var string
* @var ?string
*/
public $code_compta_fournisseur;
/**
* Accounting general account for supplier
* @var string
* @var ?string
*/
public $accountancy_code_supplier_general;
/**
* Accounting auxiliary account for supplier
* @var string
* @var ?string
*/
public $accountancy_code_supplier;
@@ -697,7 +697,7 @@ class Societe extends CommonObject
public $code_compta_product;
/**
* @var string
* @var ?string
* @deprecated Use $note_public, $note_private - Note is split in public and private notes
* @see $note_public, $note_private
*/
@@ -705,13 +705,13 @@ class Societe extends CommonObject
/**
* Private note
* @var string
* @var ?string
*/
public $note_private;
/**
* Public note
* @var string
* @var ?string
*/
public $note_public;
@@ -1000,11 +1000,11 @@ class Societe extends CommonObject
}
$this->import_key = trim((string) $this->import_key);
$this->code_compta_client = trim($this->code_compta_client);
$this->code_compta_client = trim($this->code_compta_client ?? '');
$this->accountancy_code_customer_general = trim($this->accountancy_code_customer_general);
$this->accountancy_code_customer_general = trim($this->accountancy_code_customer_general ?? '');
$this->accountancy_code_customer = trim((string) $this->code_compta_client);
$this->accountancy_code_supplier_general = trim($this->accountancy_code_supplier_general);
$this->accountancy_code_supplier_general = trim($this->accountancy_code_supplier_general ?? '');
$this->accountancy_code_supplier = trim((string) $this->code_compta_fournisseur);
$this->accountancy_code_buy = trim((string) $this->accountancy_code_buy);
$this->accountancy_code_sell = trim((string) $this->accountancy_code_sell);
@@ -1494,7 +1494,7 @@ class Societe extends CommonObject
$this->supplier_order_min_amount = price2num($this->supplier_order_min_amount);
$this->tva_assuj = (is_numeric($this->tva_assuj)) ? (int) trim((string) $this->tva_assuj) : 0;
$this->tva_intra = dol_sanitizeFileName($this->tva_intra, '');
$this->tva_intra = dol_sanitizeFileName($this->tva_intra ?? '', '');
$this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1;
if (empty($this->status)) {
$this->status = 0;

View File

@@ -12,7 +12,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2021 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019 Abbes Bahfir <dolipar@dolipar.org>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Lenin Rivas <lenin.rivas777@gmail.com>
@@ -125,7 +125,7 @@ class User extends CommonObject
public $birth;
/**
* @var string email
* @var ?string email
*/
public $email;

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2023-2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023-2024 Lionel Vessiller <lvessiller@easya.solutions>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -158,8 +158,6 @@ class WebPortalMember extends Adherent
//public $phone;
//public $phone_perso;
//public $phone_mobile;
//public $email;
//public $url;
//public $socialnetworks;
//public $login;
/**