Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Minor function signature cleanup #17922

Merged
merged 1 commit into from
Jul 23, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jul 23, 2020

Overview

Minor cleanup on GroupContact.create function signature

Before

$params passed by reference, $visibility received but just used to set $ignorePermissions

After

$params not by reference. Ditch interim 'visibility' param

Technical Details

$params is never altered so it is unnecessary to pass by reference.$ visibility is just
used to set ignorePermissions

Comments

Anything else you would like the reviewer to note

@civibot
Copy link

civibot bot commented Jul 23, 2020

(Standard links)

@civibot civibot bot added the master label Jul 23, 2020
@eileenmcnaughton
Copy link
Contributor Author

I'm confused why this wasn't failing before - this is the code


    // Process group and tag
    if (!empty($fields['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
      if ($visibility) {
        $method = 'Web';
      }
      CRM_Contact_BAO_GroupContact::create($params['group'], $contactID, $visibility, $method);
    }

so - the parameter $params['group'] is empty - but it always was - since the earlier check is on $fields['group'];

 is never altered so it is unnecessary to pass by reference. visibility is just
used to set ignorePermissions
@eileenmcnaughton
Copy link
Contributor Author

I switched ^^ to checking if $params['group'] is set

@colemanw colemanw merged commit a48fe43 into civicrm:master Jul 23, 2020
@colemanw colemanw deleted the group_contact branch July 23, 2020 16:23
@colemanw
Copy link
Member

Ok that all makes sense. I've followed up with #17928

@eileenmcnaughton eileenmcnaughton changed the title [REF] Minor function signuture cleanup [REF] Minor function signature cleanup Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants