parent
2e6b105d8d
commit
c7aad78e5f
@ -1,3 +1,6 @@
|
||||
## 2023-03-17 v.6.2.1
|
||||
- Добавлена передача менеджера при изменении заказа по истории
|
||||
|
||||
## 2023-03-10 v.6.2.0
|
||||
- Добавлена поддержка PHP 8.0
|
||||
|
||||
|
@ -494,11 +494,7 @@ class RetailCrmHistory
|
||||
|
||||
$newOrder = Order::create($site, $orderCustomerExtId, $currency);
|
||||
|
||||
if (array_key_exists('managerId', $order)) {
|
||||
$service = ManagerService::getInstance();
|
||||
|
||||
$newOrder->setField('RESPONSIBLE_ID', $service->getManagerBitrixId($order['managerId']));
|
||||
}
|
||||
self::setManager($newOrder, $order);
|
||||
|
||||
if (isset($buyerProfileToAppend['ID']) && isset($optionsLegalDetails['legalName'])) {
|
||||
$newOrder->setFields([
|
||||
@ -564,6 +560,8 @@ class RetailCrmHistory
|
||||
continue;
|
||||
}
|
||||
|
||||
self::setManager($newOrder, $order);
|
||||
|
||||
$propsRemove = false;
|
||||
$personType = $newOrder->getField('PERSON_TYPE_ID');
|
||||
|
||||
@ -608,7 +606,10 @@ class RetailCrmHistory
|
||||
if ($optionsPayStatuses[$order['status']]) {
|
||||
$newOrder->setField('STATUS_ID', $optionsPayStatuses[$order['status']]);
|
||||
|
||||
if (in_array($optionsPayStatuses[$order['status']], $optionsCanselOrder)) {
|
||||
if (
|
||||
is_array($optionsCanselOrder)
|
||||
&& in_array($optionsPayStatuses[$order['status']], $optionsCanselOrder)
|
||||
) {
|
||||
self::unreserveShipment($newOrder);
|
||||
$newOrder->setFieldNoDemand('CANCELED', 'Y');
|
||||
} else {
|
||||
@ -1948,6 +1949,20 @@ class RetailCrmHistory
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function setManager($newOrder, $order)
|
||||
{
|
||||
if (array_key_exists('managerId', $order)) {
|
||||
$service = ManagerService::getInstance();
|
||||
|
||||
$newOrder->setField('RESPONSIBLE_ID', $service->getManagerBitrixId($order['managerId']));
|
||||
|
||||
// If the order exists in CRM, need to save the changes in the CMS order
|
||||
if (!empty($order['externalId'])) {
|
||||
self::orderSave($newOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getInfoElement($offerId)
|
||||
{
|
||||
$elementInfo = CIBlockElement::GetByID($offerId)->fetch();
|
||||
|
@ -1 +1 @@
|
||||
- Добавлена поддержка PHP 8.0
|
||||
- Добавлена передача менеджера при изменении заказа по истории
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$arModuleVersion = [
|
||||
'VERSION' => '6.2.0',
|
||||
'VERSION_DATE' => '2023-03-10 12:00:00'
|
||||
'VERSION' => '6.2.1',
|
||||
'VERSION_DATE' => '2023-03-17 18:00:00'
|
||||
];
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Bitrix\Sale\Order;
|
||||
use Bitrix\Currency\CurrencyManager;
|
||||
/**
|
||||
* Class RetailCrmHistory_v5Test
|
||||
*/
|
||||
@ -88,6 +89,18 @@ class RetailCrmHistory_v5Test extends \BitrixTestCase
|
||||
$this->assertEquals(null, RetailCrmHistory::shipmentItemReset($order));
|
||||
}
|
||||
|
||||
public function testSetManager()
|
||||
{
|
||||
$currency = CurrencyManager::getBaseCurrency();
|
||||
$cmsOrder = Order::create('bitrix', 1, $currency);
|
||||
$crmManagerId = 123;
|
||||
|
||||
RetailcrmConfigProvider::setUsersMap(['bitrixUserId-1515' => $crmManagerId]);
|
||||
RetailCrmHistory::setManager($cmsOrder, ['externalId' => 1, 'managerId' => $crmManagerId]);
|
||||
|
||||
$this->assertEquals(1515, $cmsOrder->getField('RESPONSIBLE_ID'));
|
||||
}
|
||||
|
||||
private function getCustomers(): array
|
||||
{
|
||||
return [
|
||||
|
Loading…
Reference in New Issue
Block a user