1
0
mirror of synced 2025-01-31 23:31:41 +03:00

Merge pull request #24 from ghostrainman/master

v.2.1.2
This commit is contained in:
Alex Lushpai 2016-12-27 13:19:26 +03:00 committed by GitHub
commit 02dc926ea3
9 changed files with 69 additions and 21 deletions

View File

@ -1,3 +1,10 @@
## 2016-12-09 v.2.1.2
* Добавлены единицы измерения в экспорте каталога
* Исправлены пути в include
* Добавлено время нового формата в валидатор
* Исправлено неверное изменение типа заказа по истории
* Исправлена ошибка с некорректным разбиением ФИО
* Небольшие исправления по коду
## 2016-11-15 v.2.1.1 ## 2016-11-15 v.2.1.1
* Исправлена проблема с отсутствием в настройках доставок * Исправлена проблема с отсутствием в настройках доставок
* Небольшие исправления * Небольшие исправления

View File

@ -199,7 +199,9 @@ class RCrmActions
public static function explodeFIO($fio) public static function explodeFIO($fio)
{ {
$fio = preg_replace('|[\s]+|s', ' ', trim($fio));
$newFio = empty($fio) ? false : explode(" ", $fio, 3); $newFio = empty($fio) ? false : explode(" ", $fio, 3);
$result = array(); $result = array();
switch (count($newFio)) { switch (count($newFio)) {
default: default:
@ -263,7 +265,7 @@ class RCrmActions
try { try {
$result = $api->$methodApi($params, $site); $result = $api->$methodApi($params, $site);
if (isset($result['errorMsg'])) { if (isset($result['errorMsg'])) {
if ($methodApi != 'customersUpload') { if ($methodApi != 'customersUpload' && $methodApi != 'ordersUpload') {
self::eventLog(__CLASS__.'::'.$method, 'RetailCrm\ApiClient::'.$methodApi, $result['errorMsg']); self::eventLog(__CLASS__.'::'.$method, 'RetailCrm\ApiClient::'.$methodApi, $result['errorMsg']);
} }
$log = new Logger(); $log = new Logger();

View File

@ -132,6 +132,9 @@
}, },
"managerId": { "managerId": {
"type": "int" "type": "int"
},
"browserId": {
"type": "string"
} }
}, },
"orders": { "orders": {
@ -383,6 +386,15 @@
}, },
"shipmentStore": { "shipmentStore": {
"type": "string" "type": "string"
},
"from": {
"type": "skip"
},
"to": {
"type": "skip"
},
"custom": {
"type": "string"
} }
} }
} }

View File

@ -256,7 +256,7 @@ class RetailCrmHistory
$api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0); $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); $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))); $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))); $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 $optionsPayStatuses = array_flip(unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0))); // --statuses
@ -449,11 +449,21 @@ class RetailCrmHistory
$site = CSite::GetDefSite(); $site = CSite::GetDefSite();
} }
if ($optionsOrderNumbers == 'Y' && isset($order['number'])) { if ($optionsOrderNumbers == 'Y' && isset($order['number'])) {
$newOrder->setField('ACCOUNT_NUMBER', $order['number']); $newOrder->setField('ACCOUNT_NUMBER', $order['number']);
} }
$personType = $newOrder->getField('PERSON_TYPE_ID'); $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 ($optionsOrderTypes[$order['orderType']]) {
if ($personType != $optionsOrderTypes[$order['orderType']] && $personType != 0) { if ($personType != $optionsOrderTypes[$order['orderType']] && $personType != 0) {
$propsRemove = true; $propsRemove = true;

View File

@ -45,6 +45,13 @@ class RetailCrmICML
'g' => 'g', 'g' => 'g',
'kg' => 'g', 'kg' => 'g',
); );
protected $measure = array (
'pc. 1' => 'pc',
'm' => 'm',
'l' => 'l',
'kg' => 'kg',
);
public function Load() public function Load()
{ {
@ -55,7 +62,7 @@ class RetailCrmICML
$this->isLogged = true; $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"]; $this->encodingDefault = $defaultSite["CHARSET"];
$url = 'https://' . $this->serverName; $url = 'https://' . $this->serverName;
@ -540,6 +547,14 @@ class RetailCrmICML
} }
} }
} }
if (isset($arOffer["MEASURE"]['SYMBOL_INTL'])) {
if ($this->measure[$arOffer["MEASURE"]['SYMBOL_INTL']]) {
$offer .= '<unit code="' . $this->measure[$this->PrepareValue($arOffer["MEASURE"]['SYMBOL_INTL'])] . '" />' . "\n";
} else {
$offer .= '<unit code="' . $this->PrepareValue($arOffer["MEASURE"]['SYMBOL_INTL']) . '" name="' . $this->PrepareValue($arOffer["MEASURE"]['MEASURE_TITLE']) . '" sym="' . $this->PrepareValue($arOffer["MEASURE"]['SYMBOL_RUS']) . '" />' . "\n";
}
}
$offer.= "</offer>\n"; $offer.= "</offer>\n";

