Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
script.php
1<?php
2
4
7
24class ScriptTable extends Main\Entity\DataManager
25{
29 public static function getTableName()
30 {
31 return 'b_bp_script';
32 }
33
37 public static function getMap()
38 {
39 return [
40 'ID' => [
41 'data_type' => 'integer',
42 'primary' => true,
43 ],
44 'MODULE_ID' => [
45 'data_type' => 'string'
46 ],
47 'ENTITY' => [
48 'data_type' => 'string'
49 ],
50 'DOCUMENT_TYPE' => [
51 'data_type' => 'string'
52 ],
53 'NAME' => [
54 'data_type' => 'string'
55 ],
56 'DESCRIPTION' => [
57 'data_type' => 'string'
58 ],
59 'WORKFLOW_TEMPLATE_ID' => [
60 'data_type' => 'integer'
61 ],
62 'WORKFLOW_TEMPLATE' => array(
63 'data_type' => \Bitrix\Bizproc\Workflow\Template\Entity\WorkflowTemplateTable::class,
64 'reference' => array(
65 '=this.WORKFLOW_TEMPLATE_ID' => 'ref.ID'
66 ),
67 'join_type' => 'LEFT'
68 ),
69 'CREATED_DATE' => [
70 'data_type' => 'datetime'
71 ],
72 'CREATED_BY' => [
73 'data_type' => 'integer'
74 ],
75 'MODIFIED_DATE' => [
76 'data_type' => 'datetime'
77 ],
78 'MODIFIED_BY' => [
79 'data_type' => 'integer'
80 ],
81 'ORIGINATOR_ID' => [
82 'data_type' => 'string'
83 ],
84 'ORIGIN_ID' => [
85 'data_type' => 'string'
86 ],
87 'SORT' => [
88 'data_type' => 'integer',
89 'default_value' => 10
90 ],
91 'ACTIVE' => [
92 'data_type' => 'boolean',
93 'values' => ['N', 'Y'],
94 'default_value' => 'Y'
95 ],
96 ];
97 }
98 public static function getQueueCount(int $scriptId): int
99 {
100 return ScriptQueueTable::getCount(['=SCRIPT_ID' => $scriptId]);
101 }
102
103 public static function getActiveQueueCount(int $scriptId): int
104 {
105 return ScriptQueueTable::getCount(
106 [
107 '=SCRIPT_ID' => $scriptId,
108 '=STATUS' => [Status::QUEUED, Status::EXECUTING]
109 ]
110 );
111 }
112
113 public static function getLastStartedDate(int $scriptId): ?Main\Type\DateTime
114 {
115 $row = ScriptQueueTable::getList(
116 [
117 'filter' => ['=SCRIPT_ID' => $scriptId],
118 'order' => ['STARTED_DATE' => 'DESC'],
119 'limit' => 1,
120 'select' => ['STARTED_DATE']
121 ]
122 )->fetch();
123
124 return $row? $row['STARTED_DATE'] : null;
125 }
126}
static getLastStartedDate(int $scriptId)
Definition script.php:113
static getQueueCount(int $scriptId)
Definition script.php:98
static getActiveQueueCount(int $scriptId)
Definition script.php:103