Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
businessvaluepersondomaintype.php
1<?php
2
3
5
6
8
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 {
67 return self::TYPE_I;
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);
93 return isset($all[$typeId]) ? $all[$typeId] : '';
94 }
95}
static loadMessages($file)
Definition loc.php:64