diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 5bc12424751..930ea37ad49 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1498,7 +1498,7 @@ class FormMail extends Form
* @param string $showlinktolayout Show link to layout
* @return string HTML for model email boxes
*/
- public function getModelEmailTemplate($htmlContent = 'message', $showlinktolayout = 'email')
+ public function getEmailLayoutSelector($htmlContent = 'message', $showlinktolayout = 'email')
{
global $websitepage, $langs;
@@ -1519,10 +1519,10 @@ class FormMail extends Form
$layoutname = preg_replace('/\.html$/i', '', $layouttemplatefile['name']);
// Exclude some layouts for some use cases
- if ($layoutname == 'news' && !in_array($showlinktolayout, array('emailing', 'websitepage'))) {
+ if ($layoutname == 'news' && !in_array($showlinktolayout, array('emailing', 'websitepage')) && !isModEnabled('website')) {
continue;
}
- if ($layoutname == 'products' && !in_array($showlinktolayout, array('emailing', 'websitepage'))) {
+ if ($layoutname == 'products' && !in_array($showlinktolayout, array('emailing', 'websitepage')) && !isModEnabled('product') && !isModEnabled('service')) {
continue;
}
diff --git a/htdocs/core/tpl/formlayoutai.tpl.php b/htdocs/core/tpl/formlayoutai.tpl.php
index 5b422875afe..2b1bdbea6b5 100644
--- a/htdocs/core/tpl/formlayoutai.tpl.php
+++ b/htdocs/core/tpl/formlayoutai.tpl.php
@@ -142,7 +142,7 @@ if ($showlinktolayout) {
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
}
- $out .= $formmail->getModelEmailTemplate($htmlname, $showlinktolayout);
+ $out .= $formmail->getEmailLayoutSelector($htmlname, $showlinktolayout);
}
} else {
$out .= '';