From: eileen Date: Thu, 23 Jul 2020 04:06:23 +0000 (+1200) Subject: [REF] Minor function signuturre cleanup X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f329c0ca6a18b90b455ad778e1a83881fafc8752;p=civicrm-core.git [REF] Minor function signuturre cleanup is never altered so it is unnecessary to pass by reference. visibility is just used to set ignorePermissions --- diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index b97aa37b12..bd4af44642 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2021,7 +2021,7 @@ ORDER BY civicrm_email.is_primary DESC"; } // Process group and tag - if (!empty($fields['group'])) { + if (isset($params['group'])) { $method = 'Admin'; // this for sure means we are coming in via profile since i added it to fix // removing contacts from user groups -- lobo diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index 9058101d05..9c0f3b27b1 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -487,28 +487,22 @@ SELECT * } /** - * Takes an associative array and creates / removes - * contacts from the groups - * + * Creates / removes contacts from the groups * * @param array $params - * (reference ) an assoc array of name/value pairs. - * @param array $contactId + * Name/value pairs. + * @param int $contactId * Contact id. * - * @param bool $visibility + * @param bool $ignorePermission + * if ignorePermission is true we are coming in via profile mean $method = 'Web' + * * @param string $method */ - public static function create(&$params, $contactId, $visibility = FALSE, $method = 'Admin') { + public static function create($params, $contactId, $ignorePermission = FALSE, $method = 'Admin') { $contactIds = []; $contactIds[] = $contactId; - //if $visibility is true we are coming in via profile mean $method = 'Web' - $ignorePermission = FALSE; - if ($visibility) { - $ignorePermission = TRUE; - } - if ($contactId) { $contactGroupList = CRM_Contact_BAO_GroupContact::getContactGroup($contactId, 'Added', NULL, FALSE, $ignorePermission @@ -522,7 +516,7 @@ SELECT * } // get the list of all the groups - $allGroup = CRM_Contact_BAO_GroupContact::getGroupList(0, $visibility); + $allGroup = CRM_Contact_BAO_GroupContact::getGroupList(0, $ignorePermission); // this fix is done to prevent warning generated by array_key_exits incase of empty array is given as input if (!is_array($params)) {