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

CIWEMB-492: Prevent switching to the same membership type #519

Merged
merged 1 commit into from Mar 7, 2024

Conversation

omarabuhussein
Copy link
Member

@omarabuhussein omarabuhussein commented Feb 7, 2024

Before

When trying to switch a membership from one type to another, the current membership type still appears in the list of membership types that you can switch to:

before1.mp4

After

The current membership type no longer appears in the list of membership types that you can switch to:

after1.mp4

Technical details

The "New membership type" field is an a civicrm entity reference field which is added by calling $this->addEntityRef() in the buildForm method (see: https://docs.civicrm.org/dev/en/latest/framework/quickform/entityref/) , so all I need is to add an API parameter to $this->addEntityRef() to exclude the current membership type, also added another parameter to only search for active membership types.

About failing tests

The failing test is non relevant to this PR and is already fixed inside this branch: https://github.com/compucorp/uk.co.compucorp.membershipextras/tree/ESEB-53-workstream

which will be part of Membershipextras version 6.1.0

@omarabuhussein omarabuhussein force-pushed the CIWEMB-492-prevent-same-type-switch branch from d3a9cdb to 8d36299 Compare February 7, 2024 11:15
@omarabuhussein omarabuhussein merged commit 8ba8bbe into master Mar 7, 2024
1 of 2 checks passed
@omarabuhussein omarabuhussein deleted the CIWEMB-492-prevent-same-type-switch branch March 7, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants