Skip to content

Commit

Permalink
Merge pull request #17922 from eileenmcnaughton/group_contact
Browse files Browse the repository at this point in the history
[REF] Minor function signuture cleanup
  • Loading branch information
colemanw authored Jul 23, 2020
2 parents 63a2160 + f329c0c commit a48fe43
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ public static function createProfileContact(
}

// 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
Expand Down
22 changes: 8 additions & 14 deletions CRM/Contact/BAO/GroupContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,28 +487,22 @@ public static function getGroupId($groupContactID) {
}

/**
* 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
Expand All @@ -522,7 +516,7 @@ public static function create(&$params, $contactId, $visibility = FALSE, $method
}

// 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)) {
Expand Down

0 comments on commit a48fe43

Please sign in to comment.