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

Fix + Add test for exporting location types with changed names #12671

Merged
merged 1 commit into from
Aug 17, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

FIxes a bug whereby export does not export locations with name fields that differ from their labels & a recent extension of this bug to affect names that do match but have spaces.

Before

Add a location type "Expédition", where name = expedition and display_name = expédition.
Go to the member dashboard, click to list all active members
Edit one of the contacts, so that they have an address of type "expédition"
Back in the search results, export all results
Select a custom mapping:

Display name
City, location type = Expédition

Result: the city is empty (for that contact that was edited).

After

City exports correctly

Technical Details

This has affected exports for a long time but from 5.3 also affects names that match with spaces in them (which is also covered in the test). Hence targetting the rc & considering a 5.4 port

Comments

@mlutfy

@civibot
Copy link

civibot bot commented Aug 16, 2018

(Standard links)

@eileenmcnaughton
Copy link
Contributor Author

test this please

@highfalutin
Copy link
Contributor

  • Explain (r-explain)
  • Test results (r-test)
    • UNREVIEWED
  • Code quality (r-code)
    • PASS: The functionality, purpose, and style of the code seems clear+sensible.
    • COMMENTS: With the understanding that this area of the code is the subject of an ongoing cleanup/refactoring project
  • Documentation (r-doc)
    • PASS: The changes do not require documentation.
  • Maintainability (r-maint)
    • PASS: The change sufficiently improves test coverage, or the change is trivial enough that it does not require tests.
  • Run it (r-run)
    • PASS: I ran:
cv api LocationType.create name="SignificantOther" display_name="Significant Other" 
echo '{"contact_type":"Individual", "first_name":"Foo", "last_name":"Bar", "api.Email.create": [' $(for ltype in {1..6}; do printf '%s' ', {"location_type_id":"' $ltype '", "email":"location_type_' $ltype '@i.oo"}'; done | cut -c3-;) '] }' | cv api --in=json Contact.create
echo '{"name":"locationtypetest","mapping_type_id":"7","api.MappingField.create":[{"name":"email","contact_type":"Individual","column_number":"0","location_type_id":"1","grouping":"1"},{"name":"email","contact_type":"Individual","column_number":"1","location_type_id":"2","grouping":"1"},{"name":"email","contact_type":"Individual","column_number":"2","location_type_id":"3","grouping":"1"},{"name":"email","contact_type":"Individual","column_number":"3","location_type_id":"4","grouping":"1"},{"name":"email","contact_type":"Individual","column_number":"4","location_type_id":"5","grouping":"1"},{"name":"email","contact_type":"Individual","column_number":"5","location_type_id":"6","grouping":"1"}]}' | cv api --in=json Mapping.create

Then exported the contact "Foo Bar" from search results, using mapping "locationtypetest"

  • User impact (r-user)
    • PASS: The change would be intuitive or unnoticeable for a majority of users who work with this feature.
  • Technical impact (r-tech)
    • PASS: The change preserves compatibility with existing callers/code/downstream.

@totten
Copy link
Member

totten commented Aug 17, 2018

That's a nice review, @highfalutin! Thanks @eileenmcnaughton and @highfalutin.

@totten totten merged commit 4d1ace4 into civicrm:5.5 Aug 17, 2018
@totten
Copy link
Member

totten commented Aug 17, 2018

I also did an extra iteration of r-run using the steps to reproduce from dev/core#319 -- and confirmed that the email address was exported. 👍

@eileenmcnaughton eileenmcnaughton deleted the ex55 branch August 17, 2018 07:51
@mlutfy
Copy link
Member

mlutfy commented Aug 17, 2018

Late to the party, but confirming that it is fixed for my use-cases as well, including for multi-lingual. Thank you!

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.

4 participants