X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FDedupe%2FBAO%2FDedupeRuleGroup.php;h=8fa7e35033a27b5f89c5d00def43147f08221063;hb=58a65f77cb2d8381b0128bcdaf30fc33aa802124;hp=e40118c7831ca21716e4156838a22feec7e04b11;hpb=9c5284f15ed8fd68bfc3b96345588385276d8d10;p=civicrm-core.git diff --git a/CRM/Dedupe/BAO/DedupeRuleGroup.php b/CRM/Dedupe/BAO/DedupeRuleGroup.php index e40118c783..8fa7e35033 100644 --- a/CRM/Dedupe/BAO/DedupeRuleGroup.php +++ b/CRM/Dedupe/BAO/DedupeRuleGroup.php @@ -60,8 +60,7 @@ class CRM_Dedupe_BAO_DedupeRuleGroup extends CRM_Dedupe_DAO_DedupeRuleGroup { * a table-keyed array of field-keyed arrays holding supported fields' titles */ public static function supportedFields($requestedType) { - static $fields = NULL; - if (!$fields) { + if (!isset(Civi::$statics[__CLASS__]['supportedFields'])) { // this is needed, as we're piggy-backing importableFields() below $replacements = [ 'civicrm_country.name' => 'civicrm_address.country_id', @@ -109,8 +108,9 @@ class CRM_Dedupe_BAO_DedupeRuleGroup extends CRM_Dedupe_DAO_DedupeRuleGroup { // Justice League vs The Justice League but these could have the same sort_name if 'the the' // exension is installed (https://github.com/eileenmcnaughton/org.wikimedia.thethe) $fields[$ctype]['civicrm_contact']['sort_name'] = ts('Sort Name'); - // add custom data fields - foreach (CRM_Core_BAO_CustomGroup::getTree($ctype, NULL, NULL, -1) as $key => $cg) { + + // add all custom data fields including those only for sub_types. + foreach (CRM_Core_BAO_CustomGroup::getTree($ctype, NULL, NULL, -1, [], NULL, TRUE, NULL, TRUE) as $key => $cg) { if (!is_int($key)) { continue; } @@ -119,9 +119,13 @@ class CRM_Dedupe_BAO_DedupeRuleGroup extends CRM_Dedupe_DAO_DedupeRuleGroup { } } } + //Does this have to run outside of cache? + CRM_Utils_Hook::dupeQuery(CRM_Core_DAO::$_nullObject, 'supportedFields', $fields); + Civi::$statics[__CLASS__]['supportedFields'] = $fields; } - CRM_Utils_Hook::dupeQuery(CRM_Core_DAO::$_nullObject, 'supportedFields', $fields); - return !empty($fields[$requestedType]) ? $fields[$requestedType] : []; + + return Civi::$statics[__CLASS__]['supportedFields'][$requestedType] ?? []; + } /**