From 169509c263324a7f93e6f023f7f6a2c72055ff3a Mon Sep 17 00:00:00 2001 From: Rinacoder <74737743+Rinacoder@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:10:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87?= =?UTF-8?q?=D0=B0=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=BF=D0=BE=20=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=B0?= =?UTF-8?q?=D0=BC,=20=D0=BE=D1=82=D1=81=D1=83=D1=82=D1=81=D1=82=D0=B2?= =?UTF-8?q?=D1=83=D1=8E=D1=89=D0=B8=D0=BC=20=D0=B2=20Bitrix=20(#360)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++ .../classes/general/CustomerBuilder.php | 30 +++++++++++++++++++ intaro.retailcrm/description.ru | 2 +- intaro.retailcrm/install/version.php | 4 +-- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a345c860..d58c0b32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2024-09-02 v.6.5.27 +- Исправлена передача изменений по клиентам, отсутствующим в Bitrix + ## 2024-08-26 v.6.5.26 - Исправлено удаление модуля diff --git a/intaro.retailcrm/classes/general/CustomerBuilder.php b/intaro.retailcrm/classes/general/CustomerBuilder.php index e5a38f3b..cbc9ec47 100644 --- a/intaro.retailcrm/classes/general/CustomerBuilder.php +++ b/intaro.retailcrm/classes/general/CustomerBuilder.php @@ -221,6 +221,36 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa $this->customer->setSubscribe('N'); } } + + if (empty($this->dataCrm['externalId']) + && (empty($this->dataCrm['firstName']) + || empty($this->dataCrm['email'])) + ) { + $api = new RetailCrm\ApiClient(RetailcrmConfigProvider::getApiUrl(), RetailcrmConfigProvider::getApiKey()); + $customerResponse = RCrmActions::apiMethod($api, 'customersGetById', __METHOD__, $this->dataCrm['id']); + + if ($customerResponse instanceof RetailCrm\Response\ApiResponse + && $customerResponse->isSuccessful() + && !empty($customerResponse['customer']) + ) { + $crmCustomer = $customerResponse['customer']; + + if (empty($this->dataCrm['email']) + && !empty($crmCustomer['email']) + ) { + $email = $crmCustomer['email']; + + $this->customer->setEmail($this->fromJSON($email)); + $this->customer->setLogin($email); + } + + if (empty($this->dataCrm['firstName']) + && !empty($crmCustomer['firstName']) + ) { + $this->customer->setName($this->fromJSON($crmCustomer['firstName'])); + } + } + } } public function buildPassword() diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 959a8696..1c768582 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1 +1 @@ -- Исправлено удаление модуля +- Исправлена передача изменений по клиентам, отсутствующим в Bitrix diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index e61759e1..fc91b9aa 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ '6.5.26', - 'VERSION_DATE' => '2024-08-26 17:30:00' + 'VERSION' => '6.5.27', + 'VERSION_DATE' => '2024-09-02 10:00:00' ];