From 3b47fa900bd05af2122e114cae72a0c7f12b5d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 19 Feb 2025 20:25:03 +0100 Subject: [PATCH] fix phpstan --- dev/build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/admin/mails_emailing.php | 16 ++++++++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index b03cca30ae6..d15ee623d3f 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -1458,12 +1458,6 @@ parameters: count: 4 path: ../../../htdocs/admin/mails.php - - - message: '#^Left side of && is always true\.$#' - identifier: booleanAnd.leftAlwaysTrue - count: 7 - path: ../../../htdocs/admin/mails_emailing.php - - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index e91f1058b3d..df3946e1bf7 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -3,7 +3,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2016 Jonathan TISSEAU - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-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 @@ -362,7 +362,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_SENDMODE").''; // SuperAdministrator access only - if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { + if (!isModEnabled('multicompany') || (/* $user->admin && */ !$user->entity)) { print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')); } else { $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')]; @@ -395,7 +395,7 @@ if ($action == 'edit') { } print ''; // SuperAdministrator access only - if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { + if (!isModEnabled('multicompany') || (/* $user->admin && */ !$user->entity)) { print ''; print ''; print '' . $langs->trans("SeeLocalSendMailSetup") . ''; @@ -427,7 +427,7 @@ if ($action == 'edit') { } print ''; // SuperAdministrator access only - if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { + if (!isModEnabled('multicompany') || (/* $user->admin && */ !$user->entity)) { print ''; print ''; print '' . $langs->trans("SeeLocalSendMailSetup") . ''; @@ -444,7 +444,7 @@ if ($action == 'edit') { if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { print ''.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; $vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING'; - if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { + if (!isModEnabled('multicompany') || (/* $user->admin && */ !$user->entity)) { // Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case) print ' '; print ''; @@ -473,7 +473,7 @@ if ($action == 'edit') { $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING'); print '' . $langs->trans("MAIN_MAIL_SMTPS_ID") . ''; // SuperAdministrator access only - if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { + if (!isModEnabled('multicompany') || (/* $user->admin && */ !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); @@ -488,7 +488,7 @@ if ($action == 'edit') { $mainsmtppw = getDolGlobalString('MAIN_MAIL_SMTPS_PW_EMAILING'); print '' . $langs->trans("MAIN_MAIL_SMTPS_PW") . ''; // SuperAdministrator access only - if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { + if (!isModEnabled('multicompany') || (/* $user->admin && */ !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); @@ -503,7 +503,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").''; // SuperAdministrator access only - if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { + if (!isModEnabled('multicompany') || (/* $user->admin && */ !$user->entity)) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING')); } else {