CRM-13725 - don't look in custom values if there aren't any.
authorJohan Vervloet <johanv@johanv.org>
Mon, 17 Aug 2015 07:13:43 +0000 (09:13 +0200)
committerJohan Vervloet <johanv@johanv.org>
Mon, 17 Aug 2015 07:13:43 +0000 (09:13 +0200)
----------------------------------------
* CRM-13725: Make check for duplicate relationship aware of custom fields
  https://issues.civicrm.org/jira/browse/CRM-13725

CRM/Contact/BAO/Relationship.php

index cbd7c23e8db337fbeeae34dd39ecd930881e1664..8dbf5976d4306bebe62036862cf3f0bb5b3f5cec 100644 (file)
@@ -940,6 +940,9 @@ WHERE  relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer');
    */
   private static function checkDuplicateCustomFields(&$params, $relationshipId) {
     $existingValues = CRM_Core_BAO_CustomValueTable::getEntityValues($relationshipId, 'Relationship');
+    if (!array_key_exists('custom', $params)) {
+      return TRUE;
+    }
     // iterate through $params['custom'], and check if the custom
     // values are the same as the one of the existing relationship.
     foreach ($params['custom'] as $group) {