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

[REF] [Import] Minor code cleanup #23444

Merged
merged 1 commit into from
May 13, 2022
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented May 12, 2022

Overview

[REF] [Import] Minor code cleanup

Before

A $value array is constructed if the mapped field has a value for either location_type_id or website_type_id. The array is a subset of the $mappedField array holding the location values & in addition it has the field name & value - eg. it would look like

$value = ['location_type_id' => 1, 'email' => 'e@mail.com'];

or
$value = ['website_type_id' => 1, 'url' => 'https://civicrm.org'];

The construction builds up the array with a whole lotta ifs

After

array foo used instead

Technical Details

This is how the code section winds up looking

image

Comments

Solid test cover of this function in CRM_Contact_Import_Parser_ContactTest

@civibot
Copy link

civibot bot commented May 12, 2022

(Standard links)

@civibot civibot bot added the master label May 12, 2022
This chunk of code effectively constructs an array 'value' which holds the location
fields from the mapping. If the array is not empty then
use it as an array, otherwise use just the value
@colemanw colemanw merged commit 395af92 into civicrm:master May 13, 2022
@colemanw colemanw deleted the import_get branch May 13, 2022 13:06
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.

2 participants