From: Johan Vervloet Date: Mon, 17 Aug 2015 07:13:43 +0000 (+0200) Subject: CRM-13725 - don't look in custom values if there aren't any. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d5a0b5eafb461c3df794f41ef9bef4ef57c783f1;hp=6b28495231b5c42f42ef4c837b88042c17faba3e;p=civicrm-core.git 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 --- 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) {