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

[NFC] Improve cleanup on membershipStatus to cope with undeleted memberships #16756

Merged
merged 1 commit into from
Apr 15, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Mar 12, 2020

Overview

This makes the cleanup function more robust

Before

It will fail if not all memberships are deleted

After

Memberships handled

Technical Details

This might fail on the first pass as it forces the type to be int & gets rid of the silliness of calling it to do nothing

Comments

@civibot
Copy link

civibot bot commented Mar 12, 2020

(Standard links)

@civibot civibot bot added the master label Mar 12, 2020
@eileenmcnaughton eileenmcnaughton changed the title Improve cleanup on membershipStatus to cope with undeleted memberships [NFC] Improve cleanup on membershipStatus to cope with undeleted memberships Mar 17, 2020
$result = $this->callAPISuccess('MembershipStatus', 'Delete', ['id' => $membershipStatusID]);
public function membershipStatusDelete(int $membershipStatusID) {
$this->callAPISuccess('Membership', 'get', ['status_id' => $membershipStatusID, 'api.Membership.get' => 1]);
$this->callAPISuccess('MembershipStatus', 'Delete', ['id' => $membershipStatusID]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this PR looks cleaner/NFC -- eg the second call (MembershipStatus.Delete) looks essentially the same (omitting the unusued result variable).

I have to admit, it feels like I'm missing something - why add the call to Membership.get (chained with another Membership.get) if there's no output and no obvious side-effect? Is there some hidden side-effect of Membership.get?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope - that looks like a typo - fixed

@eileenmcnaughton
Copy link
Contributor Author

test this please

@eileenmcnaughton eileenmcnaughton merged commit 9298505 into civicrm:master Apr 15, 2020
@eileenmcnaughton eileenmcnaughton deleted the memtest branch April 15, 2020 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants