Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
groupstate.php
1<?php
9
12
13Loc::loadMessages(__FILE__);
14
32{
33 const STATES = [
34 'CREATED' => 1,
35 'IN_PROGRESS' => 2,
36 'COMPLETED' => 3,
37 'HALTED' => 4,
38 ];
39
45 public static function getTableName()
46 {
47 return 'b_sender_group_state';
48 }
49
55 public static function getMap()
56 {
57 return array(
58 'ID' => array(
59 'data_type' => 'integer',
60 'autocomplete' => true,
61 'primary' => true,
62 ),
63 'DATE_INSERT' => array(
64 'data_type' => 'datetime',
65 ),
66 'STATE' => array(
67 'data_type' => 'integer',
68 ),
69 'FILTER_ID' => array(
70 'data_type' => 'string',
71 ),
72 'ENDPOINT' => array(
73 'data_type' => 'string',
74 ),
75 'GROUP' => array(
76 'data_type' => 'Bitrix\Sender\GroupTable',
77 'reference' => array('=this.GROUP_ID' => 'ref.ID'),
78 ),
79 'GROUP_ID' => array(
80 'data_type' => 'integer',
81 'required' => true,
82 ),
83 'OFFSET' => array(
84 'data_type' => 'integer',
85 )
86 );
87 }
88
96 public static function onDelete(\Bitrix\Main\Entity\Event $event)
97 {
98 $result = new \Bitrix\Main\Entity\EventResult;
99 $data = $event->getParameters();
100
101 $listId = array();
102 if(array_key_exists('ID', $data['primary']))
103 {
104 $listId[] = $data['primary']['ID'];
105 }
106 else
107 {
108 $filter = array();
109 foreach($data['primary'] as $primKey => $primVal)
110 {
111 $filter[$primKey] = $primVal;
112 }
113
114 $tableDataList = static::getList(array(
115 'select' => array('ID'),
116 'filter' => $filter
117 ));
118 while($tableData = $tableDataList->fetch())
119 {
120 $listId[] = $tableData['ID'];
121 }
122
123 }
124
125 foreach($listId as $primaryId)
126 {
127 $primary = array('GROUP_STATE_ID' => $primaryId);
129 }
130
131 return $result;
132 }
133}
static loadMessages($file)
Definition loc.php:64
static onDelete(\Bitrix\Main\Entity\Event $event)