Skip to content

Commit 43d6b69

Browse files
Merge remote-tracking branch 'remotes/github/MAGETWO-88905' into EPAM-PR-58
2 parents 0b0d2c0 + 9c91fff commit 43d6b69

File tree

1 file changed

+14
-14
lines changed
  • app/code/Magento/CustomerImportExport/Model/Import

1 file changed

+14
-14
lines changed

app/code/Magento/CustomerImportExport/Model/Import/Customer.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,12 @@ private function getCustomerEntityFieldsToUpdate(array $entitiesToUpdate): array
288288
{
289289
$firstCustomer = reset($entitiesToUpdate);
290290
$columnsToUpdate = array_keys($firstCustomer);
291-
$customerFieldsToUpdate = array_filter($this->customerFields, function ($field) use ($columnsToUpdate) {
292-
return in_array($field, $columnsToUpdate);
293-
});
291+
$customerFieldsToUpdate = array_filter(
292+
$this->customerFields,
293+
function ($field) use ($columnsToUpdate) {
294+
return in_array($field, $columnsToUpdate);
295+
}
296+
);
294297
return $customerFieldsToUpdate;
295298
}
296299

@@ -423,6 +426,9 @@ protected function _prepareDataForUpdate(array $rowData)
423426
$attributeParameters = $this->_attributes[$attributeCode];
424427
if (in_array($attributeParameters['type'], ['select', 'boolean'])) {
425428
$value = $this->getSelectAttrIdByValue($attributeParameters, $value);
429+
if ($attributeCode === CustomerInterface::GENDER && $value === 0) {
430+
$value = null;
431+
}
426432
} elseif ('multiselect' == $attributeParameters['type']) {
427433
$ids = [];
428434
foreach (explode($multiSeparator, mb_strtolower($value)) as $subValue) {
@@ -519,10 +525,8 @@ protected function _importData()
519525
if (!isset($attributesToSave[$tableName])) {
520526
$attributesToSave[$tableName] = [];
521527
}
522-
$attributesToSave[$tableName] = array_diff_key(
523-
$attributesToSave[$tableName],
524-
$customerAttributes
525-
) + $customerAttributes;
528+
$attributes = array_diff_key($attributesToSave[$tableName], $customerAttributes);
529+
$attributesToSave[$tableName] = $attributes + $customerAttributes;
526530
}
527531
}
528532
}
@@ -578,13 +582,9 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
578582
$this->addRowError(self::ERROR_INVALID_STORE, $rowNumber);
579583
}
580584
// check password
581-
if (isset(
582-
$rowData['password']
583-
) && strlen(
584-
$rowData['password']
585-
) && $this->string->strlen(
586-
$rowData['password']
587-
) < self::MIN_PASSWORD_LENGTH
585+
if (isset($rowData['password'])
586+
&& strlen($rowData['password'])
587+
&& $this->string->strlen($rowData['password']) < self::MIN_PASSWORD_LENGTH
588588
) {
589589
$this->addRowError(self::ERROR_PASSWORD_LENGTH, $rowNumber);
590590
}

0 commit comments

Comments
 (0)