1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
type.php
См. документацию.
1<?php
8namespace Bitrix\Sender\Recipient;
9
10use Bitrix\Main\Localization\Loc;
11use Bitrix\Sender\Internals\ClassConstant;
12
13Loc::loadMessages(__FILE__);
14
19class Type extends ClassConstant
20{
21 const EMAIL = 1;
22 const PHONE = 2;
23 const IM = 3;
24 const CRM_COMPANY_ID = 4;
25 const CRM_CONTACT_ID = 5;
26 const CRM_LEAD_ID = 10;
31
39 public static function detect($recipientCode, $isNormalized = false)
40 {
41 $list = self::getNamedList();
42 unset($list[self::PHONE]);
43 $list = array_keys($list);
44 $list[] = self::PHONE;
45
46 foreach ($list as $id)
47 {
48 if ($isNormalized)
49 {
50 $normalizedCode = $recipientCode;
51 }
52 else
53 {
54 $normalizedCode = Normalizer::normalize($recipientCode, $id);
55 }
56
57 if (!Validator::validate($normalizedCode, $id))
58 {
59 continue;
60 }
61
62 return $id;
63 }
64
65 return null;
66 }
67
74 public static function getName($id)
75 {
76 $code = self::getCode($id);
77 $name = Loc::getMessage('SENDER_TYPE_CAPTION_' . $code) ?: $code;
78 return $name;
79 }
80}
static normalize($code, $typeId=Type::EMAIL)
Определения normalizer.php:28
const EMAIL
Определения type.php:21
const CRM_ORDER_PRODUCT_CONTACT_ID
Определения type.php:28
const CRM_COMPANY_ID
Определения type.php:24
const CRM_LEAD_ID
Определения type.php:26
const CRM_CONTACT_ID
Определения type.php:25
static getName($id)
Определения type.php:74
const CRM_DEAL_PRODUCT_CONTACT_ID
Определения type.php:27
const IM
Определения type.php:23
const CRM_DEAL_PRODUCT_COMPANY_ID
Определения type.php:29
const PHONE
Определения type.php:22
const CRM_ORDER_PRODUCT_COMPANY_ID
Определения type.php:30
static detect($recipientCode, $isNormalized=false)
Определения type.php:39
static validate($code, $typeId=Type::EMAIL)
Определения validator.php:27
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
$name
Определения menu_edit.php:35
Определения collection.php:2