When updating customers through CustomerImportExport fields thats are not set in importdata will be nullified #8548
Labels
bug report
Component: ImportExport
Issue: Clear Description
Gate 2 Passed. Manual verification of the issue description passed
Issue: Confirmed
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed
Issue: Format is valid
Gate 1 Passed. Automatic verification of issue format passed
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
Reproduced on 2.1.x
The issue has been reproduced on latest 2.1 release
Reproduced on 2.2.x
The issue has been reproduced on latest 2.2 release
Reproduced on 2.3.x
The issue has been reproduced on latest 2.3 release
When using module-customer-import-export/Model/Import/Customer.php to update existing customers, attributes that are in customer_entity and are not in the data to update will be nullified. For instance, updating customer name and or group through the importer would empty that customers password / rp_roken etc. This happens because in the _saveCustomerEntities function all fields of the customer are passed to insertOnDuplicate function.
Preconditions
Steps to reproduce
Expected result
Actual result
Resolution
In the function call on vendor/magento/module-customer-import-export/Model/Import/Customer.php:264 $this->customerFields should not be passed to the insertOnDuplicate function. The logic of insertOnDuplicate would then automatically build the query for the fields that are actually in the update data.
Query that now is beeging generated when updating customers:(
group_id
,store_id
,created_at
,updated_at
,entity_id
,firstname
,lastname
,gender
,email
):Query that should have been generated when updating customers
group_id
,store_id
,created_at
,updated_at
,entity_id
,firstname
,lastname
,gender
,email
:The text was updated successfully, but these errors were encountered: