1
0
mirror of synced 2025-01-18 08:51:40 +03:00
This commit is contained in:
Akolzin Dmitry 2017-10-26 16:30:50 +03:00
parent f495f98468
commit 09fdf232b7
6 changed files with 32 additions and 23 deletions

View File

@ -1,3 +1,6 @@
## 2017-10-26 v.2.2.7
* Исправлен баг при работе с одним сайтом
## 2017-10-25 v.2.2.6
* Доработана система синхронизации оплат
* Исправлены ошибки в истории заказов

View File

@ -151,16 +151,16 @@ class RetailCrmEvent
));
//many sites?
if(!empty($optionsSitesList) && array_key_exists($arOrder['LID'], $optionsSitesList)) {
$site = $optionsSitesList[$arOrder['LID']];
} else {
if ($optionsSitesList) {
if (array_key_exists($arOrder['LID'], $optionsSitesList) && $optionsSitesList[$arOrder['LID']] !== null) {
$site = $optionsSitesList[$arOrder['LID']];
} else {
return;
}
} elseif (!$optionsSitesList) {
$site = null;
}
if ($site == null) {
return;
}
//new order?
$orderCrm = RCrmActions::apiMethod($api, 'ordersGet', __METHOD__, $arOrder['ID'], $site);
if (isset($orderCrm['order'])) {
@ -230,20 +230,20 @@ class RetailCrmEvent
$newOrder = Bitrix\Sale\Order::load($arPayment['ORDER_ID']);
$arPayment['LID'] = $newOrder->getField('LID');
} catch (Bitrix\Main\ArgumentNullException $e) {
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'Bitrix\Sale\Order::load', $e->getMessage() . ': ' . $arPayment['ORDER_ID']);
RCrmActions::eventLog('RetailCrmEvent::paymentSave', 'Bitrix\Sale\Order::load', $e->getMessage() . ': ' . $arPayment['ORDER_ID']);
return;
}
if(!empty($optionsSitesList) && array_key_exists($arPayment['LID'], $optionsSitesList)) {
$site = $optionsSitesList[$arPayment['LID']];
} else {
if ($optionsSitesList) {
if (array_key_exists($arOrder['LID'], $optionsSitesList) && $optionsSitesList[$arOrder['LID']] !== null) {
$site = $optionsSitesList[$arOrder['LID']];
} else {
return;
}
} elseif (!$optionsSitesList) {
$site = null;
}
if ($site == null) {
return;
}
$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 = new RetailCrm\ApiClient($api_host, $api_key);
@ -299,7 +299,7 @@ class RetailCrmEvent
$paymentToCrm['order']['externalId'] = $arPayment['ORDER_ID'];
}
} else {
RCrmActions::eventLog('RetailCrmOrder::orderSend', 'payments', 'OrderID = ' . $arFields['ID'] . '. Payment not found.');
RCrmActions::eventLog('RetailCrmEvent::paymentSave', 'payments', 'OrderID = ' . $arPayment['ID'] . '. Payment not found.');
}
if (!array_key_exists($arPayment['ID'], $paymentsExternalIds)) {
@ -339,7 +339,7 @@ class RetailCrmEvent
$newOrder = Bitrix\Sale\Order::load($arPayment['ORDER_ID']);
$arPayment['LID'] = $newOrder->getField('LID');
} catch (Bitrix\Main\ArgumentNullException $e) {
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'Bitrix\Sale\Order::load', $e->getMessage() . ': ' . $arPayment['ORDER_ID']);
RCrmActions::eventLog('RetailCrmEvent::paymentDelete', 'Bitrix\Sale\Order::load', $e->getMessage() . ': ' . $arPayment['ORDER_ID']);
return;
}

View File

@ -1,2 +1 @@
- Доработана система синхронизации оплат
- Исправлены ошибки в истории заказов
- Исправлен баг при работе с одним сайтом

View File

@ -335,6 +335,7 @@ class intaro_retailcrm extends CModule
$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);
COption::SetOptionString($this->MODULE_ID, $this->CRM_SITES_LIST, serialize(array()));
}
//prepare crm lists

View File

@ -1,5 +1,5 @@
<?
$arModuleVersion = array(
"VERSION" => "2.2.6",
"VERSION_DATE" => "2017-09-25 12:00:00"
"VERSION" => "2.2.7",
"VERSION_DATE" => "2017-09-25 14:50:00"
);

View File

@ -195,7 +195,13 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
//bitrix site list
$siteListArr = array();
foreach ($arResult['arSites'] as $arSites) {
$siteListArr[$arSites['LID']] = htmlspecialchars(trim($_POST['sites-id-' . $arSites['LID']]));
if (count($arResult['arSites']) > 1) {
if ($_POST['sites-id-' . $arSites['LID']]) {
$siteListArr[$arSites['LID']] = htmlspecialchars(trim($_POST['sites-id-' . $arSites['LID']]));
} else {
$siteListArr[$arSites['LID']] = null;
}
}
}
if ($api_host && $api_key) {
@ -463,7 +469,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
}
}
COption::SetOptionString($mid, $CRM_SITES_LIST, serialize(RCrmActions::clearArr($siteListArr)));
COption::SetOptionString($mid, $CRM_SITES_LIST, serialize($siteListArr));
COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize(RCrmActions::clearArr($orderTypesArr)));
COption::SetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, serialize(RCrmActions::clearArr($deliveryTypesArr)));
COption::SetOptionString($mid, $CRM_PAYMENT_TYPES, serialize(RCrmActions::clearArr($paymentTypesArr)));