Skip to content

Commit 8768ab8

Browse files
authored
Merge pull request #21 from ghostrainman/master
v.2.0.8
2 parents 8e8415f + aaad8c1 commit 8768ab8

File tree

5 files changed

+21
-27
lines changed

5 files changed

+21
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2016-10-20 v.2.0.8
2+
* Исправлена ошибка с отсутствием LID
3+
* Изменены методы для совместимости с ранними версиями sale 16 версии
4+
15
## 2016-10-20 v.2.0.7
26
* Исправлена ошибка с недобавлением товара в заказ по истории
37
* Исправлена ошибка с недобавлением сервиса доставки в црм

intaro.retailcrm/classes/general/history/RetailCrmHistory.php

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -263,22 +263,6 @@ public static function orderHistory()
263263
$optionsOrderNumbers = COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_NUMBERS, 0);
264264
$optionsCanselOrder = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_CANSEL_ORDER, 0));
265265

266-
/*foreach ($optionsOrderProps as $code => $value) {
267-
if (isset($optionsLegalDetails[$code])) {
268-
$optionsOrderProps[$code] = array_merge($optionsOrderProps[$code], $optionsLegalDetails[$code]);
269-
}
270-
if (isset($optionsCustomFields[$code])) {
271-
$optionsOrderProps[$code] = array_merge($optionsOrderProps[$code], $optionsCustomFields[$code]);
272-
}
273-
$optionsOrderProps[$code]['location'] = 'LOCATION';
274-
if (array_search('CITY', $optionsOrderProps[$code]) == false) {
275-
$optionsOrderProps[$code]['city'] = 'CITY';
276-
}
277-
if (array_search('ZIP', $optionsOrderProps[$code]) == false) {
278-
$optionsOrderProps[$code]['index'] = 'ZIP';
279-
}
280-
}*/
281-
282266
$api = new RetailCrm\ApiClient($api_host, $api_key);
283267

284268
$historyFilter = array();
@@ -329,7 +313,7 @@ public static function orderHistory()
329313

330314
$log->write($order, 'assemblyOrderHistory');
331315

332-
if (isset($order['deleted'])) {
316+
if ($order['deleted']) {
333317
continue;
334318
}
335319

@@ -410,7 +394,7 @@ public static function orderHistory()
410394
$order['customer']['externalId'] = $registeredUserID;
411395
}
412396

413-
if (isset($optionsSitesList)) {
397+
if ($optionsSitesList) {
414398
$site = array_search($order['site'], $optionsSitesList);
415399
} else {
416400
$site = CSite::GetDefSite();
@@ -449,9 +433,15 @@ public static function orderHistory()
449433
$newOrder = Bitrix\Sale\Order::load($order['externalId']);
450434

451435
if (!$newOrder instanceof \Bitrix\Sale\Order) {
452-
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'Bitrix\Sale\Order::load', 'Error order load');
436+
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'Bitrix\Sale\Order::load', 'Error order load id=' . $order['externalId']);
453437
continue;
454438
}
439+
440+
if ($optionsSitesList) {
441+
$site = array_search($order['site'], $optionsSitesList);
442+
} else {
443+
$site = CSite::GetDefSite();
444+
}
455445

456446
if ($optionsOrderNumbers == 'Y' && isset($order['number'])) {
457447
$newOrder->setField('ACCOUNT_NUMBER', $order['number']);
@@ -604,7 +594,7 @@ public static function orderHistory()
604594
$elem = self::getInfoElement($product['offer']['externalId']);
605595
$item->setFields(array(
606596
'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(),
607-
'LID' => \Bitrix\Main\Context::getCurrent()->getSite(),
597+
'LID' => $site,
608598
'BASE_PRICE' => $product['initialPrice'],
609599
'NAME' => $product['name'] ? RCrmActions::fromJSON($product['name']) : $elem['NAME'],
610600
'DETAIL_PAGE_URL' => $elem['URL']
@@ -1101,10 +1091,10 @@ public static function paySystemUpdate($order, $optionsPayment)
11011091
}
11021092
//запись в историю
11031093
} else {//ошибка, нет такой активной платежной системы
1104-
RCrmActions::eventLog('RetailCrmHistory::paySystemUpdate', 'RCrmActions::PaymentList()', 'Error paySystem not found');
1094+
RCrmActions::eventLog('RetailCrmHistory::paySystemUpdate', 'RCrmActions::PaymentList()', 'Error paySystem not found in order id=' . $order['externalId']);
11051095
}
11061096
} else {//ошибка, возможно платежная система не сопоставлена
1107-
RCrmActions::eventLog('RetailCrmHistory::paySystemUpdate', 'RCrmActions::PaymentList()', 'Error paySystem not found in option');;
1097+
RCrmActions::eventLog('RetailCrmHistory::paySystemUpdate', 'RCrmActions::PaymentList()', 'Error paySystem not found in option in order id=' . $order['externalId']);;
11081098
}
11091099
} else {
11101100
\Bitrix\Sale\OrderTable::update($order['externalId'], array('PAY_SYSTEM_ID' => ''));

intaro.retailcrm/classes/general/order/RetailCrmOrder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public static function uploadOrders($pSize = 50, $failed = false, $orderList = f
188188
} elseif ($orderList !== false && count($orderList) > 0) {
189189
$orderIds = $orderList;
190190
} else {
191-
$dbOrder = \Bitrix\Sale\Order::GetList(array(
191+
$dbOrder = \Bitrix\Sale\Internals\OrderTable::GetList(array(
192192
'order' => array("ID" => "ASC"),
193193
'filter' => array('>ID' => $lastUpOrderId),
194194
'limit' => $pSize,

intaro.retailcrm/description.ru

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
- Исправлена ошибка с недобавлением товара в заказ по истории
2-
- Исправлена ошибка с недобавлением сервиса доставки в црм
1+
- Исправлена ошибка с отсутствием LID
2+
- Изменены методы для совместимости с ранними версиями sale 16 версии
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?
22
$arModuleVersion = array(
3-
"VERSION" => "2.0.7",
4-
"VERSION_DATE" => "2016-10-20 18:00:00"
3+
"VERSION" => "2.0.8",
4+
"VERSION_DATE" => "2016-10-20 19:00:00"
55
);
66

0 commit comments

Comments
 (0)