Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
businessvaluepersondomaintype.php
1
<?php
2
3
4
namespace
Bitrix\Sale\Rest\Entity
;
5
6
7
use
Bitrix\Main\Localization\Loc
;
8
9
class
BusinessValuePersonDomainType
10
{
11
const
UNDEFINED
= 0;
12
const
TYPE_I
= 1;
13
const
TYPE_E
= 2;
14
15
const
TYPE_I_NAME
=
'I'
;
16
const
TYPE_E_NAME
=
'E'
;
17
18
static
private
$descriptions = [];
19
20
public
static
function
isDefined
($typeID)
21
{
22
if
(!is_numeric($typeID))
23
{
24
return
false
;
25
}
26
27
$typeID = intval($typeID);
28
return
$typeID >= self::TYPE_I && $typeID <=
self::TYPE_E
;
29
}
30
31
public
static
function
resolveName
($typeID)
32
{
33
if
(!is_numeric($typeID))
34
{
35
return
''
;
36
}
37
38
$typeID = intval($typeID);
39
if
($typeID <= 0)
40
{
41
return
''
;
42
}
43
44
switch
($typeID)
45
{
46
case
self::TYPE_I
:
47
return
self::TYPE_I_NAME
;
48
case
self::TYPE_E
:
49
return
self::TYPE_E_NAME
;
50
case
self::UNDEFINED
:
51
default
:
52
return
''
;
53
}
54
}
55
56
public
static
function
resolveID
($name)
57
{
58
$name = mb_strtoupper(trim($name));
59
if
($name ==
''
)
60
{
61
return
self::UNDEFINED
;
62
}
63
64
switch
($name)
65
{
66
case
self::TYPE_I_NAME
:
67
return
self::TYPE_I
;
68
case
self::TYPE_E_NAME
:
69
return
self::TYPE_E
;
70
default
:
71
return
self::UNDEFINED
;
72
}
73
}
74
75
public
static
function
getAllDescriptions
()
76
{
77
if
(!self::$descriptions[LANGUAGE_ID])
78
{
79
Loc::loadMessages
($_SERVER[
"DOCUMENT_ROOT"
].
'/bitrix/modules/sale/admin/person_type_edit.php'
);
80
self::$descriptions[LANGUAGE_ID] = [
81
self::TYPE_I => GetMessage(
'SPTEN_DOMAIN_P_TYPE_I'
),
82
self::TYPE_E => GetMessage(
'SPTEN_DOMAIN_P_TYPE_E'
),
83
];
84
}
85
86
return
self::$descriptions[LANGUAGE_ID];
87
}
88
89
public
static
function
getDescription
($typeId)
90
{
91
$typeId = intval($typeId);
92
$all =
self::getAllDescriptions
();
93
return
isset($all[$typeId]) ? $all[$typeId] :
''
;
94
}
95
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType
Definition
businessvaluepersondomaintype.php:10
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\TYPE_E
const TYPE_E
Definition
businessvaluepersondomaintype.php:13
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\TYPE_E_NAME
const TYPE_E_NAME
Definition
businessvaluepersondomaintype.php:16
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\TYPE_I
const TYPE_I
Definition
businessvaluepersondomaintype.php:12
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\getDescription
static getDescription($typeId)
Definition
businessvaluepersondomaintype.php:89
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\TYPE_I_NAME
const TYPE_I_NAME
Definition
businessvaluepersondomaintype.php:15
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\resolveID
static resolveID($name)
Definition
businessvaluepersondomaintype.php:56
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\isDefined
static isDefined($typeID)
Definition
businessvaluepersondomaintype.php:20
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\resolveName
static resolveName($typeID)
Definition
businessvaluepersondomaintype.php:31
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\UNDEFINED
const UNDEFINED
Definition
businessvaluepersondomaintype.php:11
Bitrix\Sale\Rest\Entity\BusinessValuePersonDomainType\getAllDescriptions
static getAllDescriptions()
Definition
businessvaluepersondomaintype.php:75
Bitrix\Sale\Rest\Entity
Definition
base.php:4
modules
sale
lib
rest
entity
businessvaluepersondomaintype.php
Создано системой
1.10.0