1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
base.php
См. документацию.
1<?php
2namespace Bitrix\Sale\Exchange\Integration\Service\Scenarios;
3
4
5use Bitrix\Sale\Exchange\Integration\Entity\B24IntegrationRelationTable;
6use Bitrix\Sale\Exchange\Integration\Relation;
7use Bitrix\Sale\Exchange\Integration\Exception;
8use Bitrix\Sale\Exchange\Integration\Service\Batchable;
9use Bitrix\Sale\Exchange\Integration\CRM;
10
11class Base
12{
13 static public function dealAddsRelation(array $params)
14 {
15 $deal = new Batchable\Deal();
16
17 foreach ($params as $index=>$param)
18 {
19 if(CRM\EntityType::isDefined($param['OWNER_TYPE_ID']))
20 {
21 if($param['OWNER_TYPE_ID'] == $deal->getDstEntityTypeId())
22 {
23 static::addRelation(
24 $deal->getSrcEntityTypeId(), $index,
25 $deal->getDstEntityTypeId(), $param['OWNER_ID']);
26 }
27 else
28 {
29 throw new Exception\ScenariosException('OwnerTypeId is not Deal');
30 }
31 }
32 else
33 {
34 throw new Exception\ScenariosException('OwnerTypeId UNDEFINED');
35 }
36 }
37 }
38
39 static protected function loadRelation($id, $srcEntityTypeId, $dstEntityTypeId)
40 {
41 $result = null;
42 $item = B24IntegrationRelationTable::getRow(['filter'=>[
43 'SRC_ENTITY_ID' => $id,
44 'SRC_ENTITY_TYPE_ID' => $srcEntityTypeId,
45 'DST_ENTITY_TYPE_ID' => $dstEntityTypeId]]);
46
47 if(is_null($item) == false)
48 {
50
51 'SRC_ENTITY_TYPE_ID'=>$item['SRC_ENTITY_TYPE_ID'],
52 'SRC_ENTITY_ID'=>$item['SRC_ENTITY_ID'],
53 'DST_ENTITY_TYPE_ID'=>$item['DST_ENTITY_TYPE_ID'],
54 'DST_ENTITY_ID'=>$item['DST_ENTITY_ID']
55 ]);
56 }
57 return $result;
58 }
59
60 static protected function addRelation($sourceEntityTypeId, $sourceEntityId, $destinationEntityTypeId, $destinationEntityId)
61 {
62 $relation = new Relation\Relation(
63 $sourceEntityTypeId,
64 $sourceEntityId,
65 $destinationEntityTypeId,
66 $destinationEntityId);
67
68 $relation->save();
69 }
70 //deleteRelation()
71}
static isDefined($typeID)
Определения entitytype.php:46
static createFromArray(array $data)
Определения relation.php:106
static dealAddsRelation(array $params)
Определения base.php:13
static addRelation($sourceEntityTypeId, $sourceEntityId, $destinationEntityTypeId, $destinationEntityId)
Определения base.php:60
static loadRelation($id, $srcEntityTypeId, $dstEntityTypeId)
Определения base.php:39
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799