diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 882df59f4f0..dd11b0999f6 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -2238,12 +2238,6 @@ parameters: count: 1 path: ../../../htdocs/bookcal/calendar_card.php - - - message: '#^Variable \$soc might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/bookcal/calendar_card.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -13824,12 +13818,6 @@ parameters: count: 1 path: ../../../htdocs/knowledgemanagement/knowledgerecord_card.php - - - message: '#^Property KnowledgeRecord\:\:\$status \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/knowledgemanagement/knowledgerecord_card.php - - message: '#^Variable \$upload_dir might not be defined\.$#' identifier: variable.undefined @@ -19596,12 +19584,6 @@ parameters: count: 3 path: ../../../htdocs/takepos/freezone.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/takepos/genimg/index.php - - message: '#^Variable \$db might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 5015d21d86d..31c4d3060f6 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2015-2017 Marcos García * Copyright (C) 2015-2017 Nicolas ZABOURI - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Anthony Berton * Copyright (C) 2024-2025 MDW @@ -1719,7 +1719,9 @@ class FormMail extends Form $this->error = 'LabelIsMandatoryWhenIdIs-2or-3'; return -1; } - + if ($type_template === 'societe') { + $type_template = 'thirdparty'; + } $ret = new ModelMail($dbs); $languagetosearch = (is_object($outputlangs) ? $outputlangs->defaultlang : ''); @@ -1732,7 +1734,7 @@ class FormMail extends Form $sql = "SELECT rowid, entity, module, label, type_template, topic, email_from, joinfiles, content, content_lines, lang, email_from, email_to, email_tocc, email_tobcc"; $sql .= " FROM ".$dbs->prefix().'c_email_templates'; - $sql .= " WHERE (type_template = '".$dbs->escape($type_template)."' OR type_template = 'all')"; + $sql .= " WHERE (type_template = '".$dbs->escape($type_template)."' OR type_template = '".$dbs->escape($type_template)."_send' OR type_template = 'all')"; $sql .= " AND entity IN (".getEntity('c_email_templates').")"; $sql .= " AND (private = 0 OR fk_user = ".((int) $user->id).")"; // Get all public or private owned if ($active >= 0) { diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 7d5e1e89318..88348ba8f21 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -951,7 +951,7 @@ class Notify $template = $notifcode.'_TEMPLATE'; $labeltouse = getDolGlobalString($template); if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse); + $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type, $user, $outputlangs, 0, 1, $labeltouse); } if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { if (method_exists($object, 'fetch_thirdparty') && empty($object->thirdparty)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ac3ec79e418..34bc696f604 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7144,8 +7144,8 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin $tmpfield = explode(',', $field); $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' - if (strpos($tooltip, ':') !== false) { - $tmptooltip = explode(':', $tooltip); + if (strpos((string) $tooltip, ':') !== false) { + $tmptooltip = explode(':', (string) $tooltip); } else { $tmptooltip = array($tooltip); } @@ -7196,9 +7196,9 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin //$out .= (getDolGlobalString('MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE') ? '' : ' title="'.dol_escape_htmltag($langs->trans($name)).'"'); $out .= '>'; } - if ($tooltip) { + if ($tooltip && $tmptooltip[0]) { // You can also use 'TranslationString:[keyfortooltiponclick]:[tooltipdirection]' for a tooltip on click or to change tooltip position. - $out .= $form->textwithpicto($langs->trans((string) $name), $langs->trans($tmptooltip[0]), (empty($tmptooltip[2]) ? '1' : $tmptooltip[2]), 'help', ((!empty($tmptooltip[2]) && $tmptooltip[2] == '-1') ? 'paddingrightonly' : ''), 0, 3, (empty($tmptooltip[1]) ? '' : 'extra_' . str_replace('.', '_', $field) . '_' . $tmptooltip[1])); + $out .= $form->textwithpicto($langs->trans((string) $name), $langs->trans((string) $tmptooltip[0]), (empty($tmptooltip[2]) ? '1' : $tmptooltip[2]), 'help', ((!empty($tmptooltip[2]) && $tmptooltip[2] == '-1') ? 'paddingrightonly' : ''), 0, 3, (empty($tmptooltip[1]) ? '' : 'extra_' . str_replace('.', '_', $field) . '_' . $tmptooltip[1])); } else { $out .= $langs->trans((string) $name); }