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) Extract getHightlightedFields #23304

Merged
merged 1 commit into from
Apr 29, 2022

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

[REF][Import] (minor) Extract getHightlightedFields

Before

Long block of code, switch...

After

Extracted function

Technical Details

  • $contactType = $this->getContactType(); returns a word, $this->get('contactType') returns a constant
  • self::$customFields is not used elsewhere
  • the order of the fields doesn't matter - they are used in highLightImport.tpl
  var highlightedFields = ["{/literal}{'","'|implode:$highlightedFields}{literal}"];
  $.each(highlightedFields, function() {
    $('select[id^="mapper"][id$="_0"] option[value='+ this + ']').append(' *').css({"color":"#FF0000"});
  });

Comments

@civibot
Copy link

civibot bot commented Apr 26, 2022

(Standard links)

@civibot civibot bot added the master label Apr 26, 2022
private function getHighlightedFields(): array {
$entityFields = [
'Individual' => ['first_name', 'last_name'],
'Organization' => 'organization_name',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'Organization' => 'organization_name',
'Organization' => ['organization_name'],
'Household' => ['household_name'],

Otherwise you get
Error: [] operator not supported for strings in CRM_Contact_Import_Form_MapField->getHighlightedFields() when it tries to append email to the array, which is not an array.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opps! fixed

@demeritcowboy
Copy link
Contributor

Also it's not from this PR but somewhere along the line the list of map fields has become always Individual fields. e.g. on dmaster.demo choose Organization as the type - the list on the mapfields page is for Individuals.

@eileenmcnaughton
Copy link
Contributor Author

@demeritcowboy I can see where the other issue crept in - it will be easier to fix if I can get some of the other import PRs merged - but if they don't look to be merging in time for the rc I'll have to do a fix for just that.

@eileenmcnaughton
Copy link
Contributor Author

I think this one in particular #23288 - would make it easier to do a good fix for the regression you found - since a lot of code can start to be unwound after that

@demeritcowboy demeritcowboy merged commit a9bb3f0 into civicrm:master Apr 29, 2022
@eileenmcnaughton eileenmcnaughton deleted the import_highlight branch April 30, 2022 02:19
@eileenmcnaughton
Copy link
Contributor Author

thanks @demeritcowboy

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