diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 4647f807755..43b2b25d261 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent + * 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 @@ -41,7 +42,6 @@ if (!$user->admin) { } -$type = array('yesno', 'texte', 'chaine'); $action = GETPOST('action', 'aZ09'); $testsubscribeemail = GETPOST("testsubscribeemail"); @@ -57,13 +57,14 @@ $error = 0; // Action updated or added a constant if ($action == 'update' || $action == 'add') { $tmparray = GETPOST('constname', 'array'); + $tmpvalue = GETPOST('constvalue', 'array'); + $tmpnote = GETPOST('constnote', 'array'); if (is_array($tmparray)) { foreach ($tmparray as $key => $val) { $constname = $tmparray[$key]; - $constvalue = $tmparray[$key]; - $consttype = $tmparray[$key]; - $constnote = $tmparray[$key]; - $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); + $constvalue = $tmpvalue[$key]; + $constnote = $tmpnote[$key]; + $res = dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, $constnote, $conf->entity); if (!($res > 0)) { $error++; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index c6bc1c5871b..b552609bc8d 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * 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 @@ -42,8 +43,6 @@ if (!$user->admin) { } -$type = array('yesno', 'texte', 'chaine'); - $action = GETPOST('action', 'aZ09'); @@ -55,7 +54,6 @@ $action = GETPOST('action', 'aZ09'); if ($action == 'update' || $action == 'add') { $constnamearray = GETPOST("constname", 'array'); $constvaluearray = GETPOST("constvalue", 'array'); - $consttypearray = GETPOST("consttype", 'array'); $constnotearray = GETPOST("constnote", 'array'); // Action mise a jour ou ajout d'une constante @@ -63,10 +61,9 @@ if ($action == 'update' || $action == 'add') { foreach ($constnamearray as $key => $val) { $constname = dol_escape_htmltag($constnamearray[$key]); $constvalue = dol_escape_htmltag($constvaluearray[$key]); - $consttype = (int) $consttypearray[$key]; $constnote = dol_escape_htmltag($constnotearray[$key]); - $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); + $res = dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, $constnote, $conf->entity); if (!($res > 0)) { $error++; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 7c7ae304d60..32f57665ccd 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1715,8 +1715,8 @@ function complete_elementList_with_modules(&$elementList) /** * Show array with constants to edit * - * @param array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label) - * where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... + * @param array|array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label) + * where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... * @param int<2,3> $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended) (typed as int<2,3> to highlight the deprecated values) * @param string $helptext Tooltip help to use for the column name of values * @param string $text Text to use for the column name of values @@ -1767,7 +1767,6 @@ function form_constantes($tableau, $strictw3c = 2, $helptext = '', $text = 'Valu $const = $key; } } - $sql = "SELECT "; $sql .= "rowid"; $sql .= ", ".$db->decrypt('name')." as name"; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 9e37b39f2b1..56eca32956b 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -115,7 +115,6 @@ parameters: - '# Form::formconfirm\(\) expects array#' - '# FormWebPortal::selectForForms\(\) expects int, array#' - '# Lettering::getBankLinesFromFkDocAndDocType\(\) expects array#' - - '# form_constantes expects array#' - '# (Odf) constructor expects #' - '# Stripe[^ ]+::all\(\) expects #' - '#expects resource#'