Use field value function to get html signature
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 10 Jan 2022 02:37:23 +0000 (15:37 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 10 Jan 2022 02:37:26 +0000 (15:37 +1300)
The  function is used for all other tokens on the contact object and will better access
the right value and return an empty string rather NULL if not set.

I hit this as an enotice writing a test - but it is possibly the cause of this issue
https://github.com/eileenmcnaughton/nz.co.fuzion.civitoken/issues/58#issuecomment-966611004

hence targetting the rc

The tokens() function does weird things if you pass it NULL

CRM/Contact/Tokens.php

index 5742945dd343bba3002f48515e924e709ecba38d..731b2f330ceb8e8d689690e34c44ba9c83e3cf49 100644 (file)
@@ -316,7 +316,7 @@ class CRM_Contact_Tokens extends CRM_Core_EntityTokens {
             ->tokens('contact', $token, "cs={$cs}");
         }
         elseif ($token === 'signature_html') {
-          $row->format('text/html')->tokens('contact', $token, html_entity_decode($row->context['contact'][$token]));
+          $row->format('text/html')->tokens('contact', $token, html_entity_decode($this->getFieldValue($row, $token)));
         }
         else {
           parent::evaluateToken($row, $this->entity, $token, $row->context['contact']);