Skip to content

Commit 9f8cd4c

Browse files
committed
AC-7039:: Customer Import: update to disable_auto_group_change ignored
1 parent 4d7c93c commit 9f8cd4c

File tree

1 file changed

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

1 file changed

+4
-11
lines changed

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class Customer extends AbstractCustomer
4141

4242
public const COLUMN_PASSWORD = 'password';
4343

44-
public const COLUMN_DISABLE_AUTO_GROUP_CHANGE = 'disable_auto_group_change';
45-
4644
/**#@-*/
4745

4846
/**#@+
@@ -164,7 +162,7 @@ class Customer extends AbstractCustomer
164162
'failures_num',
165163
'first_failure',
166164
'lock_expires',
167-
self::COLUMN_DISABLE_AUTO_GROUP_CHANGE,
165+
CustomerInterface::DISABLE_AUTO_GROUP_CHANGE,
168166
];
169167

170168
/**
@@ -409,7 +407,6 @@ protected function _prepareDataForUpdate(array $rowData)
409407
$entitiesToUpdate = [];
410408
$attributesToSave = [];
411409

412-
// entity table data
413410
$now = new \DateTime();
414411
if (empty($rowData['created_at'])) {
415412
$createdAt = $now;
@@ -426,13 +423,10 @@ protected function _prepareDataForUpdate(array $rowData)
426423
$entityId = $this->_getNextEntityId();
427424
$this->_newCustomers[$emailInLowercase][$rowData[self::COLUMN_WEBSITE]] = $entityId;
428425
}
429-
430-
// password change/set
431426
if (isset($rowData['password']) && strlen($rowData['password'])) {
432427
$rowData['password_hash'] = $this->_customerModel->hashPassword($rowData['password']);
433428
}
434429
$entityRow = ['entity_id' => $entityId];
435-
// attribute values
436430
foreach (array_intersect_key($rowData, $this->_attributes) as $attributeCode => $value) {
437431
$attributeParameters = $this->_attributes[$attributeCode];
438432
if (in_array($attributeParameters['type'], ['select', 'boolean'])) {
@@ -484,19 +478,18 @@ protected function _prepareDataForUpdate(array $rowData)
484478
$entityRow['is_active'] = 1;
485479
$entitiesToCreate[] = $entityRow;
486480
} else {
487-
// edit
481+
$COLUMN_DISABLE_AUTO_GROUP_CHANGE=CustomerInterface::DISABLE_AUTO_GROUP_CHANGE;
488482
$entityRow['updated_at'] = $now->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
489483
if (!empty($rowData[self::COLUMN_STORE])) {
490484
$entityRow['store_id'] = $this->_storeCodeToId[$rowData[self::COLUMN_STORE]];
491485
} else {
492486
$entityRow['store_id'] = $this->getCustomerStoreId($emailInLowercase, $rowData[self::COLUMN_WEBSITE]);
493487
}
494-
if (!empty($rowData[self::COLUMN_DISABLE_AUTO_GROUP_CHANGE])) {
495-
$entityRow[self::COLUMN_DISABLE_AUTO_GROUP_CHANGE] = $rowData[self::COLUMN_DISABLE_AUTO_GROUP_CHANGE];
488+
if (!empty($rowData[$COLUMN_DISABLE_AUTO_GROUP_CHANGE])) {
489+
$entityRow[$COLUMN_DISABLE_AUTO_GROUP_CHANGE] = $rowData[$COLUMN_DISABLE_AUTO_GROUP_CHANGE];
496490
}
497491
$entitiesToUpdate[] = $entityRow;
498492
}
499-
500493
return [
501494
self::ENTITIES_TO_CREATE_KEY => $entitiesToCreate,
502495
self::ENTITIES_TO_UPDATE_KEY => $entitiesToUpdate,

0 commit comments

Comments
 (0)