diff --git a/intaro.retailcrm/classes/general/CustomerBuilder.php b/intaro.retailcrm/classes/general/CustomerBuilder.php index 39a25489..f9b71c7e 100644 --- a/intaro.retailcrm/classes/general/CustomerBuilder.php +++ b/intaro.retailcrm/classes/general/CustomerBuilder.php @@ -202,8 +202,8 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa } // клиент подписан при значении равном null - if (array_key_exists('subscribed', $this->dataCrm)) { - if (empty($this->dataCrm['subscribed'])) { + if (array_key_exists('emailMarketingUnsubscribedAt', $this->dataCrm)) { + if (empty($this->dataCrm['emailMarketingUnsubscribedAt'])) { $this->customer->setSubscribe('Y'); } else { $this->customer->setSubscribe('N'); diff --git a/intaro.retailcrm/classes/general/config/objects.xml b/intaro.retailcrm/classes/general/config/objects.xml index b3c3df33..4b4ac958 100644 --- a/intaro.retailcrm/classes/general/config/objects.xml +++ b/intaro.retailcrm/classes/general/config/objects.xml @@ -15,7 +15,7 @@ cumulativeDiscount personalDiscount discountCardNumber - subscribed + emailMarketingUnsubscribedAt index countryIso diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php index 40c00f8a..b49df5a0 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php @@ -156,6 +156,11 @@ class RetailCrmHistory if ($registerNewUser === true) { $customerBuilder->buildPassword(); $customerArray = $customerBuilder->getCustomer()->getObjectToArray(); + + if (!array_key_exists('UF_SUBSCRIBE_USER_EMAIL', $customerArray)) { + $customerArray['UF_SUBSCRIBE_USER_EMAIL'] = 'Y'; + } + $registeredUserID = $newUser->Add(self::convertBooleanFields($customerArray)); if ($registeredUserID === false) {