From b3780c719c8b7699f5f8d182ac42a417be5583ce Mon Sep 17 00:00:00 2001 From: Alastair Mucklow Date: Wed, 22 Nov 2023 14:39:53 +0000 Subject: [PATCH 1/2] Merged PR 49720: Handle company status not matching expected values ## What's being changed Our CustomerPlugin. ## Why it's being changed Our code was looking for a match between the company status of the contact being synced, and [a limited set of statuses](https://github.com/dotmailer/dotmailer-magento2-extension-b2b/blob/master/Helper/ConfigInterface.php#L64-L69). These are based on values defined in `Magento\Company\Api\Data\CompanyInterface`, but evidently there can be variations. This PR will sync either a matching status, if we can find one, or if not, the status as it comes to us. ## How to review / test this change - Enable B2B in your Magento - Create a company - Create a customer - Assign the customer to the company - Map the 'company status' data field - Run customer sync - Check the export, and see a company status synced as expected - Hack the code and test if `$company->getStatus()` returns null, or is a value not included in our array of statuses Related work items: #234247 --- Plugin/CustomerPlugin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugin/CustomerPlugin.php b/Plugin/CustomerPlugin.php index 64ecafd..8043df4 100644 --- a/Plugin/CustomerPlugin.php +++ b/Plugin/CustomerPlugin.php @@ -87,7 +87,9 @@ public function beforeSetContactData(Customer $subject) if ($company = $this->helper->getCompanyForCustomer($customer)) { $customer->setCompany($company->getCompanyName()); - $customer->setCompanyStatus(ConfigInterface::COMPANY_STATUS_LABELS[$company->getStatus()]); + $customer->setCompanyStatus( + ConfigInterface::COMPANY_STATUS_LABELS[$company->getStatus()] ?? $company->getStatus() + ); $customer->setCustomerType( $this->isCompanyAdmin($customer, $company) ? ConfigInterface::CUSTOMER_TYPE_COMPANY_ADMIN From ac3679fafb91ef63b529c2127d24759351e192fc Mon Sep 17 00:00:00 2001 From: Fanis Strezos Date: Tue, 28 Nov 2023 09:55:23 +0000 Subject: [PATCH 2/2] Merged PR 49857: 1.8.1 pre-release 1.8.1 pre-release Related work items: #235159 --- README.md | 5 +++++ composer.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2da4c27..2fa37f7 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,11 @@ composer require dotdigital/dotdigital-magento2-extension-b2b ## Changelog +### 1.8.1 + +##### Improvements +- Our CustomerPlugin does not now require company statuses to match fixed values. + ### 1.8.0 ##### What's new diff --git a/composer.json b/composer.json index 42697d8..25dec0a 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "dotdigital/dotdigital-magento2-extension-b2b", "description": "Dotdigital for Adobe Commerce: B2B module", "type": "magento2-module", - "version": "1.8.0", + "version": "1.8.1", "license": "MIT", "repositories": [ {