From 40ed102dfedd714860680494afc1c3477213b77e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Apr 2023 21:30:00 +0200 Subject: [PATCH] Fix selection of email template --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index b7816253994..b0be14cbb51 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -418,7 +418,7 @@ class FormMail extends Form $model_id = $this->param["models_id"]; } - $arraydefaultmessage = $this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, ($model_id > 0 ? $model_id : 0), 1, '', 1); // If $model_id is empty, preselect the first one + $arraydefaultmessage = $this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id, 1, '', ($model_id > 0 ? -1 : 1)); // If $model_id is empty, preselect the first one } // Define list of attached files