diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 1db32638f6b..7d5e244a8cf 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -386,7 +386,7 @@ return [ 'UnknownElementTypePlugin', 'WhitespacePlugin', //'RemoveDebugStatementPlugin', // Reports echo, print, ... - //'SimplifyExpressionPlugin', + 'SimplifyExpressionPlugin', //'StrictComparisonPlugin', // Expects === 'SuspiciousParamOrderPlugin', 'UnsafeCodePlugin', diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index 36f26b27f0d..7cba6c8bfb7 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2017-2019 Frédéric France * Copyright (C) 2017 André Schild * Copyright (C) 2020 Guillaume Alexandre + * 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 @@ -179,7 +180,7 @@ class AccountancyImport } // at least one record value has changed, so we search for the next piece number from database or increment it - if ($atLeastOneLastRecordChanged === true) { + if ($atLeastOneLastRecordChanged) { $lastPieceNum = 0; if (empty($conf->cache['accounting']['nextPieceNum'])) { // get last piece number from database diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index fdd46b9f0f4..f8c95fca83b 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -302,7 +302,7 @@ foreach ($arrayofmodules as $file => $modCodeMember) { print img_picto($langs->trans("Activated"), 'switch_on'); print "\n"; } else { - $disabled = (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false); + $disabled = isModEnabled('multicompany') && ((is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity)); print ''; if (!$disabled) { print ''; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 0548636e5de..0ee86f731cd 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -5,6 +5,7 @@ * Copyright (C) 2012-2107 Juanjo Menent * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2021-2022 Anthony Berton + * 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 @@ -266,7 +267,7 @@ print dol_get_fiche_head($head, 'general', '', -1, ''); print ''.$form->textwithpicto($langs->trans("PDFDesc"), $s)."
\n"; print "
\n"; -$noCountryCode = (empty($mysoc->country_code) ? true : false); +$noCountryCode = empty($mysoc->country_code); print '
'; print ''; diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 51b2f692cf1..83c20b77116 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012-2018 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * 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 @@ -116,7 +117,7 @@ print ""; print ''; print ''.$langs->trans("ApiProductionMode").''; -$production_mode = (!getDolGlobalString('API_PRODUCTION_MODE') ? false : true); +$production_mode = !(!getDolGlobalString('API_PRODUCTION_MODE')); if ($production_mode) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); @@ -131,7 +132,7 @@ print ''; print ''; print ''.$langs->trans("API_DISABLE_COMPRESSION").''; -$disable_compression = (!getDolGlobalString('API_DISABLE_COMPRESSION') ? false : true); +$disable_compression = !(!getDolGlobalString('API_DISABLE_COMPRESSION')); if ($disable_compression) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index cd3f86d23fd..e516ed44ba2 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -55,7 +55,7 @@ class DolibarrApi Defaults::$cacheDirectory = $cachedir; $this->db = $db; - $production_mode = (!getDolGlobalString('API_PRODUCTION_MODE') ? false : true); + $production_mode = !(!getDolGlobalString('API_PRODUCTION_MODE')); $this->r = new Restler($production_mode, $refreshCache); $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 6d602cd6523..c0110903334 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -1542,7 +1542,7 @@ class Asset extends CommonObject $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 6e9d1e50f04..fa8b244c594 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -866,7 +866,7 @@ class BOM extends CommonObject $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index 355485b9e9f..51c915659be 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -969,7 +969,7 @@ class Availabilities extends CommonObject $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index 09c6287b6b5..77aa6276353 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -960,7 +960,7 @@ class Calendar extends CommonObject $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 629c00ef799..2dccb456e9e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1783,7 +1783,7 @@ while ($i < $imaxinloop) { } $marginInfo = array(); - if ($with_margin_info === true) { + if ($with_margin_info) { $objectstatic->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($objectstatic); $total_ht += $obj->total_ht; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9e2603cffc4..d379b09297c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -443,7 +443,7 @@ class Commande extends CommonOrder $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 8239bdc3edb..5bed3199e07 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2149,7 +2149,7 @@ while ($i < $imaxinloop) { $projectstatic->title = $obj->project_label; $marginInfo = array(); - if ($with_margin_info === true) { + if ($with_margin_info) { $generic_commande->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($generic_commande); $total_ht += $obj->total_ht; diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 2abf61b537a..9e29e536b9d 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1547,7 +1547,7 @@ if ($resql) { $projectstatic->title = $obj->project_label; $marginInfo = array(); - if ($with_margin_info === true) { + if ($with_margin_info) { $generic_commande->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($generic_commande); $total_ht += $obj->total_ht; diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index 849e13a5ed8..da4a4053bca 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -119,7 +119,7 @@ if ($currentInvId) { // Here to breakdown $toJsonArray['amount_'.$currentInvId] = price2num($currentAmount); // Param will exist only if an img has been clicked } -$toJsonArray['makeRed'] = ($totalRemaining < price2num($result) || price2num($result) < 0) ? true : false; +$toJsonArray['makeRed'] = ($totalRemaining < price2num($result) || price2num($result) < 0); $toJsonArray['result'] = price($result); // Return value to user format $toJsonArray['resultnum'] = price2num($result); // Return value to numeric format diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 0196004840c..0b2437affae 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2031,7 +2031,7 @@ if ($num > 0) { $facturestatic->totalpaid = $paiement; $marginInfo = array(); - if ($with_margin_info === true) { + if ($with_margin_info) { $facturestatic->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($facturestatic); $total_ht += $obj->total_ht; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index c84458b532f..133f83ece71 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -5,6 +5,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 Charlene Benke + * 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 @@ -212,7 +213,7 @@ if (!empty($selected_type)) { if (!empty($typent_id)) { $tableparams['typent_id'] = $typent_id; } -$tableparams['subcat'] = ($subcat === true) ? 'yes' : ''; +$tableparams['subcat'] = $subcat ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); @@ -306,7 +307,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= ",".MAIN_DB_PREFIX."facturedet as l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid"; - if ($typent_id >0) { + if ($typent_id > 0) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)"; } $parameters = array(); @@ -401,7 +402,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " AND f.fk_soc = ".((int) $selected_soc); } - if ($typent_id >0) { + if ($typent_id > 0) { $sql .= " AND soc.fk_typent = ".((int) $typent_id); } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index dbcd10c0cc2..75f8e8ec709 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -7,6 +7,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Frédéric France * Copyright (C) 2022 Alexandre Spangaro + * 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 @@ -190,7 +191,7 @@ $tableparams['search_societe'] = $search_societe; $tableparams['search_zip'] = $search_zip; $tableparams['search_town'] = $search_town; $tableparams['search_country'] = $search_country; -$tableparams['subcat'] = ($subcat === true) ? 'yes' : ''; +$tableparams['subcat'] = $subcat ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index 94c9b1d2a7a..844258bd492 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -1,5 +1,6 @@ + * 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 @@ -182,7 +183,7 @@ if (!empty($selected_soc)) { if (!empty($selected_type)) { $tableparams['search_type'] = $selected_type; } -$tableparams['subcat'] = ($subcat === true) ? 'yes' : ''; +$tableparams['subcat'] = $subcat ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 367666b0692..67429cff39a 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -1,6 +1,7 @@ * Copyright (C) 2023 Ferran Marcet + * 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 @@ -161,7 +162,7 @@ $tableparams['search_societe'] = $search_societe; $tableparams['search_zip'] = $search_zip; $tableparams['search_town'] = $search_town; $tableparams['search_country'] = $search_country; -$tableparams['subcat'] = ($subcat === true) ? 'yes' : ''; +$tableparams['subcat'] = $subcat ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 9d4c63c0e75..432301e20d5 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.clas // Load translation files required by the page $langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin")); -$refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTISSET('invoice_type')) ? true : false; +$refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTISSET('invoice_type')); $invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : ''; $vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index bffab498b3d..d83543dabf9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1356,7 +1356,7 @@ class ExtraFields } } - if ($filter_categorie === false) { + if (!$filter_categorie) { $fields_label = explode('|', $InfoFieldList[1]); if (is_array($fields_label)) { $keyList .= ', '; @@ -1526,7 +1526,7 @@ class ExtraFields } } - if ($filter_categorie === false) { + if (!$filter_categorie) { $fields_label = explode('|', $InfoFieldList[1]); if (is_array($fields_label)) { $keyList .= ', '; @@ -1913,7 +1913,7 @@ class ExtraFields dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - if ($filter_categorie === false) { + if (!$filter_categorie) { $value = ''; // value was used, so now we reset it to use it to build final output $obj = $this->db->fetch_object($resql); @@ -2023,7 +2023,7 @@ class ExtraFields dol_syslog(get_class($this).':showOutputField:$type=chkbxlst', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - if ($filter_categorie === false) { + if (!$filter_categorie) { $value = ''; // value was used, so now we reset it to use it to build final output $toprint = array(); while ($obj = $this->db->fetch_object($resql)) { @@ -2205,7 +2205,7 @@ class ExtraFields $expand_display = false; if (is_array($extrafield_param_list) && count($extrafield_param_list) > 0) { $extrafield_collapse_display_value = intval($extrafield_param_list[0]); - $expand_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOSTINT('ignorecollapsesetup')) ? (empty($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) ? false : true) : ($extrafield_collapse_display_value == 2 ? false : true)); + $expand_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOSTINT('ignorecollapsesetup')) ? (!empty($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key])) : !($extrafield_collapse_display_value == 2)); } $disabledcookiewrite = 0; if ($mode == 'create') { @@ -2239,7 +2239,7 @@ class ExtraFields $out .= '