-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
SearchKit - Add ability to join on multi-select ContactRef fields #20764
Conversation
This allows the API to return e.g. an array of display names from a serialized contact reference field.
(Standard links)
|
@kurund @michaelmcandrew is this something you are able to test? |
Yup, will check it later today. |
thanks @kurund - it's good to merge once you OK it |
I am getting this weird behavior after applying the patch on nightly build. I had to manually apply the patch as auto apply failed :( I will recheck again if I missed something. |
What nightly build did you use? |
civicrm-NIGHTLY-drupal.tar.gz ( 5.40.alpha1-202107051700 )
Yes, cache cleared and upgrade went well. |
I did a fresh setup and above errors are gone. Let me test the functionality and get back to you. |
Overall patch is working as expected. I found few minor glitches. a. Now we can add contact reference autocomplete as filter and is working fine. Only issue is that it's not respecting the configuration settings of autocomplete. eg: if the contact field has advanced filter 'action=get&contact_type=Organization' it still shows all the contacts. b. I was trying to replicate activity tab and 'With Contact' does have individual clickable links but contact id is not evaluated. for example http://localhost/civicrm/contact/view?reset=1&cid=[Activity_ActivityContact_Contact_01.id] c. For one of the search I am using contact sub type as display column. It is showing correct result in Compose Search however in the table display it just shows blank. I will do few more tests later update here. |
@kurund thanks for the testing a. I think this is a related issue but should be a separate PR. It's a little tricky because traditional contact reference fields don't use the same callback as EntityRef fields, but afform uses EntityRef. b. I couldn't reproduce this. Can you create a new search to demonstrate the problem and paste the url fragment here? For example when I tested, my search was c. I couldn't reproduce this either. Can you paste a url fragment of a search to reproduce? |
…links This handles multivalued fields by looping through each item and formatting it as a link
0a99630
to
96ff473
Compare
FYI I just noticed a problem where the admin search screen was formatting every field as a link instead of just label fields like display_name. Fixed and rebased. |
Compose Search (where it is shown correctly)
Table view (not showing sub type) |
Table view
Each activity contacts have links like: http://localhost/civicrm/contact/view?reset=1&cid=[Activity_ActivityContact_Contact_01.id] |
Thanks, that make sense. |
@kurund I meant the url you see at the top of your screen when you compose a search. For a new search (before hitting Save) you'll see the url change as you update criteria. |
b
c.
Hope this helps! |
Yes that helped. I can now reproduce b and c. On investigation, I don't think either should block this PR. B. Is out-of-scope, as this PR fixes links for multi-select fields, not single fields aggregated by grouping. I do hope to tackle that issue at some point, but this PR is already quite large. C. is a pre-existing condition. I was able to reproduce it in a test and will work on a fix. Based on the review & testing I think this is merge-ready. |
retest this please |
Thanks for the testing @kurund - I wonder how much it feels like things have moved on in your time away from Civi - hopefully a little bit :-) Anyway - I'm upping this to merge-on-pass after reading through the above |
Unrelated test fail. |
Thanks :) |
Overview
Improves support for custom contactRef fields in APIv4, SearchKit, and Afform. Makes it possible to save, search for, and filter by serialized (multi-select) custom ContactRef fields.
Before
After
Comments
This also reverts #20156 as the limitation has been lifted.