1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
statistics.php
См. документацию.
1<?php
2
3
4namespace Bitrix\Sale\Exchange\Integration\Service\Command\Batch;
5
6
7use Bitrix\Main\Error;
8use Bitrix\Main\Result;
9use Bitrix\Sale\Exchange\Integration\EntityType;
10use Bitrix\Sale\Exchange\Integration\Service\Command\IProxy;
11use Bitrix\Sale\Exchange\Integration\Service\Container\Collection;
12use Bitrix\Sale\Exchange\Integration\Service\Container\Item;
13use Bitrix\Sale\Exchange\Integration\Service\Statistic\Entity\Order;
14
16 implements IProxy
17{
18
19 protected $collection;
20
24 public function getCollection(): Collection
25 {
26 return $this->collection;
27 }
28
29 public function __construct()
30 {
31 $this->collection = new Collection();
32 }
33 public function init($params)
34 {
35 foreach($params as $index=>$item)
36 {
37 $this->collection->addItem(
38 Item::create(
39 (new Order())
40 ->setEntityId($index)
41 ->setEntityTypeId(EntityType::ORDER)
42 ->setDateUpdate($item['dateUpdate'])
43 ->setCurrency($item['currency'])
44 ->setProviderId($item['providerId'])
45 ->setStatus($item['status'])
46 ->setXmlId($item['xmlId'])
47 ->setAmount($item['amount']))
48 ->setInternalIndex($index)
49 );
50 }
51
52 return $this;
53 }
54
55 static public function getProxy()
56 {
57 return new \Bitrix\Sale\Exchange\Integration\Rest\RemoteProxies\Sale\Statistics();
58 }
59
63 public function modify()
64 {
66
67 foreach ($this->getCollection() as $item)
68 {
69 $providerId = $item->getEntity()->getProviderId();
70 break;
71 }
72
73 return $this
74 ->modifyFromParams([
75 'provider'=>['id'=>$providerId],
76 'statistics'=>$this
78 ->toArray()
79 ]);
80 }
81
82 static protected function proxyModify(array $list)
83 {
84 $proxy = static::getProxy();
85 $r = $proxy->modify($list);
86 if($r->isSuccess())
87 {
88 $result = $r->getData()['DATA']['result'];
89 }
90 else
91 {
92 $result['error'] = $r->getErrorMessages();
93 }
94
95 return $result;
96 }
97
102 protected function modifyFromParams(array $params)
103 {
104 $r = new Result();
105
106 $res = static::proxyModify($params);
107
108 if (!empty($res['error']))
109 {
110 foreach ($res['error'] as $error)
111 {
112 $r->addError(new Error($error));
113 }
114 }
115
116 return $r;
117 }
118
119}
Определения error.php:15
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
$proxy
Определения proxy.php:11
Order
Определения order.php:6
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$error
Определения subscription_card_product.php:20