Skip to content

Commit 180686d

Browse files
Merge remote-tracking branch 'origin/MC-35081' into 2.4-develop-pr36
2 parents cdb51f0 + befe730 commit 180686d

File tree

2 files changed

+206
-37
lines changed
  • app/code/Magento/CustomerImportExport/Model/Import
  • dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import

2 files changed

+206
-37
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,6 @@ protected function _prepareDataForUpdate(array $rowData): array
667667
$defaults[$table][$customerId][$attributeCode] = $addressId;
668668
}
669669
}
670-
// let's try to find region ID
671-
$entityRow[self::COLUMN_REGION_ID] = null;
672670

673671
if (!empty($entityRow[self::COLUMN_REGION]) && !empty($entityRow[self::COLUMN_COUNTRY_ID])) {
674672
$entityRow[self::COLUMN_REGION_ID] = $this->getCountryRegionId(
@@ -679,6 +677,8 @@ protected function _prepareDataForUpdate(array $rowData): array
679677
$entityRow[self::COLUMN_REGION] = $entityRow[self::COLUMN_REGION_ID] !== null
680678
? $this->_regions[$entityRow[self::COLUMN_REGION_ID]]
681679
: $entityRow[self::COLUMN_REGION];
680+
} elseif ($newAddress) {
681+
$entityRow[self::COLUMN_REGION_ID] = null;
682682
}
683683
if ($newAddress) {
684684
$entityRowNew = $entityRow;
@@ -908,7 +908,7 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
908908
}
909909
}
910910

911-
if (isset($rowData[self::COLUMN_COUNTRY_ID])) {
911+
if (!empty($rowData[self::COLUMN_COUNTRY_ID])) {
912912
if (isset($rowData[self::COLUMN_POSTCODE])
913913
&& !$this->postcodeValidator->isValid(
914914
$rowData[self::COLUMN_COUNTRY_ID],
@@ -918,8 +918,7 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
918918
$this->addRowError(self::ERROR_VALUE_IS_REQUIRED, $rowNumber, self::COLUMN_POSTCODE);
919919
}
920920

921-
if (isset($rowData[self::COLUMN_REGION])
922-
&& !empty($rowData[self::COLUMN_REGION])
921+
if (!empty($rowData[self::COLUMN_REGION])
923922
&& count($this->getCountryRegions($rowData[self::COLUMN_COUNTRY_ID])) > 0
924923
&& null === $this->getCountryRegionId(
925924
$rowData[self::COLUMN_COUNTRY_ID],

0 commit comments

Comments
 (0)