View File

@ -1,2 +1,6 @@
- Исправлена проблема с отсутствием в настройках доставок - Добавлены единицы измерения в экспорте каталога
- Небольшие исправления - Исправлены пути в include
- Добавлено время нового формата в валидатор
- Исправлено неверное изменение типа заказа по истории
- Исправлена ошибка с некорректным разбиением ФИО
- Небольшие исправления по коду

View File

@ -4,16 +4,16 @@ $server = \Bitrix\Main\Context::getCurrent()->getServer()->getDocumentRoot();
CModule::AddAutoloadClasses( CModule::AddAutoloadClasses(
'intaro.retailcrm', // module name 'intaro.retailcrm', // module name
array ( array (
'RestNormalizer' => file_exists($server . '/bitrix/php_interface/retailcrm/RestNormalizer.php') ? $server . '/bitrix/php_interface/retailcrm/RestNormalizer.php' : 'classes/general/RestNormalizer.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') ? $server . '/bitrix/php_interface/retailcrm/Logger.php' : 'classes/general/Logger.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') ? $server . '/bitrix/php_interface/retailcrm/ApiClient.php' : 'classes/general/ApiClient.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') ? $server . '/bitrix/php_interface/retailcrm/Client.php' : 'classes/general/Http/Client.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') ? $server . '/bitrix/php_interface/retailcrm/RCrmActions.php' : 'classes/general/RCrmActions.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') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmUser.php' : 'classes/general/user/RetailCrmUser.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') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmOrder.php' : 'classes/general/order/RetailCrmOrder.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') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmHistory.php' : 'classes/general/history/RetailCrmHistory.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') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmICML.php' : 'classes/general/icml/RetailCrmICML.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') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmEvent.php' : 'classes/general/events/RetailCrmEvent.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\Response\ApiResponse' => 'classes/general/Response/ApiResponse.php',
'RetailCrm\Exception\InvalidJsonException' => 'classes/general/Exception/InvalidJsonException.php', 'RetailCrm\Exception\InvalidJsonException' => 'classes/general/Exception/InvalidJsonException.php',
'RetailCrm\Exception\CurlException' => 'classes/general/Exception/CurlException.php', 'RetailCrm\Exception\CurlException' => 'classes/general/Exception/CurlException.php',

View File

@ -1197,8 +1197,6 @@ class intaro_retailcrm extends CModule
$e->getCode() . ': ' . $e->getMessage() $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( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step6.php' GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step6.php'

View File

@ -1,6 +1,6 @@
<? <?
$arModuleVersion = array( $arModuleVersion = array(
"VERSION" => "2.1.1", "VERSION" => "2.1.2",
"VERSION_DATE" => "2016-11-15 17:00:00" "VERSION_DATE" => "2016-12-09 17:00:00"
); );