Merge pull request #2135 from pratik-joshi/CRM-13861
[civicrm-core.git] / CRM / Contact / BAO / Relationship.php
index c4c1f11ee87f8fec5e7f39f2bfe053ca6bd25061..4f40d5015a2a501fe7db78e8dcb9a044534e5109 100644 (file)
@@ -1510,7 +1510,8 @@ AND cc.sort_name LIKE '%$name%'";
     } else {
       $contactTypes = array();
       foreach ($contactProfiles as $key => $value) {
-        if (strpos($value, $leftType) !== FALSE) {
+        $groupTypes = CRM_Core_BAO_UFGroup::profileGroups($key);
+        if (in_array($leftType, $groupTypes)) {
           $contactTypes = array($key => $value);
         }
       }