12 public function adds(array $params)
15 $contact->refresh($params);
18 $company->refresh($params);
29 $listFields = static::prepareFields($params);
36 $activity->adds($activity::prepareFields($params));
39 static public function prepareFields($params)
41 $userCollection = Batchable\Client::getUserCollectionFromOrderList($params);
45 foreach ($userCollection as $item)
47 foreach ($params as $index=>$param)
49 if($index == $item->getInternalIndex())
51 if($item->getEntity()->getType() == User\EntityType::TYPE_I)
55 'TITLE' => static::getNamingEntity($param),
56 'CONTACT_ID' => static::getDestinationEntityId($item),
57 'PRICE' => $param[
'PRICE'],
58 'CURRENCY' => $param[
'CURRENCY']
61 elseif($item->getEntity()->getType() == User\EntityType::TYPE_E)
65 'TITLE' => static::getNamingEntity($param),
66 'COMPANY_ID' => static::getDestinationEntityId($item),
67 'PRICE' => $param[
'PRICE'],
68 'CURRENCY' => $param[
'CURRENCY']
79 $client = static::resolveClient($item->getEntity()->getType());
80 $relation = static::loadRelation($item->getEntity()->getId(), $client->getSrcEntityTypeId(), $client->getDstEntityTypeId());
82 return ($relation instanceof
Relation) ? $relation->getDestinationEntityId():0;
89 if($userTypeId == User\EntityType::TYPE_I)
93 elseif($userTypeId == User\EntityType::TYPE_E)
98 throw new \Bitrix\Main\NotSupportedException(
"UserTypeId : '".$userTypeId.
"' is not supported in current context");
103 return 'new Deal by order: '.$fields[
'ID'];