Skip to content

Commit

Permalink
Fix for IP-260 where HTML templates got modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Kovah committed May 18, 2015
1 parent 5ec37f6 commit 07a181c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions application/helpers/mailer_helper.php
Expand Up @@ -39,7 +39,7 @@ function email_invoice($invoice_id, $invoice_template, $from, $to, $subject, $bo

$db_invoice = $CI->mdl_invoices->where('ip_invoices.invoice_id', $invoice_id)->get()->row();

$message = nl2br(parse_template($db_invoice, $body));
$message = parse_template($db_invoice, $body);
$subject = parse_template($db_invoice, $subject);
$cc = parse_template($db_invoice, $cc);
$bcc = parse_template($db_invoice, $bcc);
Expand All @@ -60,7 +60,7 @@ function email_quote($quote_id, $quote_template, $from, $to, $subject, $body, $c

$db_quote = $CI->mdl_quotes->where('ip_quotes.quote_id', $quote_id)->get()->row();

$message = nl2br(parse_template($db_quote, $body));
$message = parse_template($db_quote, $body);
$subject = parse_template($db_quote, $subject);
$cc = parse_template($db_quote, $cc);
$bcc = parse_template($db_quote, $bcc);
Expand Down
12 changes: 10 additions & 2 deletions application/modules/mailer/controllers/mailer.php
Expand Up @@ -106,7 +106,11 @@ public function send_invoice($invoice_id)
$pdf_template = $this->input->post('pdf_template');
$to = $this->input->post('to_email');
$subject = $this->input->post('subject');
$body = htmlspecialchars_decode($this->input->post('body'));
if (strlen($this->input->post('body')) != strlen(strip_tags($this->input->post('body')))) {
$body = htmlspecialchars_decode($this->input->post('body'));
} else {
$body = htmlspecialchars_decode(nl2br($this->input->post('body')));
}
$cc = $this->input->post('cc');
$bcc = $this->input->post('bcc');
$attachment_files = $this->mdl_uploads->get_invoice_uploads($invoice_id);
Expand Down Expand Up @@ -136,7 +140,11 @@ public function send_quote($quote_id)
$pdf_template = $this->input->post('pdf_template');
$to = $this->input->post('to_email');
$subject = $this->input->post('subject');
$body = htmlspecialchars_decode($this->input->post('body'));
if (strlen($this->input->post('body')) != strlen(strip_tags($this->input->post('body')))) {
$body = htmlspecialchars_decode($this->input->post('body'));
} else {
$body = htmlspecialchars_decode(nl2br($this->input->post('body')));
}
$cc = $this->input->post('cc');
$bcc = $this->input->post('bcc');
$attachment_files = $this->mdl_uploads->get_quote_uploads($quote_id);
Expand Down

0 comments on commit 07a181c

Please sign in to comment.