Added check if relationship types exist.
authorMattias Michaux <mattias.michaux@gmail.com>
Fri, 4 Dec 2015 08:28:51 +0000 (09:28 +0100)
committerMattias Michaux <mattias.michaux@gmail.com>
Fri, 4 Dec 2015 08:28:51 +0000 (09:28 +0100)
CRM/Contact/BAO/Relationship.php

index ba71b147e99f437703d7f7c0879949b9c654aa56..065a88ca3f25ab7fce674574445ae14728063632 100644 (file)
@@ -622,8 +622,9 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
     //or between individual and organization
     if (($action & CRM_Core_Action::DISABLE) || ($action & CRM_Core_Action::DELETE)) {
       $relTypes = CRM_Utils_Array::index(array('name_a_b'), CRM_Core_PseudoConstant::relationshipType('name'));
-      if ($relationship->relationship_type_id == $relTypes['Employee of']['id'] ||
-        $relationship->relationship_type_id == $relTypes['Household Member of']['id']
+      if (
+        (isset($relTypes['Employee of']) && $relationship->relationship_type_id == $relTypes['Employee of']['id']) ||
+        (isset ($relTypes['Household Member of']) && $relationship->relationship_type_id == $relTypes['Household Member of']['id'])
       ) {
         $sharedContact = new CRM_Contact_DAO_Contact();
         $sharedContact->id = $relationship->contact_id_a;