From 95f13de5a66bfacce19401c5f9b4b7ec359a00a7 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 25 Nov 2022 16:49:04 +1300 Subject: [PATCH] Remove deprecated, probably long-broken function --- CRM/Utils/Token.php | 85 --------------------------------------------- 1 file changed, 85 deletions(-) diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index b0c1786022..ffd0777804 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -273,91 +273,6 @@ class CRM_Utils_Token { return $value; } - /** - * Replace all the org-level tokens in $str - * - * @fixme: This function appears to be broken, as it depended on - * nonexistant method: CRM_Core_BAO_CustomValue::getContactValues() - * Marking as deprecated until this is clarified. - * - * @deprecated - * - the above hard-breakage was there from 2015 to 2021 and - * no error was ever reported on it -does that mean - * 1) the code is never hit because the only function that - * calls this function is never called or - * 2) it was called but never required to resolve any tokens - * or more specifically custom field tokens - * - * The handling for custom fields with the removed token has - * now been removed. - * - * @param string $str - * The string with tokens to be replaced. - * @param object $org - * Associative array of org properties. - * @param bool $html - * Replace tokens with HTML or plain text. - * - * @param bool $escapeSmarty - * - * @return string - * The processed string - */ - public static function replaceOrgTokens($str, &$org, $html = FALSE, $escapeSmarty = FALSE) { - CRM_Core_Error::deprecatedFunctionWarning('token processor'); - self::$_tokens['org'] - = array_merge( - array_keys(CRM_Contact_BAO_Contact::importableFields('Organization')), - ['address', 'display_name', 'checksum', 'contact_id'] - ); - - foreach (self::$_tokens['org'] as $token) { - // print "Getting token value for $token

"; - if ($token === '') { - continue; - } - - // If the string doesn't contain this token, skip it. - - if (!self::token_match('org', $token, $str)) { - continue; - } - - // Construct value from $token and $contact - - $value = NULL; - - if ($token === 'checksum') { - $cs = CRM_Contact_BAO_Contact_Utils::generateChecksum($org['contact_id']); - $value = "cs={$cs}"; - } - elseif ($token === 'address') { - // Build the location values array - - $loc = []; - $loc['display_name'] = CRM_Utils_Array::retrieveValueRecursive($org, 'display_name'); - $loc['street_address'] = CRM_Utils_Array::retrieveValueRecursive($org, 'street_address'); - $loc['city'] = CRM_Utils_Array::retrieveValueRecursive($org, 'city'); - $loc['state_province'] = CRM_Utils_Array::retrieveValueRecursive($org, 'state_province'); - $loc['postal_code'] = CRM_Utils_Array::retrieveValueRecursive($org, 'postal_code'); - - // Construct the address token - - $value = CRM_Utils_Address::format($loc); - if ($html) { - $value = str_replace("\n", '
', $value); - } - } - else { - $value = CRM_Utils_Array::retrieveValueRecursive($org, $token); - } - - self::token_replace('org', $token, $value, $str, $escapeSmarty); - } - - return $str; - } - /** * Replace all mailing tokens in $str * -- 2.25.1