diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index f8290e999aa..8b7c851a830 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1518,25 +1518,30 @@ class FormMail extends Form */ public function getModelEmailTemplate($htmlContent = 'message') { + global $langs; + require_once DOL_DOCUMENT_ROOT.'/core/lib/emaillayout.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $out = '
'; @@ -1546,6 +1551,10 @@ class FormMail extends Form $(".template-option").click(function() { var template = $(this).data("template"); var subject = jQuery("#subject").val(); + var fromtype = jQuery("#fromtype").val(); + var sendto = jQuery("#sendto").val(); + var sendtocc = jQuery("#sendtocc").val(); + var sendtoccc = jQuery("#sendtoccc").val(); console.log("We choose a layout for email template=" + template + ", subject="+subject); @@ -1562,7 +1571,7 @@ class FormMail extends Form $.ajax({ type: "POST", url: "'.DOL_URL_ROOT.'/core/ajax/mailtemplate.php", - data: { template: template, subject: subject, content: contentHtml, token: csrfToken }, + data: { template: template, subject: subject, fromtype: fromtype, sendto: sendto, sendtocc: sendtocc, sendtoccc: sendtoccc, content: contentHtml, token: csrfToken }, success: function(response) { jQuery("#'.dol_sanitizeKeyCode($htmlContent).'").val(response); var editorInstance = CKEDITOR.instances["'.dol_sanitizeKeyCode($htmlContent).'"]; diff --git a/htdocs/install/doctemplates/maillayout/commerce.html b/htdocs/install/doctemplates/maillayout/products.html similarity index 95% rename from htdocs/install/doctemplates/maillayout/commerce.html rename to htdocs/install/doctemplates/maillayout/products.html index c23571544b0..8c8f9ee6202 100644 --- a/htdocs/install/doctemplates/maillayout/commerce.html +++ b/htdocs/install/doctemplates/maillayout/products.html @@ -2,7 +2,7 @@No Products
'; @@ -20,12 +20,12 @@ $products = $product->getProductsToPreviewInEmail(4); if ($i % 2 == 0) { print ''.$product["description"].'
@@ -39,6 +39,6 @@ $products = $product->getProductsToPreviewInEmail(4); $i++; } } - +