From ab2f363db04a63d41cc537949d2161cb8f2542ac Mon Sep 17 00:00:00 2001 From: tishevgeniy Date: Tue, 13 Dec 2016 14:01:48 +0300 Subject: [PATCH] v.2.1.2 --- CHANGELOG.md | 7 +++++++ .../classes/general/RCrmActions.php | 4 +++- .../classes/general/config/retailcrm.json | 12 +++++++++++ .../general/history/RetailCrmHistory.php | 16 ++++++++++++--- .../classes/general/icml/RetailCrmICML.php | 17 +++++++++++++++- intaro.retailcrm/description.ru | 8 ++++++-- intaro.retailcrm/include.php | 20 +++++++++---------- intaro.retailcrm/install/index.php | 2 -- intaro.retailcrm/install/version.php | 4 ++-- 9 files changed, 69 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdd9e725..ac636398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2016-12-09 v.2.1.2 +* Добавлены единицы измерения в экспорте каталога +* Исправлены пути в include +* Добавлено время нового формата в валидатор +* Исправлено неверное изменение типа заказа по истории +* Исправлена ошибка с некорректным разбиением ФИО +* Небольшие исправления по коду ## 2016-11-15 v.2.1.1 * Исправлена проблема с отсутствием в настройках доставок * Небольшие исправления diff --git a/intaro.retailcrm/classes/general/RCrmActions.php b/intaro.retailcrm/classes/general/RCrmActions.php index 2f751d03..6ab6be1d 100644 --- a/intaro.retailcrm/classes/general/RCrmActions.php +++ b/intaro.retailcrm/classes/general/RCrmActions.php @@ -199,7 +199,9 @@ class RCrmActions public static function explodeFIO($fio) { + $fio = preg_replace('|[\s]+|s', ' ', trim($fio)); $newFio = empty($fio) ? false : explode(" ", $fio, 3); + $result = array(); switch (count($newFio)) { default: @@ -263,7 +265,7 @@ class RCrmActions try { $result = $api->$methodApi($params, $site); if (isset($result['errorMsg'])) { - if ($methodApi != 'customersUpload') { + if ($methodApi != 'customersUpload' && $methodApi != 'ordersUpload') { self::eventLog(__CLASS__.'::'.$method, 'RetailCrm\ApiClient::'.$methodApi, $result['errorMsg']); } $log = new Logger(); diff --git a/intaro.retailcrm/classes/general/config/retailcrm.json b/intaro.retailcrm/classes/general/config/retailcrm.json index c0bf4f78..cace223f 100644 --- a/intaro.retailcrm/classes/general/config/retailcrm.json +++ b/intaro.retailcrm/classes/general/config/retailcrm.json @@ -132,6 +132,9 @@ }, "managerId": { "type": "int" + }, + "browserId": { + "type": "string" } }, "orders": { @@ -383,6 +386,15 @@ }, "shipmentStore": { "type": "string" + }, + "from": { + "type": "skip" + }, + "to": { + "type": "skip" + }, + "custom": { + "type": "string" } } } \ No newline at end of file diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory.php index 14daddfe..64eef64e 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory.php @@ -256,7 +256,7 @@ class RetailCrmHistory $api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0); $api_key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_KEY_OPTION, 0); - $optionsOrderTypes = array_flip(unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_TYPES_ARR, 0))); + $optionsOrderTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_TYPES_ARR, 0)); $optionsDelivTypes = array_flip(unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_DELIVERY_TYPES_ARR, 0))); $optionsPayTypes = array_flip(unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0))); $optionsPayStatuses = array_flip(unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0))); // --statuses @@ -449,11 +449,21 @@ class RetailCrmHistory $site = CSite::GetDefSite(); } - if ($optionsOrderNumbers == 'Y' && isset($order['number'])) { + if ($optionsOrderNumbers == 'Y' && isset($order['number'])) { $newOrder->setField('ACCOUNT_NUMBER', $order['number']); - } + } $personType = $newOrder->getField('PERSON_TYPE_ID'); + + $nType = array(); + $tList = RCrmActions::OrderTypesList(array(array('LID' => $site))); + foreach($tList as $type){ + if (isset($optionsOrderTypes[$type['ID']])) { + $nType[$optionsOrderTypes[$type['ID']]] = $type['ID']; + } + } + $optionsOrderTypes = $nType; + if ($optionsOrderTypes[$order['orderType']]) { if ($personType != $optionsOrderTypes[$order['orderType']] && $personType != 0) { $propsRemove = true; diff --git a/intaro.retailcrm/classes/general/icml/RetailCrmICML.php b/intaro.retailcrm/classes/general/icml/RetailCrmICML.php index 0fc350e3..bdf78f4a 100644 --- a/intaro.retailcrm/classes/general/icml/RetailCrmICML.php +++ b/intaro.retailcrm/classes/general/icml/RetailCrmICML.php @@ -45,6 +45,13 @@ class RetailCrmICML 'g' => 'g', 'kg' => 'g', ); + + protected $measure = array ( + 'pc. 1' => 'pc', + 'm' => 'm', + 'l' => 'l', + 'kg' => 'kg', + ); public function Load() { @@ -55,7 +62,7 @@ class RetailCrmICML $this->isLogged = true; - $defaultSite = CSite::GetList($by="def", $order="desc", Array('DEF' => 'Y'))->Fetch(); + $defaultSite = CSite::GetList($by = "def", $order = "desc", array('DEF' => 'Y'))->Fetch(); $this->encodingDefault = $defaultSite["CHARSET"]; $url = 'https://' . $this->serverName; @@ -540,6 +547,14 @@ class RetailCrmICML } } } + if (isset($arOffer["MEASURE"]['SYMBOL_INTL'])) { + if ($this->measure[$arOffer["MEASURE"]['SYMBOL_INTL']]) { + $offer .= '' . "\n"; + } else { + $offer .= '' . "\n"; + } + + } $offer.= "\n"; diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index ab6fa3e9..d926d8b7 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1,2 +1,6 @@ -- Исправлена проблема с отсутствием в настройках доставок -- Небольшие исправления \ No newline at end of file +- Добавлены единицы измерения в экспорте каталога +- Исправлены пути в include +- Добавлено время нового формата в валидатор +- Исправлено неверное изменение типа заказа по истории +- Исправлена ошибка с некорректным разбиением ФИО +- Небольшие исправления по коду \ No newline at end of file diff --git a/intaro.retailcrm/include.php b/intaro.retailcrm/include.php index af464738..51da9407 100644 --- a/intaro.retailcrm/include.php +++ b/intaro.retailcrm/include.php @@ -4,16 +4,16 @@ $server = \Bitrix\Main\Context::getCurrent()->getServer()->getDocumentRoot(); CModule::AddAutoloadClasses( 'intaro.retailcrm', // module name array ( - 'RestNormalizer' => file_exists($server . '/bitrix/php_interface/retailcrm/RestNormalizer.php') ? $server . '/bitrix/php_interface/retailcrm/RestNormalizer.php' : 'classes/general/RestNormalizer.php', - 'Logger' => file_exists($server . '/bitrix/php_interface/retailcrm/Logger.php') ? $server . '/bitrix/php_interface/retailcrm/Logger.php' : 'classes/general/Logger.php', - 'RetailCrm\ApiClient' => file_exists($server . '/bitrix/php_interface/retailcrm/ApiClient.php') ? $server . '/bitrix/php_interface/retailcrm/ApiClient.php' : 'classes/general/ApiClient.php', - 'RetailCrm\Http\Client' => file_exists($server . '/bitrix/php_interface/retailcrm/Client.php') ? $server . '/bitrix/php_interface/retailcrm/Client.php' : 'classes/general/Http/Client.php', - 'RCrmActions' => file_exists($server . '/bitrix/php_interface/retailcrm/RCrmActions.php') ? $server . '/bitrix/php_interface/retailcrm/RCrmActions.php' : 'classes/general/RCrmActions.php', - 'RetailCrmUser' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmUser.php') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmUser.php' : 'classes/general/user/RetailCrmUser.php', - 'RetailCrmOrder' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmOrder.php') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmOrder.php' : 'classes/general/order/RetailCrmOrder.php', - 'RetailCrmHistory' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmHistory.php') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmHistory.php' : 'classes/general/history/RetailCrmHistory.php', - 'RetailCrmICML' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmICML.php') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmICML.php' : 'classes/general/icml/RetailCrmICML.php', - 'RetailCrmEvent' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmEvent.php') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmEvent.php' : 'classes/general/events/RetailCrmEvent.php', + 'RestNormalizer' => file_exists($server . '/bitrix/php_interface/retailcrm/RestNormalizer.php') ? '../../php_interface/retailcrm/RestNormalizer.php' : 'classes/general/RestNormalizer.php', + 'Logger' => file_exists($server . '/bitrix/php_interface/retailcrm/Logger.php') ? '../../php_interface/retailcrm/Logger.php' : 'classes/general/Logger.php', + 'RetailCrm\ApiClient' => file_exists($server . '/bitrix/php_interface/retailcrm/ApiClient.php') ? '../../php_interface/retailcrm/ApiClient.php' : 'classes/general/ApiClient.php', + 'RetailCrm\Http\Client' => file_exists($server . '/bitrix/php_interface/retailcrm/Client.php') ? '../../php_interface/retailcrm/Client.php' : 'classes/general/Http/Client.php', + 'RCrmActions' => file_exists($server . '/bitrix/php_interface/retailcrm/RCrmActions.php') ? '../../php_interface/retailcrm/RCrmActions.php' : 'classes/general/RCrmActions.php', + 'RetailCrmUser' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmUser.php') ? '../../php_interface/retailcrm/RetailCrmUser.php' : 'classes/general/user/RetailCrmUser.php', + 'RetailCrmOrder' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmOrder.php') ? '../../php_interface/retailcrm/RetailCrmOrder.php' : 'classes/general/order/RetailCrmOrder.php', + 'RetailCrmHistory' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmHistory.php') ? '../../php_interface/retailcrm/RetailCrmHistory.php' : 'classes/general/history/RetailCrmHistory.php', + 'RetailCrmICML' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmICML.php') ? '../../php_interface/retailcrm/RetailCrmICML.php' : 'classes/general/icml/RetailCrmICML.php', + 'RetailCrmEvent' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmEvent.php') ? '../../php_interface/retailcrm/RetailCrmEvent.php' : 'classes/general/events/RetailCrmEvent.php', 'RetailCrm\Response\ApiResponse' => 'classes/general/Response/ApiResponse.php', 'RetailCrm\Exception\InvalidJsonException' => 'classes/general/Exception/InvalidJsonException.php', 'RetailCrm\Exception\CurlException' => 'classes/general/Exception/CurlException.php', diff --git a/intaro.retailcrm/install/index.php b/intaro.retailcrm/install/index.php index b4098a88..1e3b15b8 100644 --- a/intaro.retailcrm/install/index.php +++ b/intaro.retailcrm/install/index.php @@ -1197,8 +1197,6 @@ class intaro_retailcrm extends CModule $e->getCode() . ': ' . $e->getMessage() ); } - // in fin order - COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_HISTORY_DATE, date('Y-m-d H:i:s')); $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step6.php' diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index 88c1c478..cb5e7d79 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ "2.1.1", - "VERSION_DATE" => "2016-11-15 17:00:00" + "VERSION" => "2.1.2", + "VERSION_DATE" => "2016-12-09 17:00:00" );