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

Fix Inherited Memberships To Respect Multiple Qualifying Relationships #31886

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shahrukh-compuco
Copy link

Overview

Currently there are below mentioned issues related to relationships and inherited memberships

  • When a membership type has multiple relationships enabled to inherit, and an individual has multiple relationships with the organisation that are enabled for inheriting and when user edits one of the relationships, and add an end date in the past relationship gets inactive which is correct, but the inherited membership gets removed which is incorrect as there is still one qualifying active relationship.
  • Then when user edits the second relationship and adds an end date in the past and save, relationship gets inactive which is correct, but the inherited membership will be added back which is incorrect as at this point there is no qualifying active relationship.
  • When there are two membership types that has one relationships each enabled to inherit and user creates an organisation with both these memberships and create both of the relationships between an individual and the organisation then inherited memberships are created for individual but when user edits one of the relationships, and add an end date in the past the relationship gets inactive which is correct, but both the memberships gets removed from individual whereas only one should get removed.

This pr solves this issue as per below rules

  • When a relationship is ended and if that relationship type provides any memberships by relationship and is the only relationship type which is proving that membership by relationship then the relevant membership (and only that membership) by relationship is ended.
  • If however there are other relationship types that provide that membership by relationship those membership should not end plus if there are other memberships provided by other relationship types they should not be affected as well.

This is in response to https://lab.civicrm.org/dev/core/-/issues/4788

Copy link

civibot bot commented Jan 27, 2025

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers...

➡️ Online demo of this PR 🔗

@civibot civibot bot added the master label Jan 27, 2025
@eileenmcnaughton
Copy link
Contributor

@shahrukh-compuco this seems useful - but are you able to add a unit test? This would probably be a good starting point

public function testSingleMembershipForTwoRelationships(): void {

@agileware-justin & @mattwire might have an interest in this and possibly be able to review

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