X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FDedupe%2FBAO%2FDedupeRuleGroup.php;h=8fa7e35033a27b5f89c5d00def43147f08221063;hb=58a65f77cb2d8381b0128bcdaf30fc33aa802124;hp=ce14df0c5438ba5f2214aab23a253da7d5504e0d;hpb=c8e17ab5421a5887c549dfc269a728d9590b8de6;p=civicrm-core.git diff --git a/CRM/Dedupe/BAO/DedupeRuleGroup.php b/CRM/Dedupe/BAO/DedupeRuleGroup.php index ce14df0c54..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', @@ -87,7 +86,7 @@ class CRM_Dedupe_BAO_DedupeRuleGroup extends CRM_Dedupe_DAO_DedupeRuleGroup { 'civicrm_website', ]; - foreach (['Individual', 'Organization', 'Household'] as $ctype) { + foreach (CRM_Contact_BAO_ContactType::basicTypes() as $ctype) { // take the table.field pairs and their titles from importableFields() if the table is supported foreach (CRM_Contact_BAO_Contact::importableFields($ctype) as $iField) { if (isset($iField['where'])) { @@ -109,19 +108,24 @@ 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; } foreach ($cg['fields'] as $cf) { - $fields[$ctype][$cg['table_name']][$cf['column_name']] = $cf['label']; + $fields[$ctype][$cg['table_name']][$cf['column_name']] = $cg['title'] . ' : ' . $cf['label']; } } } + //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] ?? []; + } /**