Skip to content

Commit b8ea3a1

Browse files
committed
Merge remote-tracking branch 'origin/AC-7039' into spartans_pr_13062023
2 parents 1c65707 + 3aa4295 commit b8ea3a1

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
namespace Magento\CustomerImportExport\Model\Import;
99

1010
use Magento\Customer\Api\Data\CustomerInterface;
11-
use Magento\ImportExport\Model\Import;
12-
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
13-
use Magento\ImportExport\Model\Import\AbstractSource;
1411
use Magento\Customer\Model\Indexer\Processor;
1512
use Magento\Framework\App\ObjectManager;
13+
use Magento\ImportExport\Model\Import;
14+
use Magento\ImportExport\Model\Import\AbstractSource;
15+
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
1616

1717
/**
1818
* Customer entity import
@@ -162,6 +162,7 @@ class Customer extends AbstractCustomer
162162
'failures_num',
163163
'first_failure',
164164
'lock_expires',
165+
CustomerInterface::DISABLE_AUTO_GROUP_CHANGE,
165166
];
166167

167168
/**
@@ -413,7 +414,6 @@ protected function _prepareDataForUpdate(array $rowData)
413414
} else {
414415
$createdAt = (new \DateTime())->setTimestamp(strtotime($rowData['created_at']));
415416
}
416-
417417
$emailInLowercase = strtolower(trim($rowData[self::COLUMN_EMAIL]));
418418
$newCustomer = false;
419419
$entityId = $this->_getCustomerId($emailInLowercase, $rowData[self::COLUMN_WEBSITE]);
@@ -448,7 +448,6 @@ protected function _prepareDataForUpdate(array $rowData)
448448
$value = (new \DateTime())->setTimestamp(strtotime($value));
449449
$value = $value->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
450450
}
451-
452451
if (!$this->_attributes[$attributeCode]['is_static']) {
453452
/** @var $attribute \Magento\Customer\Model\Attribute */
454453
$attribute = $this->_customerModel->getAttribute($attributeCode);
@@ -488,9 +487,12 @@ protected function _prepareDataForUpdate(array $rowData)
488487
} else {
489488
$entityRow['store_id'] = $this->getCustomerStoreId($emailInLowercase, $rowData[self::COLUMN_WEBSITE]);
490489
}
490+
if (!empty($rowData[CustomerInterface::DISABLE_AUTO_GROUP_CHANGE])) {
491+
$entityRow[CustomerInterface::DISABLE_AUTO_GROUP_CHANGE] =
492+
$rowData[CustomerInterface::DISABLE_AUTO_GROUP_CHANGE];
493+
}
491494
$entitiesToUpdate[] = $entityRow;
492495
}
493-
494496
return [
495497
self::ENTITIES_TO_CREATE_KEY => $entitiesToCreate,
496498
self::ENTITIES_TO_UPDATE_KEY => $entitiesToUpdate,

dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ public function testImportData()
157157
$updatedCustomer->getCreatedAt(),
158158
'Creation date must be changed'
159159
);
160+
$this->assertNotEquals(
161+
$existingCustomer->getDisableAutoGroupChange(),
162+
$updatedCustomer->getDisableAutoGroupChange(),
163+
'Disable automatic group change based on VAT ID must be changed'
164+
);
160165
$this->assertEquals(
161166
$existingCustomer->getGender(),
162167
$updatedCustomer->getGender(),
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
email,_website,_store,confirmation,created_at,created_in,default_billing,default_shipping,disable_auto_group_change,dob,firstname,gender,group_id,lastname,middlename,password_hash,prefix,rp_token,rp_token_created_at,store_id,suffix,taxvat,website_id,password
22
AnthonyANealy@magento.com,base,admin,,5/6/2012 15:53,Admin,1,1,0,5/6/2010,Anthony,Female,1,Nealy,A.,6a9c9bfb2ba88a6ad2a64e7402df44a763e0c48cd21d7af9e7e796cd4677ee28:RF,,,,0,,,1,
33
LoriBBanks@magento.com,admin,admin,,5/6/2012 15:59,Admin,3,3,0,5/6/2010,Lori,Female,1,Banks,B.,7ad6dbdc83d3e9f598825dc58b84678c7351e4281f6bc2b277a32dcd88b9756b:pz,,,,0,,,0,
4-
CharlesTAlston@teleworm.us,base,admin,,5/6/2012 16:13,Admin,4,4,0,,Jhon,Female,1,Doe,T.,145d12bfff8a6a279eb61e277e3d727c0ba95acc1131237f1594ddbb7687a564:l1,,,,0,,,2,
4+
CharlesTAlston@teleworm.us,base,admin,,5/6/2012 16:13,Admin,4,4,1,,Jhon,Female,1,Doe,T.,145d12bfff8a6a279eb61e277e3d727c0ba95acc1131237f1594ddbb7687a564:l1,,,,0,,,2,
55
customer@example.com,base,admin,,5/6/2012 16:15,Admin,4,4,0,,Firstname,Female,1,Lastname,T.,145d12bfff8a6a279eb61e277e3d727c0ba95acc1131237f1594ddbb7687a564:l1,,,,0,,,2,
66
julie.worrell@example.com,base,admin,,5/6/2012 16:19,Admin,4,4,0,,Julie,Female,1,Worrell,T.,145d12bfff8a6a279eb61e277e3d727c0ba95acc1131237f1594ddbb7687a564:l1,,,,0,,,2,
77
david.lamar@example.com,base,admin,,5/6/2012 16:25,Admin,4,4,0,,David,,1,Lamar,T.,145d12bfff8a6a279eb61e277e3d727c0ba95acc1131237f1594ddbb7687a564:l1,,,,0,,,2,

0 commit comments

Comments
 (0)