Skip to content

Commit

Permalink
magento-engcom#88: Refactoring for readability.
Browse files Browse the repository at this point in the history
  • Loading branch information
pogster committed Jul 5, 2018
1 parent 0832e29 commit 98f74ef
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 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,16 @@ 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

0 comments on commit 98f74ef

Please sign in to comment.