Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix phpstan #32049

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions htdocs/adherents/stats/geo.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
//dol_mkdir($dir);
$data = array();
$tab = null;
$label = '';

if ($mode) {
// Define sql
Expand Down Expand Up @@ -263,6 +264,7 @@

// Show graphics
if (count($arrayjs) && $mode == 'memberbycountry') {
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
if (is_readable($color_file)) {
include $color_file;
Expand Down
30 changes: 17 additions & 13 deletions htdocs/core/class/commonpeople.class.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2023 Frédéric France <frederic.france@netlogic.fr>
/* Copyright (C) 2023-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -152,9 +152,9 @@ public function getCivilityLabel()
/**
* Return full address for banner
*
* @param string $htmlkey HTML id to make banner content unique
* @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member)
* @return string Full address string
* @param string $htmlkey HTML id to make banner content unique
* @param CommonObject $object Object (thirdparty, thirdparty of contact for contact, null for a member)
* @return string Full address string
*/
public function getBannerAddress($htmlkey, $object)
{
Expand All @@ -165,20 +165,24 @@ public function getBannerAddress($htmlkey, $object)
$contactid = 0;
$thirdpartyid = 0;
$elementforaltlanguage = $this->element;
if ($this instanceOf Societe && $this->element === 'societe') {
/** @var Societe $this */
if ($this->element === 'societe' && $this instanceof Societe) {
$thirdpartyid = $this->id;
}
if ($this instanceOf Contact && $this->element === 'contact') {
/** @var Contact $this */
if ($this->element === 'contact' && $this instanceof Contact) {
$contactid = $this->id;
$thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc;
}
if ($this instanceOf User && $this->element === 'user') {
/** @var User $this */
if ($this->element == 'member' && $this instanceof Adherent) {
$contactid = $this->id;
$thirdpartyid = empty($this->socid) ? 0 : $this->socid;
}
if ($this->element === 'user' && $this instanceof User) {
$contactid = $this->contact_id;
$thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc;
}
if ($this->element == 'recruitmentcandidature' && $this instanceof RecruitmentCandidature) {
$thirdpartyid = 0;
}

$out = '';

Expand Down Expand Up @@ -210,7 +214,7 @@ public function getBannerAddress($htmlkey, $object)
$arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE');
}

if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) {
if (!is_object($extralanguages)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
$extralanguages = new ExtraLanguages($this->db);
Expand Down Expand Up @@ -258,7 +262,7 @@ public function getBannerAddress($htmlkey, $object)
// Phones
$outphonedone = 0;
if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
$out .= ($outphonedone ? ' ' : '');
// $out .= ($outphonedone ? ' ' : '');
$out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', '&nbsp;', 'phone', $langs->trans("PhonePro"));
$outdone++;
$outphonedone++;
Expand Down Expand Up @@ -387,7 +391,7 @@ public function setUpperOrLowerCase()
$this->address = dol_strtoupper($this->address);
$this->town = dol_strtoupper($this->town);
}
if (isset($this->email)) {
if (!empty($this->email)) {
$this->email = dol_strtolower($this->email);
}
if (isset($this->personal_email)) {
Expand Down
Loading