diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 464cf608e8c9ff803f99ff4b4697f458053e54a7..fa4aa52bfc8a9f0652af3c598f65cb2d19473769 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -140,6 +140,9 @@ if (($action == 'send' || $action == 'sendhtml') && GETPOST('cancel')) if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GETPOST('addfilehtml') && ! GETPOST('removedfile') && ! GETPOST('cancel')) { $error=0; + + + $email_from=''; if (! empty($_POST["fromname"])) $email_from=$_POST["fromname"].' '; @@ -152,7 +155,12 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE $subject = $_POST['subject']; $body = $_POST['message']; $deliveryreceipt= $_POST["deliveryreceipt"]; - + + //Check if we have to decode HTML + if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401))) { + $body=dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401); + } + // Create form object include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index ecae8acadac330458285c2aae786e67f16ac9aca..896d29f05dd937bb426336f6766671dc36c25ff1 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -179,6 +179,8 @@ class Mailing extends CommonObject */ function fetch($rowid) { + global $conf; + $sql = "SELECT m.rowid, m.titre, m.sujet, m.body, m.bgcolor, m.bgimage"; $sql.= ", m.email_from, m.email_replyto, m.email_errorsto"; $sql.= ", m.statut, m.nbemail"; @@ -203,8 +205,14 @@ class Mailing extends CommonObject $this->statut = $obj->statut; $this->nbemail = $obj->nbemail; $this->titre = $obj->titre; - $this->sujet = $obj->sujet; - $this->body = $obj->body; + + $this->sujet = $obj->sujet; + if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401))) { + $this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401); + }else { + $this->body = $obj->body; + } + $this->bgcolor = $obj->bgcolor; $this->bgimage = $obj->bgimage; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 84b59c1667fda8bcf1768b9a360f9bb0bc9d91f7..9256e08318cc62c3e0e24053b51c87ab9e132b48 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -169,6 +169,9 @@ class DolEditor //$skin='office2003'; //$skin='v2'; $skin='kama'; + + if ($this->toolbarname=='dolibarr_mailings') {$htmlencode_force='true';} + else {$htmlencode_force='false';} $out.= '<script type="text/javascript"> $(document).ready(function () { @@ -177,6 +180,7 @@ class DolEditor CKEDITOR.replace(\''.$this->htmlname.'\', { customConfig : ckeditorConfig, + htmlEncodeOutput :'.$htmlencode_force.', toolbar: \''.$this->toolbarname.'\', toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').', width: '.($this->width ? '\''.$this->width.'\'' : '\'\'').',