From f77294b6d296f0e7fb17881d7682299806a33754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= Date: Mon, 4 Sep 2017 15:51:40 +0300 Subject: [PATCH] v.2.2.2 (#27) --- CHANGELOG.md | 9 +++- .../classes/general/user/RetailCrmUser.php | 51 ++++++++++++++++--- intaro.retailcrm/description.ru | 5 +- intaro.retailcrm/install/index.php | 23 ++++----- intaro.retailcrm/install/version.php | 5 +- 5 files changed, 65 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51671515..f9fd91e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,18 @@ -## 2017-08-21 v.2.2.1 +## 2017-09-04 v.2.2.2 +* Исправлен инсталлятор +* Изменена передача данных по пользователю + +## 2017-09-01 v.2.2.1 * Добавлена встроенная функция retailCrmApiResult * Добавлен триггерный вариант истории изменений * Исправлены ошибки + ## 2017-08-21 v.2.2.0 * API V5 * Возможность выбора версии API * Добавлена возможность выгрузки остатков в разрезе складов * Добавлена возможность выгрузки типов цен -* Добавлена базовая интеграция Demon Collector +* Добавлена базовая интеграция Daemon Collector * Добавлена интеграция с Universal Analytics * Доработана логика работы встроенных функций для модификации данных * Исправлены ошибки diff --git a/intaro.retailcrm/classes/general/user/RetailCrmUser.php b/intaro.retailcrm/classes/general/user/RetailCrmUser.php index a1188d46..020ef78c 100644 --- a/intaro.retailcrm/classes/general/user/RetailCrmUser.php +++ b/intaro.retailcrm/classes/general/user/RetailCrmUser.php @@ -14,20 +14,38 @@ class RetailCrmUser $customer = array( 'externalId' => $arFields['ID'], - 'firstName' => $arFields['NAME'], - 'lastName' => $arFields['LAST_NAME'], - 'patronymic' => $arFields['SECOND_NAME'], 'email' => $arFields['EMAIL'], - 'address' => array('city' => $arFields['PERSONAL_CITY'], 'text' => $arFields['PERSONAL_STREET'], 'index' => $arFields['PERSONAL_ZIP']), 'createdAt' => new \DateTime($arFields['DATE_REGISTER']), 'contragentType' => $contragentType ); + + if (!empty($arFields['NAME'])) { + $customer['firstName'] = $arFields['NAME']; + } + if (!empty($arFields['LAST_NAME'])) { + $customer['lastName'] = $arFields['LAST_NAME']; + } + if (!empty($arFields['SECOND_NAME'])) { + $customer['patronymic'] = $arFields['SECOND_NAME']; + } + if (!empty($arFields['PERSONAL_PHONE'])) { $customer['phones'][]['number'] = $arFields['PERSONAL_PHONE']; } if (!empty($arFields['WORK_PHONE'])) { $customer['phones'][]['number'] = $arFields['WORK_PHONE']; } + + if (!empty($arFields['PERSONAL_CITY'])) { + $customer['address']['city'] = $arFields['PERSONAL_CITY']; + } + if (!empty($arFields['PERSONAL_STREET'])) { + $customer['address']['text'] = $arFields['PERSONAL_STREET']; + } + if (!empty($arFields['PERSONAL_ZIP'])) { + $customer['address']['index'] = $arFields['PERSONAL_ZIP']; + } + if ($send && isset($_COOKIE['_rc']) && $_COOKIE['_rc'] != '') { $customer['browserId'] = $_COOKIE['_rc']; } @@ -66,12 +84,19 @@ class RetailCrmUser $customer = array( 'externalId' => $arFields['ID'], - 'firstName' => $arFields['NAME'], - 'lastName' => $arFields['LAST_NAME'], - 'patronymic' => $arFields['SECOND_NAME'], 'email' => $arFields['EMAIL'], - 'address' => array('city' => $arFields['PERSONAL_CITY'], 'text' => $arFields['PERSONAL_STREET'], 'index' => $arFields['PERSONAL_ZIP']), ); + + if (!empty($arFields['NAME'])) { + $customer['firstName'] = $arFields['NAME']; + } + if (!empty($arFields['LAST_NAME'])) { + $customer['lastName'] = $arFields['LAST_NAME']; + } + if (!empty($arFields['SECOND_NAME'])) { + $customer['patronymic'] = $arFields['SECOND_NAME']; + } + if (!empty($arFields['PERSONAL_PHONE'])) { $customer['phones'][]['number'] = $arFields['PERSONAL_PHONE']; } @@ -79,6 +104,16 @@ class RetailCrmUser $customer['phones'][]['number'] = $arFields['WORK_PHONE']; } + if (!empty($arFields['PERSONAL_CITY'])) { + $customer['address']['city'] = $arFields['PERSONAL_CITY']; + } + if (!empty($arFields['PERSONAL_STREET'])) { + $customer['address']['text'] = $arFields['PERSONAL_STREET']; + } + if (!empty($arFields['PERSONAL_ZIP'])) { + $customer['address']['index'] = $arFields['PERSONAL_ZIP']; + } + $found = false; if (count($optionsSitesList) > 0) { foreach ($optionsSitesList as $site) { diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 6d13e466..78aa0d69 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1,3 +1,2 @@ -- Добавлена встроенная функция retailCrmApiResult -- Добавлен триггерный вариант истории изменений -- Исправлены ошибки \ No newline at end of file +- Исправлен инсталлятор +- Изменена передача данных по пользователю \ No newline at end of file diff --git a/intaro.retailcrm/install/index.php b/intaro.retailcrm/install/index.php index ef7f2ab4..7435a771 100644 --- a/intaro.retailcrm/install/index.php +++ b/intaro.retailcrm/install/index.php @@ -256,7 +256,7 @@ class intaro_retailcrm extends CModule $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step11.php' ); - } else if ($step == 2) {//доставки, оплаты, типы заказов + } else if ($step == 2) { if (!CModule::IncludeModule("sale")) { $arResult['errCode'] = 'ERR_SALE'; } @@ -330,6 +330,7 @@ class intaro_retailcrm extends CModule return; } + $this->RETAIL_CRM_API = new \RetailCrm\ApiClient($api_host, $api_key); COption::SetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, $api_host); COption::SetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, $api_key); } @@ -388,7 +389,7 @@ class intaro_retailcrm extends CModule $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step2.php' ); - } elseif ($step == 3) {//сопостовление свойств заказа + } elseif ($step == 3) { if (!CModule::IncludeModule("sale")) { $arResult['errCode'] = 'ERR_SALE'; } @@ -416,12 +417,12 @@ class intaro_retailcrm extends CModule //bitrix deliveryTypesList $arResult['bitrixDeliveryTypesList'] = RCrmActions::DeliveryList(); - if (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'false') {//сами настраиваем доставки + if (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'false') { $deliveryTypesArr = array(); foreach ($arResult['bitrixDeliveryTypesList'] as $delivery) { $deliveryTypesArr[$delivery['ID']] = htmlspecialchars(trim($_POST['delivery-type-' . $delivery['ID']])); } - } elseif (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'true') {//отправка доставок в црм + } elseif (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'true') { // send to intaro crm and save delivery types! $arDeliveryServiceAll = \Bitrix\Sale\Delivery\Services\Manager::getActiveList(); foreach ($arResult['bitrixDeliveryTypesList'] as $deliveryType) { @@ -522,7 +523,7 @@ class intaro_retailcrm extends CModule $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step3.php' ); - } elseif ($step == 4) {//выгрузка старых заказов + } elseif ($step == 4) { if (!CModule::IncludeModule("sale")) { $arResult['errCode'] = 'ERR_SALE'; } @@ -604,7 +605,7 @@ class intaro_retailcrm extends CModule } //contragents type list - $contragentTypeArr = array();//сделать проверки + $contragentTypeArr = array(); foreach ($orderTypesList as $orderType) { $contragentTypeArr[$orderType['ID']] = htmlspecialchars(trim($_POST['contragent-type-' . $orderType['ID']])); } @@ -618,7 +619,7 @@ class intaro_retailcrm extends CModule GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step4.php' ); - } elseif ($step == 5) {//экспорт каталога + } elseif ($step == 5) { if (!CModule::IncludeModule("iblock")) { $arResult['errCode'] = 'ERR_IBLOCK'; } @@ -695,7 +696,7 @@ class intaro_retailcrm extends CModule $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step5.php' ); - } elseif ($step == 6) {//регистрация модуля + } elseif ($step == 6) { if (!CModule::IncludeModule("iblock")) { $arResult['errCode'] = 'ERR_IBLOCK'; } @@ -809,9 +810,7 @@ class intaro_retailcrm extends CModule RegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "orderSave"); RegisterModuleDependences("sale", "OnSaleOrderEntityDelete", $this->MODULE_ID, "RetailCrmEvent", "orderDelete"); - COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types']))); - //COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_IBLOCKS, $iblocks); - + COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types']))); COption::SetOptionString($this->MODULE_ID, $this->CRM_INVENTORIES_UPLOAD, 'N'); COption::SetOptionString($this->MODULE_ID, $this->CRM_PRICES_UPLOAD, 'N'); COption::SetOptionString($this->MODULE_ID, $this->CRM_COLLECTOR, 'N'); @@ -985,7 +984,7 @@ class intaro_retailcrm extends CModule COption::RemoveOption($this->MODULE_ID, $this->CRM_CUSTOMER_HISTORY); COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_HISTORY); COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE); - //COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_IBLOCKS); + COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_NUMBERS); COption::RemoveOption($this->MODULE_ID, $this->CRM_CANSEL_ORDER); diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index bb592d04..23500bda 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,5 @@ "2.2.1", - "VERSION_DATE" => "2017-09-01 12:00:00" + "VERSION" => "2.2.2", + "VERSION_DATE" => "2017-09-04 12:00:00" ); -