CRM-20672 - CRM/Core/BAO/Mapping - Fix ability to choose related fields for relations...
authorEli Lisseck <lisseck@gmail.com>
Thu, 1 Jun 2017 20:30:32 +0000 (16:30 -0400)
committerEli Lisseck <lisseck@gmail.com>
Thu, 1 Jun 2017 20:30:32 +0000 (16:30 -0400)
CRM/Core/BAO/Mapping.php

index 61827bcba99dc562829a69776823121f082c8d5a..403a08535c00a9c5075fb94f7a44f71f57059b61 100644 (file)
@@ -602,6 +602,13 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
                 elseif (isset($relationshipType->$target_type)) {
                   $relatedFields = array_merge((array) $relatedMapperFields[$relationshipType->$target_type], (array) $relationshipCustomFields);
                 }
+                               //CRM-20672 If contact target type not set e.g. "All Contacts" relationship - present user with all field options and let them determine what they expect to work
+                               else {
+                                 foreach ($contactTypes as $contactType => $label) {
+                                   $relatedFields = array_merge($relatedFields, (array) $relatedMapperFields[$label]);
+                                 }
+                                 $relatedFields = array_merge($relatedFields, (array) $relationshipCustomFields);
+                               }
               }
               $relationshipType->free();
               asort($relatedFields);