From 5097572c5d8c4fb900cdf5dbeaef036a02d3a491 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 16 Dec 2024 19:07:03 +0100 Subject: [PATCH] chore: review --- htdocs/core/class/html.formticket.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 59a0f22feb60b..80370cd324ec9 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1497,7 +1497,8 @@ public function showMessageForm($width = '40%') $model_id = (int) $this->param["models_id"]; } - $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id, 1, '', 1); // If $model_id is empty, preselect the first one + // If $model_id is empty, preselect the first one + $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id, 1, '', 1); if (isset($arraydefaultmessage->id) && empty($model_id)) { $model_id = $arraydefaultmessage->id; $this->param['models_id']=$model_id; @@ -1612,6 +1613,12 @@ public function showMessageForm($width = '40%') print ''; } + // Get message template + $model_id = 0; + if (array_key_exists('models_id', $this->param)) { + $model_id = $this->param["models_id"]; + $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id, 1, '', 1); + } $result = $formmail->fetchAllEMailTemplate(!empty($this->param["models"]) ? $this->param["models"] : "", $user, $outputlangs); if ($result < 0) { setEventMessages($this->error, $this->errors, 'errors');