Skip to content

Commit db453d8

Browse files
carstenpfeiferpogster
carstenpfeifer
authored andcommitted
magento-engcom#30: Do required attribute check before attribute validation. Add check if the required attribute is not empty after trimming.
1 parent f947cad commit db453d8

File tree

1 file changed

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

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,12 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
593593
if (in_array($attributeCode, $this->_ignoredAttributes)) {
594594
continue;
595595
}
596+
if ($attributeParams['is_required']
597+
&& ((!isset($rowData[$attributeCode]) && !$this->_getCustomerId($email, $website))
598+
|| (isset($rowData[$attributeCode]) && '' === trim($rowData[$attributeCode])))) {
599+
$this->addRowError(self::ERROR_VALUE_IS_REQUIRED, $rowNumber, $attributeCode);
600+
continue;
601+
}
596602
if (isset($rowData[$attributeCode]) && strlen($rowData[$attributeCode])) {
597603
$this->isAttributeValid(
598604
$attributeCode,
@@ -603,8 +609,6 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
603609
? $this->_parameters[Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR]
604610
: Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR
605611
);
606-
} elseif ($attributeParams['is_required'] && !$this->_getCustomerId($email, $website)) {
607-
$this->addRowError(self::ERROR_VALUE_IS_REQUIRED, $rowNumber, $attributeCode);
608612
}
609613
}
610614
}

0 commit comments

Comments
 (0)