Eileen has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/398188 )
Change subject: Greetings fixes to support contact type change. ...................................................................... Greetings fixes to support contact type change. 2 commits from https://github.com/civicrm/civicrm-core/pull/11310 CRM-21466 - Fix (obscure) enotice when updating greeting for contact, add test CRM-21466 follow up, add unit test to ensure custom fields can be populated. This involves fixing the caching to be flushed during testing Change-Id: Ic296f2b37a8ea169b93df314b95d2502d2e2b3f1 --- M CRM/Core/OptionGroup.php M CRM/Core/PseudoConstant.php M CRM/Utils/Token.php M api/v3/Contact.php 4 files changed, 16 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm refs/changes/88/398188/1 diff --git a/CRM/Core/OptionGroup.php b/CRM/Core/OptionGroup.php index 89c8eb1..250c93c 100644 --- a/CRM/Core/OptionGroup.php +++ b/CRM/Core/OptionGroup.php @@ -676,6 +676,12 @@ ); } + /** + * Flush all the places where option values are cached. + * + * Note that this is called from CRM_Core_PseudoConstant::flush() so we should resist + * the intuitive urge to flush that class. + */ public static function flushAll() { self::$_values = array(); self::$_cache = array(); diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 75793c8..abf51f1 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -594,6 +594,9 @@ } if ($name == 'cache') { CRM_Core_OptionGroup::flushAll(); + if (isset(\Civi::$statics[__CLASS__])) { + unset(\Civi::$statics[__CLASS__]); + } } } diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index 257a1b1..8e43fd2 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -657,17 +657,14 @@ $returnBlankToken = FALSE, $escapeSmarty = FALSE ) { + // Refresh contact tokens in case they have changed. There is heavy caching + // in exportable fields so there is no benefit in doing this conditionally. + self::$_tokens['contact'] = array_merge( + array_keys(CRM_Contact_BAO_Contact::exportableFields('All')), + array('checksum', 'contact_id') + ); + $key = 'contact'; - if (self::$_tokens[$key] == NULL) { - // This should come from UF - - self::$_tokens[$key] - = array_merge( - array_keys(CRM_Contact_BAO_Contact::exportableFields('All')), - array('checksum', 'contact_id') - ); - } - // here we intersect with the list of pre-configured valid tokens // so that we remove anything we do not recognize // I hope to move this step out of here soon and diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 2d1da21..b671106 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -623,7 +623,6 @@ $nullValue = FALSE; $filter = array( - 'contact_type' => $params['contact_type'], 'greeting_type' => "{$key}{$greeting}", ); -- To view, visit https://gerrit.wikimedia.org/r/398188 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic296f2b37a8ea169b93df314b95d2502d2e2b3f1 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm/civicrm Gerrit-Branch: master Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits