Fix civiimport crash on unmapped fields, remove overzealous cleanup, add api to help debug & test #24603
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Fix civiimport crash on unmapped fields
Before
When I production tested the civivimport extension I hit a crash because on unmapped fields the
name
is unset. I think I hit this in production but not in prior testing because I was using an existing mapping - which I wasn't doing in my last tests in my dev tests.After
Crash fixed
In prod testing I quickly felt that adding the
validate
andimport
api to help diagnose problems was really helpful. Since that part only affects the exensions, which is still alpha, I added them into this too.Technical Details
Unmapped fields coming in via qf have the
name
property set, but equal to''
. In earlier cuts it wasdo_not_import
. This still checks fordo_not_import
but uses anempty
check rather than a comparison on''
- I could ensure it is always passed at the js layer - but that feels more fragile & I can't easily add a testComments
I also removed a table clean up that was part of the old form layer - but the form layer is not doing it's own thing so it's just plain risky now & may be why I have seen some odd behaviours around table delete