From 215153ea384c9c62f7f84cdebacdf13ade0a81cb Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Fri, 10 Jun 2016 15:06:07 -0400 Subject: [PATCH] Added hack for scaping curly brackets on smarty LaTeX templates --- CRM/Contact/Form/Task/PDFLatexCommon.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CRM/Contact/Form/Task/PDFLatexCommon.php b/CRM/Contact/Form/Task/PDFLatexCommon.php index 4dbdb1806b..d9485f17e3 100644 --- a/CRM/Contact/Form/Task/PDFLatexCommon.php +++ b/CRM/Contact/Form/Task/PDFLatexCommon.php @@ -335,10 +335,21 @@ class CRM_Contact_Form_Task_PDFLatexCommon { $tokenHtml = CRM_Utils_Token::replaceHookTokens($tokenHtml, $contact[$contactId], $categories, TRUE); if (defined('CIVICRM_MAIL_SMARTY') && CIVICRM_MAIL_SMARTY) { + //$debugfile = fopen("/tmp/debug1","w+"); + //fwrite($debugfile, $tokenHtml); + //fclose($debugfile); + $tokenHtml = str_replace('<{', '[ss]', $tokenHtml); + $tokenHtml = str_replace('}>', '[cs]', $tokenHtml); + $tokenHtml = str_replace('{', '[ob]', $tokenHtml); + $tokenHtml = str_replace('}', '[cb]', $tokenHtml); + $tokenHtml = str_replace('[ss]', '{', $tokenHtml); + $tokenHtml = str_replace('[cs]', '}', $tokenHtml); $smarty = CRM_Core_Smarty::singleton(); // also add the contact tokens to the template $smarty->assign_by_ref('contact', $contact); $tokenHtml = $smarty->fetch("string:$tokenHtml"); + $tokenHtml = str_replace('[ob]', '{', $tokenHtml); + $tokenHtml = str_replace('[cb]', '}', $tokenHtml); } $html[] = $tokenHtml; -- 2.25.1