From 94cb957cd539033c6ccfb9c250a0cecf0c7f1ea6 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 11 Mar 2021 21:57:29 +1300 Subject: [PATCH] Remove addressee, email_greeting_id, postal_greeting_id from exposed tokens Per discussion on https://github.com/civicrm/civicrm-core/pull/19550#issuecomment-781597319 there appears to be agreement that supporting tokens like addressee_id (which resolves to '{contact.individual_prefix}{ }.....') should not be exposed / supported as they seem both unuseful and likely to be breaky. These were exposed unintentionally as part of a change to make them available as WHERE filters on apiv3 https://github.com/civicrm/civicrm-core/commit/54e389ac6565ff534b87e5e46137a57d48d6c5c8 The discussion suggests that by contrast we should add support to hash in the token compat subscriber --- CRM/Core/SelectValues.php | 3 +++ tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 46c06ea3ec51..4ebec39596c6 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -619,6 +619,9 @@ public static function contactTokens() { 'legal_identifier', 'contact_sub_type', 'user_unique_id', + 'addressee_id', + 'email_greeting_id', + 'postal_greeting_id', ]; $customFields = CRM_Core_BAO_CustomField::getFields(['Individual', 'Address']); diff --git a/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php b/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php index 5ca3f5ed2db6..b81a0014b98d 100644 --- a/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php +++ b/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php @@ -192,9 +192,6 @@ public function testContactTokens(): void { individual_suffix:II formal_title:Dogsbody communication_style:Formal -email_greeting_id:Dear {contact.first_name} -postal_greeting_id:Dear {contact.first_name} -addressee_id:{contact.individual_prefix}{ } {contact.first_name}{ }{contact.middle_name}{ }{contact.last_name}{ }{contact.individual_suffix} job_title:Busy person gender:Female birth_date:December 31st, 1998 @@ -317,9 +314,6 @@ public function getAllContactTokens(): array { 'individual_suffix' => 'II', 'formal_title' => 'Dogsbody', 'communication_style' => 'Formal', - 'email_greeting_id' => 1, - 'postal_greeting_id' => 1, - 'addressee_id' => 1, 'job_title' => 'Busy person', 'gender' => 'Female', 'birth_date' => '1998-12-31',