From: Ruben Rodriguez <ruben@fsf.org>
Date: Fri, 10 Jun 2016 19:06:07 +0000 (-0400)
Subject: Added hack for scaping curly brackets on smarty LaTeX templates
X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b338b83296413ad38c16f5519eeb2ff89c51fbd1;p=civicrm-core.git

Added hack for scaping curly brackets on smarty LaTeX templates
---

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;