From ccd6ae3ae9d7108e586e1e7ff8b8f48845fc5f99 Mon Sep 17 00:00:00 2001 From: JKingsnorth Date: Mon, 16 Mar 2015 16:00:51 +0000 Subject: [PATCH] CRM-10551: Fix undefined index test failures --- CRM/Contact/BAO/Contact.php | 6 ++++-- CRM/Core/BAO/Website.php | 12 +++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index bfef9229e9..e42726bd7d 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -363,8 +363,10 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { $contact->$name = $value; } - //add website - CRM_Core_BAO_Website::create($params, $contact->id); + // Process website(s) if present in params + if (!empty($params['website'])) { + CRM_Core_BAO_Website::create($params, $contact->id); + } //get userID from session $session = CRM_Core_Session::singleton(); diff --git a/CRM/Core/BAO/Website.php b/CRM/Core/BAO/Website.php index f9629e0324..3de5744953 100644 --- a/CRM/Core/BAO/Website.php +++ b/CRM/Core/BAO/Website.php @@ -70,18 +70,16 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website { */ public static function create(&$params, $contactID) { + if (empty($params['website'])) { + return FALSE; + } + // CRM-10551 // Use updateBlankLocInfo to overwrite blanked values of matching type $updateBlankLocInfo = CRM_Utils_Array::value('updateBlankLocInfo', $params, FALSE); - // Get the websites submitted in the form + // Get websites submitted in the form, and already on the Contact $submitted_websites = $params['website']; - - if (empty($submitted_websites)) { - return FALSE; - } - - // Get the websites currently on the Contact $existing_websites = self::allWebsites($contactID); // For each website submitted on the form -- 2.25.1