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 bug: Customer import deletes exiting customer entity Fields #11968

Conversation

jalogut
Copy link
Contributor

@jalogut jalogut commented Nov 2, 2017

Importing a import file to update customer data, results in entity fields being removed if the columns are not present on the imported file.

That is the case for all fields defined here:

protected $customerFields = [
        CustomerInterface::GROUP_ID,
        CustomerInterface::STORE_ID,
        CustomerInterface::UPDATED_AT,
        CustomerInterface::CREATED_AT,
        CustomerInterface::CREATED_IN,
        CustomerInterface::PREFIX,
        CustomerInterface::FIRSTNAME,
        CustomerInterface::MIDDLENAME,
        CustomerInterface::LASTNAME,
        CustomerInterface::SUFFIX,
        CustomerInterface::DOB,
        'password_hash',
        CustomerInterface::TAXVAT,
        CustomerInterface::CONFIRMATION,
        CustomerInterface::GENDER,
        'rp_token',
        'rp_token_created_at',
        'failures_num',
        'first_failure',
        'lock_expires',
    ];

Importing a customer should result on adding or editing new data but it should keep previous information if the column is not present on imported file.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

$customerFieldsToUpdate = array_filter($this->customerFields, function ($field) use ($columnsToUpdate) {
return in_array($field, $columnsToUpdate);
});
return $customerFieldsToUpdate:
Copy link
Member

@osrecio osrecio Nov 3, 2017

Choose a reason for hiding this comment

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

Change : to ; Please (Line 287)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ups! I edited the commit. Thanks for noticing.

@jalogut jalogut force-pushed the fix-customer-import-deletes-entity-fields branch from 5ebca71 to d6c6e66 Compare November 3, 2017 23:27
@dmanners dmanners self-assigned this Nov 6, 2017
@dmanners dmanners added this to the November 2017 milestone Nov 6, 2017
);
}

return $this;
}

private function getCustomerEntityFieldsToUpdate(array $entitiesToUpdate): array
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you maybe a docblock to this method with a short explanation of the bug this method fixes. Is there actually a github issue for this fix cause you could add a link to that here.

…mport file.

 - magento#11968
 - Importing a import file to update customer data, results in entity fields being removed if the columns are not present on the imported file.
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.

None yet

5 participants