diff --git a/vendor/magento/module-company/Model/Company/Delete.php b/vendor/magento/module-company/Model/Company/Delete.php index d190977d5862..11cc2aa2175a 100644 --- a/vendor/magento/module-company/Model/Company/Delete.php +++ b/vendor/magento/module-company/Model/Company/Delete.php @@ -21,6 +21,8 @@ /** * Class for deleting a company entity. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Delete { @@ -150,6 +152,7 @@ private function detachCustomerFromCompany($customerId) $companyAttributes = $customer->getExtensionAttributes()->getCompanyAttributes(); $companyAttributes->setCompanyId($this->noCompanyId); $companyAttributes->setStatus(CompanyCustomerInterface::STATUS_INACTIVE); + $customer->setData('ignore_validation_flag', true); $this->customerRepository->save($customer); } } diff --git a/vendor/magento/module-company/Model/CompanySuperUserGet.php b/vendor/magento/module-company/Model/CompanySuperUserGet.php index 6be15b5f7c16..40eec97aaa46 100644 --- a/vendor/magento/module-company/Model/CompanySuperUserGet.php +++ b/vendor/magento/module-company/Model/CompanySuperUserGet.php @@ -164,6 +164,7 @@ public function getUserForCompanyAdmin(array $data): CustomerInterface $companyAttributes->setStatus($customerStatus); } if ($customer->getId()) { + $customer->setData('ignore_validation_flag', true); $customer = $this->customerRepository->save($customer); } else { if (!$customer->getCreatedIn()) { diff --git a/vendor/magento/module-company/Model/SaveHandler/CustomerGroup.php b/vendor/magento/module-company/Model/SaveHandler/CustomerGroup.php index a49470c67065..850bb7f8a3f5 100644 --- a/vendor/magento/module-company/Model/SaveHandler/CustomerGroup.php +++ b/vendor/magento/module-company/Model/SaveHandler/CustomerGroup.php @@ -39,7 +39,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\LocalizedException * @throws \Magento\Framework\Exception\State\InputMismatchException @@ -52,6 +52,7 @@ public function execute(CompanyInterface $company, CompanyInterface $initialComp foreach ($customerIds as $customerId) { $customer = $this->customerRepository->getById($customerId); $customer->setGroupId($company->getCustomerGroupId()); + $customer->setData('ignore_validation_flag', true); $this->customerRepository->save($customer); } } diff --git a/vendor/magento/module-company/Model/SaveHandler/SuperUser.php b/vendor/magento/module-company/Model/SaveHandler/SuperUser.php index a510b3083b3b..74a9df1ef044 100644 --- a/vendor/magento/module-company/Model/SaveHandler/SuperUser.php +++ b/vendor/magento/module-company/Model/SaveHandler/SuperUser.php @@ -65,6 +65,7 @@ public function execute(CompanyInterface $company, CompanyInterface $initialComp $admin->getExtensionAttributes()->setCompanyAttributes($companyAttributes); } $admin->getExtensionAttributes()->getCompanyAttributes()->setCompanyId($company->getId()); + $admin->setData('ignore_validation_flag', true); $this->customerRepository->save($admin); $initialAdmin = $initialCompany->getSuperUserId() ? $this->customerRepository->getById($initialCompany->getSuperUserId()) : null;