CRM-17703: Enotices on export when relationship type using 'any contact type' exists
authoryashodha <yashodha.chaku@webaccessglobal.com>
Thu, 17 Dec 2015 09:37:25 +0000 (15:07 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Thu, 17 Dec 2015 09:37:25 +0000 (15:07 +0530)
----------------------------------------
* CRM-17703: Enotices on export when relationship type using 'any contact type' exists
  https://issues.civicrm.org/jira/browse/CRM-17703

CRM/Core/BAO/Mapping.php

index 3f4c8872f3e06680863b8256aa46d7c5a06ec984..270c86408ffc89e8ccc1b2a9b61ae75cab8025f8 100644 (file)
@@ -597,11 +597,11 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
               $relationshipType->id = $id;
               if ($relationshipType->find(TRUE)) {
                 $direction = "contact_sub_type_$second";
+                $target_type = 'contact_type_' . $second;
                 if (isset($relationshipType->$direction)) {
                   $relatedFields = array_merge((array) $relatedMapperFields[$relationshipType->$direction], (array) $relationshipCustomFields);
                 }
-                else {
-                  $target_type = 'contact_type_' . $second;
+                elseif (isset($relationshipType->$target_type)) {
                   $relatedFields = array_merge((array) $relatedMapperFields[$relationshipType->$target_type], (array) $relationshipCustomFields);
                 }
               }