-
-
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
Fix illogical ignore/skip duplicates handling #32029
base: master
Are you sure you want to change the base?
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
@stesi561 no good deed ever goes unpunished - I see you looked at another PR so wondering if you could take a look & check my thinking /logic here |
I saw this and it hurt my brain too much. |
I'm now subscribed so will try and look at it later. This is some interesting behaviour to be sure! |
I don't fully understand what you are meaning by behaviour for before. And I'm not super familiar with this process so did some initial testing. I think what you are referencing here is that the Skip and "No Duplicate Checking" options seem to be flipped - in that using the Skip - we get duplicates, and with No duplicate checking we don't get duplicates. The 'Update' Option enforces a contact id. So I don't think is relevant here? To test I used the following CSV Which was an export of demo data - event 1, filtered to only individuals with an email address. I also forgot to export the Status Id so just set that to '1' - and manually set the source as well so we can see what happens when we import. Without the patchI agree selecting the Skip on duplicate option we get: Duplicate participants I'd mark that as a fail so Agree there is bad behaviour from CiviCRM here. WIth the Patch AppliedUnfortunately after the patch when I try and import with Skip on duplicate - I get errors for any duplicates meaning I can't actually run the import. I added a new contact [email protected] and added record for [email protected] in the csv. This also failed to match. I think more work is required here sorry. |
Unless I've been testing this wrong. In which case more explicit steps to reproduce would be great. |
Note the errors I got after the patch were all 'no matching contact found' |
Further bad behaviour found on the import page: Go to: https://dmaster.fudev.co.nz/civicrm/import/participant?reset=1 On the help text (click the question mark) "On Duplicate Entries" we get help for probably the contact import screen with options for fill etc. |
Overview
The code for importing duplicates offers the option to 'skip' or 'ignore' duplicate contact handling
The help text is messed up for this - but the screen & code imply the expectation is
However, the code doesn't actually do this
![image](https://private-user-images.githubusercontent.com/336308/411413499-b96e4073-dd65-4286-ba36-3759750e2a99.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjQ2MDQsIm5iZiI6MTczOTU2NDMwNCwicGF0aCI6Ii8zMzYzMDgvNDExNDEzNDk5LWI5NmU0MDczLWRkNjUtNDI4Ni1iYTM2LTM3NTk3NTBlMmE5OS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQyMDE4MjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zODM1NzA0NDNlMTUwOGI3MzVhNmMwZGE3YjRhYjM4MWE1NjRjMWE1YWIyNDYzNDgxZDBmNmZiMDlhZTg2MzVhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.uworjqGFOvOh_PlN694MrDG_Vim0rvFSrMm3ZZuNo6Q)
Before
The code that kicks in for "skip" relies on
if (is_array($newParticipant) && civicrm_error($newParticipant)) {
$newParticipant
is set in theisIgnoreDuplicates()
if clause. Conversely ifisIgnoreDuplicates
is true the code never attempts to import the contactAfter
I concluded the
if
that looks up the existing registrations was mistakenly set toisIgnoreDuplicates()
and should have beenisSkipDuplicates()
Technical Details
I didn't do additional clean up to not add further confusion but the whole error routine is batshit
Comments
\