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

Afform - Support repeatable relationships #25175

Merged
merged 1 commit into from Apr 5, 2023

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Dec 14, 2022

Overview

Supports creating multiple relationships at once using the "Repeatable" feature in the relationship fields.

See https://chat.civicrm.org/civicrm/pl/r3nw5p4z9jyg9gx61dndp99ipe

Before

Relationship blocks could be repeated, but only the first one would save

After

All repeated relationships save.

1. Create form, add relationship fieldset and make it repeatable

image

2. When filling out form, click the "Add" button to add multiple relations

image

3. Relationships have been created

image

@michaelmcandrew
Copy link
Contributor

@colemanw - any reason why we can't get this merged? Are you waiting on some testing or feedback? Would be great to get it out the door soon.

@colemanw
Copy link
Member Author

@michaelmcandrew it's just the usual bottleneck. I've made the PR but no one has reviewed it, but IMO it's ready to merge.

@michaelmcandrew
Copy link
Contributor

No problem @colemanw - I think @kurund can review if that works?

@mattwire
Copy link
Contributor

I applied it to a couple of test sites but found it a bit confusing. I don't know if it's working as expected or if these are the case without this patch but I found:

  • Don't seem to be able to add relationship fields without manually adding relationship fieldset from list first.
  • Can't see how to make them repeatable

@kurund
Copy link
Contributor

kurund commented Jan 12, 2023

@mattwire

Here is a sample form with repeatable fields.

Screenshot from 2023-01-12 20-16-51

@kurund
Copy link
Contributor

kurund commented Jan 12, 2023

@colemanw

Relationship data is not saved using above form.

I tried moving relationship type in the form too. Same issue.

Am I missing something?

@colemanw
Copy link
Member Author

@kurund based on the above screenshot you are trying to create a relationship between two individuals of type "team member is" - that sounds like a relationship type that's meant to go between an individual and an organization?

@colemanw
Copy link
Member Author

@kurund @mattwire I've updated the description with some screenshots. Hope that helps.

@kurund
Copy link
Contributor

kurund commented Jan 20, 2023

@kurund based on the above screenshot you are trying to create a relationship between two individuals of type "team member is" - that sounds like a relationship type that's meant to go between an individual and an organization?

@colemanw

I have created a new relationship type between Individual and Individual
Screenshot from 2023-01-20 17-10-47

Form configuration
Screenshot from 2023-01-20 17-18-46

Form is not saved and getting below error in the console.
Screenshot from 2023-01-20 17-13-58

Not that if I switch to child of as per your example it's working fine.

@kurund
Copy link
Contributor

kurund commented Feb 22, 2023

@colemanw

Looks like this branch has conflicts. Let me know once it's resolved and when above issues are fixed.

@colemanw
Copy link
Member Author

colemanw commented Apr 2, 2023

@kurund I've rebased this, and it now includes @mattwire's changes from #25620 which fix the reciprocal relationship bug you noted. So I think this is good to go now.

@colemanw colemanw added the merge ready PR will be merged after a few days if there are no objections label Apr 2, 2023
@colemanw colemanw merged commit 15a9b3f into civicrm:master Apr 5, 2023
3 checks passed
@colemanw colemanw deleted the afformRepeatRelationships branch April 5, 2023 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections
Projects
None yet
5 participants