1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
client.php
См. документацию.
1<?php
3
5use \Bitrix\Sale\Exchange\Integration\Service\Batchable;
6
7abstract class Client
8{
12 abstract protected function getClient();
13
14 public function refresh(array $params)
15 {
16 $list = $this->resolve($params);
17
18 if(count($list)>0)
19 {
20 $void = $this
21 ->diff($list)
22 ->toArray();
23
24 if(count($void)>0)
25 {
26 $this->adds($void);
27 }
28 }
29 return $this;
30 }
31
32 public function resolve(array $params)
33 {
34 $client = $this->getClient();
35 return $client::resolveFieldsValuesFromOrderList($params);
36 }
37
38 public function diff(array $params)
39 {
40 $client = $this->getClient();
41 $client->init($params);
42
43 $relationList = $client->relationListDstEntity();
44 $res = count($relationList)>0 ? $client::proxyList(['ID'=>$relationList]):[];
45
46 if(isset($res['error']) == false)
47 {
48 $list = [];
49 foreach($res as $fields)
50 {
51 $list[] = $fields['ID'];
52 }
53 $client->relationDeleteByDstEntity($list);
54 }
55 else
56 {
58 }
59 return $client->relationVoid();
60 }
61
62 public function adds(array $params)
63 {
64 $client = $this->getClient();
65
66 $params = static::prepareFields($params);
67 $client->init($params);
68 $client->adds();
69
70 return $client
71 ->getCollection();
72 }
73
74 static protected function prepareFields(array $params)
75 {
76 $result = [];
77
78 foreach ($params as $index=>$param)
79 {
80 if(isset($param['EMAIL']))
81 {
82 $param['EMAIL'] = [
83 0 => ['VALUE'=>$param['EMAIL'], 'VALUE_TYPE'=>'WORK']
84 ];
85 }
86
87 if(isset($param['PHONE']))
88 {
89 $param['PHONE'] = [
90 0 => ['VALUE'=>$param['PHONE']]
91 ];
92 }
93
94 $result[$index] = $param;
95 }
96
97 return $result;
98 }
99}
</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
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$fields
Определения yandex_run.php:501