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

[Import] [Membership] Cleanup, fix form breakage (unreleased regression) #23689

Merged
merged 11 commits into from
Jun 6, 2022

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jun 4, 2022

Overview

[Import] [Membership] Cleanup

with things having been merged in different orders to when I wrote them the focus on the Contact import left some others broken - I'm going through fixing them. In looking at the membership import it is fundamentally a simple import and after fixing one bit here & another there & adding a bunch of tests I wound up pushing through & adopting the methodology and functions worked out for the (more complicated) contact import.

I going through 'rounds' of review on each import - adding tests, UI testing, fixing & then coming back & doing again so that they all get QA - and are working in the rc.

Please scrol to the bottom for my QA testing information

Before

Form errors

After

The import now uses the data table, uses lots of shared & standardised methods, has more tests - oh and it doesn't have that nasty fatal error

Technical Details

The underlying changes are

  • switch to storing field names not labels in civicrm_mapping_filed
  • use a persistent table to hold the data being imported
  • download errors on the fly from this table rather than pre-generated csvs
  • stop using the form get and set methods to pass information around (use the userJob table)
  • standardise field validation and transformation based on metadata - when a field is retrieved using getTransformedValue the returned value will already have dates, money, option values etc transformed to the right format. If they are invalid they will be transformed to invalid_import_value - this makes most of the remaining formatting and validation pointless

Comments

Fixes https://lab.civicrm.org/dev/core/-/issues/1819
I tested https://lab.civicrm.org/dev/core/-/issues/1204 against this & it is fixed - although whether it was already fixed I don't know

@civibot
Copy link

civibot bot commented Jun 4, 2022

(Standard links)

@civibot civibot bot added the master label Jun 4, 2022
@eileenmcnaughton eileenmcnaughton force-pushed the member_really_labels branch 3 times, most recently from 51d05aa to 018585b Compare June 4, 2022 07:15
@eileenmcnaughton eileenmcnaughton changed the title [Import] [Membership] Cleanup [Import] [Membership] Cleanup, fix form breakage (unreleased regression) Jun 4, 2022
@eileenmcnaughton eileenmcnaughton force-pushed the member_really_labels branch 7 times, most recently from 3fab5a0 to 1749d49 Compare June 5, 2022 23:04
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Jun 6, 2022
This is an attempt to get away from fixing known breakage
being blocked by
civicrm#23689

These functions should be mostly as-yet-unused, or only minorly changed
but required to fix the known issues
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Jun 6, 2022
This is an attempt to get away from fixing known breakage
being blocked by
civicrm#23689

These functions should be mostly as-yet-unused, or only minorly changed
but required to fix the known issues
@eileenmcnaughton
Copy link
Contributor Author

Test fails are because of need to adjust test for recent merge of import queue pr

@monishdeb
Copy link
Member

@eileenmcnaughton the test failure seems related :

CRM_Member_Import_Parser_MembershipTest::testImportOverriddenMembershipWithInvalidOverrideEndDate
Trying to access array offset on value of type null

/home/jenkins/bknix-dfl/build/core-23689-3kbst/web/sites/all/modules/civicrm/CRM/Member/BAO/MembershipType.php:399
/home/jenkins/bknix-dfl/build/core-23689-3kbst/web/sites/all/modules/civicrm/CRM/Member/Import/Parser/Membership.php:398
/home/jenkins/bknix-dfl/build/core-23689-3kbst/web/sites/all/modules/civicrm/tests/phpunit/CRM/Member/Import/Parser/MembershipTest.php:262
/home/jenkins/bknix-dfl/build/core-23689-3kbst/web/sites/all/modules/civicrm/tests/phpunit/CiviTest/CiviUnitTestCase.php:262
/home/jenkins/bknix-dfl/extern/phpunit8/phpunit8.phar:671

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb yeah - it didn't fail locally - but I pushed up a small change in the hope it helps - it is to do with the test not the import code

@eileenmcnaughton
Copy link
Contributor Author

Ah - it's something to do with membership set up - def test related - but hence it didn't fail in isolation - still digging

@eileenmcnaughton
Copy link
Contributor Author

OK - the test failed because it now fails during validateValues rather than import - the mapField form calls validateValues and Preview calls import

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb it has passed!

@monishdeb
Copy link
Member

@monishdeb monishdeb merged commit c4a6ea3 into civicrm:master Jun 6, 2022
@eileenmcnaughton eileenmcnaughton deleted the member_really_labels branch June 6, 2022 19:27
@eileenmcnaughton
Copy link
Contributor Author

thanks heaps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants