From d5a0b5eafb461c3df794f41ef9bef4ef57c783f1 Mon Sep 17 00:00:00 2001 From: Johan Vervloet Date: Mon, 17 Aug 2015 09:13:43 +0200 Subject: [PATCH] CRM-13725 - don't look in custom values if there aren't any. ---------------------------------------- * CRM-13725: Make check for duplicate relationship aware of custom fields https://issues.civicrm.org/jira/browse/CRM-13725 --- CRM/Contact/BAO/Relationship.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index cbd7c23e8d..8dbf5976d4 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -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) { -- 2.25.1