Added hack for scaping curly brackets on smarty LaTeX templates
authorRuben Rodriguez <ruben@fsf.org>
Fri, 10 Jun 2016 19:06:07 +0000 (15:06 -0400)
committerMichael McMahon <michael@fsf.org>
Tue, 27 Sep 2022 21:05:21 +0000 (17:05 -0400)
CRM/Contact/Form/Task/PDFLatexCommon.php

index 4dbdb1806b492a46902d35538e2bfdcd223dbc81..d9485f17e395c2320bff55e8ec8d687845d2570a 100644 (file)
@@ -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;