From 1bedc18da08e638069db097e8568263de08c1992 Mon Sep 17 00:00:00 2001 From: Johan Vervloet Date: Mon, 7 Sep 2015 08:15:41 +0200 Subject: [PATCH] CRM-13725 - check whether $params['custom'] exists before using it. ---------------------------------------- * CRM-13725: Make check for duplicate relationship aware of custom fields https://issues.civicrm.org/jira/browse/CRM-13725 --- CRM/Contact/BAO/Relationship.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index fac06c9422..69b3dc09ed 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -943,12 +943,14 @@ WHERE relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer'); $existingValues = CRM_Core_BAO_CustomValueTable::getEntityValues($relationshipId, 'Relationship'); // Create a similar array for the new relationship. $newValues = array(); - // $params['custom'] seems to be an array. Each value is again an array. - // This array contains one value (key -1), and this value seems to be - // an array with the information about the custom value. - foreach ($params['custom'] as $value) { - foreach ($value as $customValue) { - $newValues[$customValue['custom_field_id']] = $customValue['value']; + if (array_key_exists('custom', $params)) { + // $params['custom'] seems to be an array. Each value is again an array. + // This array contains one value (key -1), and this value seems to be + // an array with the information about the custom value. + foreach ($params['custom'] as $value) { + foreach ($value as $customValue) { + $newValues[$customValue['custom_field_id']] = $customValue['value']; + } } } -- 2.25.1