Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
#30: Refactoring for readability.
  • Loading branch information
pogster committed Jul 6, 2018
commit b4ce314d6228206551dd8d5bd128b2ebbf9ec0a5
12 changes: 9 additions & 3 deletions app/code/Magento/CustomerImportExport/Model/Import/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,18 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
if (in_array($attributeCode, $this->_ignoredAttributes)) {
continue;
}
if ($attributeParams['is_required']
&& ((!isset($rowData[$attributeCode]) && !$this->_getCustomerId($email, $website))
|| (isset($rowData[$attributeCode]) && '' === trim($rowData[$attributeCode])))) {

$isFieldRequired = $attributeParams['is_required'];
$isFieldNotSetAndCustomerDoesNotExist =
!isset($rowData[$attributeCode]) && !$this->_getCustomerId($email, $website);
$isFieldSetAndTrimmedValueIsEmpty
= isset($rowData[$attributeCode]) && '' === trim($rowData[$attributeCode]);

if ($isFieldRequired && ($isFieldNotSetAndCustomerDoesNotExist || $isFieldSetAndTrimmedValueIsEmpty)) {
$this->addRowError(self::ERROR_VALUE_IS_REQUIRED, $rowNumber, $attributeCode);
continue;
}

if (isset($rowData[$attributeCode]) && strlen($rowData[$attributeCode])) {
$this->isAttributeValid(
$attributeCode,
Expand Down