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

Pass all available relevant fields to Contact.getduplicates on checkMatchingContact #29554

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Pass all available relevant fields to Contact.getduplicates on checkMatchingContact - replaces #23353 by @darrick with a narrower fix - also ping @francescbassas

Before

Create a new (default) Supervised Individual dedupe rule. Add First name, last name, phone, adding up to 15 with each having 5

image

image

Add a new individual

image

Add the same individual again - ignore the as-you-type popup - click on 'Check Matching Contact'

image

image

After

After hitting Check Matching Contact

image

Technical Details

I took a look at #23353 in the hopes of resolving it but it's really tricky code & there were a couple of trade offs in there I wasn't comfortable with

  1. losing the faster ajax call
  2. letting more worms out than absolutely necessary

OTOH that patch is a bit cleverer I think in terms of not double presenting contacts.

This patch is ultimately very narrow - although there is a long comment block... It still passes the params that were being passed to getduplicates but it also passes additional parameters that it identifies based on the rule

Comments

Copy link

civibot bot commented Mar 1, 2024

🤖 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 🔗

@francescbassas
Copy link
Contributor

I checked PR site test and I haven't been able to get it to work.

I create a supervised rule for individuals with firstname, lastname and a custom field and also a supervised rule for orgs with city and country. Neither of them worked for me.

@eileenmcnaughton
Copy link
Contributor Author

@francescbassas did you definitely check specifically the Check Matching Contacts button

image

That is the lookup affected by this change. I just tried adding 'Marital Status' and that did work

@eileenmcnaughton
Copy link
Contributor Author

test this please

@francescbassas
Copy link
Contributor

francescbassas commented Mar 1, 2024

@eileenmcnaughton I defined this Supervised rule (marital status + country) and I think it's not working 🤔

imatge

@eileenmcnaughton
Copy link
Contributor Author

@francescbassas I suspect country might be not defined the same on the form - if you drop it & just do the custom field does it work?

@francescbassas
Copy link
Contributor

Using the button "Check for matching contacts"..

with just the custom field works,
with the custom field and birth date also works,
with custom field for organization isn't working

…atchingContact

I took a look at civicrm#23353 in the hopes of resolving it
but it's really tricky code & there were a couple of trade offs in there I wasn't comfortable with

1) losing the faster ajax call
2) letting more worms out than absolutely necessary

OTOH that patch is a bit cleverer I think in terms of not double presenting contacts.
@eileenmcnaughton
Copy link
Contributor Author

@francescbassas I think the issue with the custom field is deeper in the dedupe code & possibly affects more places - I did a big cleanup on the code & the custom fields are working on the cleaned up version - which I pushed in here.

I didn't dig into country but there could be an issue still with that but I propose to leave that out of scope for this PR

@francescbassas
Copy link
Contributor

Custom field for organization is now working. Only rules that include address fields don't seem to work but I think it's reasonable to remove it from this PR. I took them into account somewhat randomly for testing, not thinking about actual use. Fixing custom fields will already be a big improvement to prevent entry of duplicate contacts (for custom fields used by external identifiers, identity documents, etc.).

@eileenmcnaughton
Copy link
Contributor Author

@colemanw that close was premature - I've just rebased out the part you merged

@colemanw
Copy link
Member

colemanw commented Mar 6, 2024

@eileenmcnaughton funny I didn't actually close this. I probably just deleted the branch after merging another PR.

@eileenmcnaughton
Copy link
Contributor Author

I'm gonna merge this & close #23353 based on @francescbassas review

Note there is a help text fix in that one that maybe we should bring back to life https://github.com/civicrm/civicrm-core/pull/23353/files#diff-e66fa887a0a943f8db353ae3dfb3923aa94b1e49ba940289eafd674168032082L102

@eileenmcnaughton eileenmcnaughton merged commit a5c6a3c into civicrm:master Mar 6, 2024
3 checks passed
@eileenmcnaughton eileenmcnaughton deleted the dedupe_min branch March 6, 2024 22:49
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.

3 participants