Merge pull request #23454 from colemanw/searchKitGrandTotals
[civicrm-core.git] / CRM / Dedupe / Finder.php
index a04648e07c7dff0f7e91e461d39be886ce365adb..e4ee36ff30f6552ba18e7ecbd490b2ba008022ff 100644 (file)
@@ -220,7 +220,11 @@ class CRM_Dedupe_Finder {
     }
 
     // handle custom data
-    $tree = CRM_Core_BAO_CustomGroup::getTree($ctype, NULL, NULL, -1);
+
+    $subTypes = $fields['contact_sub_type'] ?? [];
+    // Only return custom for subType + unrestricted or return all custom
+    // fields.
+    $tree = CRM_Core_BAO_CustomGroup::getTree($ctype, NULL, NULL, -1, $subTypes, NULL, TRUE, NULL, TRUE);
     CRM_Core_BAO_CustomGroup::postProcess($tree, $fields, TRUE);
     foreach ($tree as $key => $cg) {
       if (!is_int($key)) {