From 5298e0b78fab71041e80ff24ef2a00b223b2ffa9 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 23 Jul 2020 12:23:11 -0400 Subject: [PATCH] GroupContact BAO - Minor code cleanup --- CRM/Contact/BAO/GroupContact.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index 9c0f3b27b1..8e44e6aa40 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -489,6 +489,8 @@ SELECT * /** * Creates / removes contacts from the groups * + * FIXME: Nonstandard create function; only called from CRM_Contact_BAO_Contact::createProfileContact + * * @param array $params * Name/value pairs. * @param int $contactId @@ -500,8 +502,8 @@ SELECT * * @param string $method */ public static function create($params, $contactId, $ignorePermission = FALSE, $method = 'Admin') { - $contactIds = []; - $contactIds[] = $contactId; + $contactIds = [$contactId]; + $contactGroup = []; if ($contactId) { $contactGroupList = CRM_Contact_BAO_GroupContact::getContactGroup($contactId, 'Added', @@ -523,11 +525,6 @@ SELECT * $params = []; } - // this fix is done to prevent warning generated by array_key_exits incase of empty array is given as input - if (!isset($contactGroup) || !is_array($contactGroup)) { - $contactGroup = []; - } - // check which values has to be add/remove contact from group foreach ($allGroup as $key => $varValue) { if (!empty($params[$key]) && !array_key_exists($key, $contactGroup)) { -- 2.25.1