From a2d15dff39f6609b851e753044de131b7a6f6d03 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 12 May 2014 10:02:34 -0500 Subject: [PATCH] thread: Always embed HTML in email templates With the advent of 1.9, the original, plain text email is saved in the thread table. If a system has the HTML ticket thread enabled (which is the default), if the plain text message is placed in the email template (which is always HTML), it will not be formatted as correct HTML and the whitespace will be collapsed. This patch addresses the issue by always returning HTML from the asVar() method, which is used to embed the thread post into a email template. --- include/class.thread.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/class.thread.php b/include/class.thread.php index 8d468d959..e78b7ec41 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -776,7 +776,7 @@ Class ThreadEntry { } function asVar() { - return (string) $this; + return (string) $this->getBody()->display('html'); } function getVar($tag) { @@ -1380,6 +1380,11 @@ class TextThreadBody extends ThreadBody { return '<pre>'.$this->body.'</pre>'; } } + + function asVar() { + // Email template, assume HTML + return $this->display('html'); + } } class HtmlThreadBody extends ThreadBody { function __construct($body, $options=array()) { -- GitLab