Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
company.php
1<?php
3
6
7class Company extends Client
8{
9 public function init($params)
10 {
11 //COMPANY -> TITLE
12 //COMPANY_ADR -> REG_ADDRESS
13 //INN ->
14 //KPP ->
15 //CONTACT_PERSON ->
16 //EMAIL -> EMAIL
17 //PHONE -> PHONE
18 //FAX ->
19 //ZIP -> ADDRESS_POSTAL_CODE
20 //CITY -> ADDRESS_CITY
21 //LOCATION ->
22 //ADDRESS -> ADDRESS
23
24 foreach($params as $index=>$item)
25 {
26 $this->collection->addItem(
27 Integration\Service\Internal\Container\Item::create(
28 Integration\Service\Internal\Entity\Factory::create($this->getDstEntityTypeId())
29 ->setOriginId($index)
30 ->setOriginatorId(static::ANALITICS_ORIGINATOR_ID)
31 ->setTitle($item['TITLE'])
32 ->setRegAddress($item['COMPANY_ADR'])
33 ->setEmail($item['EMAIL'])
34 ->setPhone($item['PHONE'])
35 ->setAddressPostalCode($item['ZIP'])
36 ->setAddressCity($item['CITY'])
37 ->setAddress($item['ADDRESS']))
38 ->setInternalIndex($index)
39 );
40 }
41
42 $this->relationLoad();
43
44 return $this;
45 }
46
47 static protected function getUsersFieldsValues(array $indexes)
48 {
49 return static::getUserCollectionByTypeId(
50 static::loadUserCollection($indexes), Integration\Service\User\EntityType::TYPE_E)
51 ->toArray();
52 }
53
54 static protected function getProxy()
55 {
57 }
58
59 public function getSrcEntityTypeId()
60 {
61 return Integration\EntityType::USER;
62 }
63 public function getDstEntityTypeId()
64 {
65 return Integration\CRM\EntityType::COMPANY;
66 }
67}