1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
handler.php
См. документацию.
1
<?php
2
namespace
Bitrix\Sale\Exchange\Integration;
3
4
5
use Bitrix\Main\Event;
6
use Bitrix\Sale\Internals\OrderTable;
7
use Bitrix\Sale\Order;
8
use Bitrix\Sale\Exchange\Integration;
9
10
final
class
Handler
11
{
12
static
public
function
handlerCallbackOnSaleOrderSaved(
Event
$event
)
13
{
15
$order
=
$event
->getParameters()[
'ENTITY'
];
16
17
if
((
new
Integration
\
Connector
\
Manager
())->isOn())
18
{
19
if
(
$order
->isNew())
20
{
21
$fields
= new \Bitrix\Sale\Internals\Fields(
22
\
Bitrix
\
Main
\Context::getCurrent()
23
->getRequest()
24
->toArray());
25
26
$placement =
new
Integration\CRM\Placement\PlacementDeal
(
$fields
->getValues());
27
if
($placement->getTypeHandler() ==
Integration
\
HandlerType::ORDER_NEW
)
//deal exists + new order
28
{
29
30
if
(
$fields
->get(
'entityTypeId'
) ==
Integration
\
CRM
\EntityType::DEAL
31
&&
$fields
->get(
'entityId'
)>0)
32
{
33
$params
[
$order
->getId()] = [
34
'OWNER_TYPE_ID'
=>
Integration\CRM\EntityType::DEAL
,
35
'OWNER_ID'
=>
$fields
->get(
'entityId'
)
36
];
37
38
(
new
Integration\Service\Scenarios\DealUpdate
())
39
->update(
$fields
->get(
'entityId'
),
$params
);
40
41
(
new
static
())
42
->
syncB24
(
$order
);
43
}
44
}
45
else
//new deal + new order
46
{
47
/*
48
(new Integration\Service\Scenarios\DealAdd())
49
->adds([$order->getId()=>$order->getFieldValues()]);
50
51
(new static())
52
->syncB24($order);
53
*/
54
}
55
}
56
}
57
58
}
59
static
public
function
syncB24
(Order
$order
)
60
{
61
$order
->setFieldNoDemand(
'IS_SYNC_B24'
,
'Y'
);
62
63
OrderTable::update(
$order
->getId(), [
'IS_SYNC_B24'
=>
'Y'
]);
64
}
65
}
Bitrix\Main\Event
Определения
event.php:5
Bitrix\Sale\Exchange\Integration\CRM\EntityType\DEAL
const DEAL
Определения
entitytype.php:7
Bitrix\Sale\Exchange\Integration\CRM\Placement\PlacementDeal
Определения
placementdeal.php:10
Bitrix\Sale\Exchange\Integration\Handler
Определения
handler.php:11
Bitrix\Sale\Exchange\Integration\Handler\syncB24
static syncB24(Order $order)
Определения
handler.php:59
Bitrix\Sale\Exchange\Integration\HandlerType\ORDER_NEW
const ORDER_NEW
Определения
handlertype.php:9
Bitrix\Sale\Exchange\Integration\Service\Scenarios\DealUpdate
Определения
dealupdate.php:5
Bitrix\Catalog\Integration
Bitrix\Main
Bitrix\Sale\Exchange\Integration\CRM
Определения
entitytype.php:2
Bitrix\Sale\Exchange\Integration\Connector
Определения
manager.php:4
Bitrix\Sale\Exchange\Integration\Manager
Определения
statistic.php:4
Bitrix
$order
$order
Определения
payment.php:8
$event
$event
Определения
prolog_after.php:141
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
sale
lib
exchange
integration
handler.php
Создано системой
1.14.0