Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
status.php
1<?php
9
10use Bitrix\Main;
12
29class StatusTable extends Main\Entity\DataManager
30{
31 public const TYPE_ORDER = 'O';
32 public const TYPE_SHIPMENT = 'D';
33
34 public static function getTableName()
35 {
36 return 'b_sale_status';
37 }
38
39 public static function getMap()
40 {
41 return array(
42
43 new Main\Entity\StringField('ID', array(
44 'primary' => true,
45 'validation' => function()
46 {
47 return array(
48 new Main\Entity\Validator\RegExp('/^[A-Za-z]{1,2}$/'),
49 new Main\Entity\Validator\Unique,
50 );
51 },
52 'title' => Loc::getMessage('B_SALE_STATUS_ID'),
53 )),
54
55 new Main\Entity\BooleanField('TYPE', array(
56 'default_value' => self::TYPE_ORDER,
57 'values' => array(self::TYPE_ORDER, self::TYPE_SHIPMENT),
58 'title' => Loc::getMessage('B_SALE_STATUS_TYPE'),
59 )),
60
61 new Main\Entity\IntegerField('SORT', array(
62 'default_value' => 100,
63 'format' => '/^[0-9]{1,11}$/',
64 'title' => Loc::getMessage('B_SALE_STATUS_SORT'),
65 )),
66
67 new Main\Entity\BooleanField('NOTIFY', array(
68 'default_value' => 'Y',
69 'values' => array('N', 'Y'),
70 'title' => Loc::getMessage('B_SALE_STATUS_NOTIFY'),
71 )),
72
73 new Main\Entity\StringField('COLOR', array(
74 'title' => Loc::getMessage('B_SALE_STATUS_COLOR'),
75 )),
76
77 new Main\Entity\StringField('XML_ID', array(
78 'title' => Loc::getMessage('B_SALE_STATUS_XML_ID'),
79 )),
80
82 'STATUS_LANG',
83 StatusLangTable::class,
84 Main\ORM\Query\Join::on('this.ID', 'ref.STATUS_ID'),
85 array('join_type' => 'left')
86 )
87 );
88 }
89
99 public static function update($primary, array $data)
100 {
101 $result = parent::update($primary, $data);
102 if (Main\Config\Option::get('sale', 'expiration_processing_events', 'N') === 'Y')
103 {
104 foreach (GetModuleEvents("sale", "OnStatusUpdate", true) as $event)
105 {
106 ExecuteModuleEventEx($event, array($primary, $data));
107 }
108 }
109
110 return $result;
111 }
112
121 public static function add(array $data)
122 {
123 $result = parent::add($data);
124 if (Main\Config\Option::get('sale', 'expiration_processing_events', 'N') === 'Y')
125 {
126 $id = $result->getId();
127 foreach (GetModuleEvents("sale", "OnStatusAdd", true) as $event)
128 {
129 ExecuteModuleEventEx($event, array($id, $data));
130 }
131 }
132
133 return $result;
134 }
135
139 public static function generateXmlId()
140 {
141 return uniqid('bx_');
142 }
143}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static add(array $data)
Definition status.php:121
static update($primary, array $data)
Definition status.php:99