Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
contact.php
1<?php
3
4
6use \Bitrix\Sale\Exchange\Integration\Service\Scenarios;
7
8class Contact
9{
10 public function refreshById($id, array $params)
11 {
12 $contact = new Scenarios\RefreshClient\Contact();
13 $userList = $contact->resolve($params);
14 if(count($userList)>0)
15 {
16 $contact->refresh($params);
17
18 $contacts = $this->itemsGet($id);
19
20 if(count($contacts)>0)
21 {
22 $this->updates($id, $userList, $contacts);
23 }
24 else
25 {
26 $this->adds($id, $userList);
27 }
28 }
29 }
30
31 public function itemsGet($id)
32 {
33 return Batchable\Deal::contactItemsGet($id);
34 }
35
36 public function updates($id, array $userList, array $contacts)
37 {
38 return Batchable\Deal::dealContactUpdates($id, $userList, $contacts);
39 }
40
41 public function adds($id, array $userList)
42 {
43 return Batchable\Deal::dealContactAdds($id, $userList);
44 }
45}