From: yashodha Date: Tue, 2 Feb 2016 07:47:03 +0000 (+0530) Subject: CRM-17908: text version of header/footer not used when auto-generating text version... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2470c02d0863c69c0c994b5eb0370ca0e0673902;p=civicrm-core.git CRM-17908: text version of header/footer not used when auto-generating text version of email ---------------------------------------- * CRM-17908: text version of header/footer not used when auto-generating text version of email https://issues.civicrm.org/jira/browse/CRM-17908 --- diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 330bb9c8d9..9228474e04 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -758,17 +758,24 @@ ORDER BY i.contact_id, i.{$tempColumn} if (!$this->templates) { $this->getHeaderFooter(); $this->templates = array(); - - if ($this->body_text) { + if ($this->body_text || $this->header->body_text || $this->footer->body_text) { $template = array(); - if ($this->header) { + if ($this->header->body_text) { $template[] = $this->header->body_text; + } else { + $template[] = CRM_Utils_String::htmlToText($this->header->body_html); } - $template[] = $this->body_text; + if ($this->body_text) { + $template[] = $this->body_text; + } else { + $template[] = CRM_Utils_String::htmlToText($this->body_html); + } - if ($this->footer) { + if ($this->footer->body_text) { $template[] = $this->footer->body_text; + } else { + $template[] = CRM_Utils_String::htmlToText($this->footer->body_html); } $this->templates['text'] = implode("\n", $template); @@ -792,7 +799,7 @@ ORDER BY i.contact_id, i.{$tempColumn} // this is where we create a text template from the html template if the text template did not exist // this way we ensure that every recipient will receive an email even if the pref is set to text and the // user uploads an html email only - if (!$this->body_text) { + if (empty($this->templates['text'])) { $this->templates['text'] = CRM_Utils_String::htmlToText($this->templates['html']); } }