1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
delayinterval.php
См. документацию.
1
<?php
2
namespace
Bitrix\Bizproc\Automation\Engine;
3
4
use Bitrix\Bizproc\Automation\Helper;
5
6
class
DelayInterval
7
{
8
public
const
TYPE_BEFORE
=
'before'
;
9
public
const
TYPE_AFTER
=
'after'
;
10
public
const
TYPE_IN
=
'in'
;
11
12
protected
$type
=
'after'
;
//TYPE_AFTER
13
protected
$value
;
14
protected
$valueType
;
15
protected
$basis
;
16
protected
$workTime
=
false
;
17
protected
bool
$waitWorkDay
=
false
;
18
protected
?
array
$inTime
=
null
;
19
protected
bool
$activated
=
true
;
20
25
public
function
__construct
(
array
$params
=
null
)
26
{
27
if
(
$params
)
28
{
29
if
(isset(
$params
[
'type'
]))
30
{
31
$this->
setType
(
$params
[
'type'
]);
32
}
33
if
(isset(
$params
[
'value'
]))
34
{
35
$this->
setValue
(
$params
[
'value'
]);
36
}
37
if
(isset(
$params
[
'valueType'
]))
38
{
39
$this->
setValueType
(
$params
[
'valueType'
]);
40
}
41
42
$this->
setBasis
(isset(
$params
[
'basis'
]) ?
$params
[
'basis'
] : Helper::CURRENT_DATETIME_BASIS);
43
44
if
(isset(
$params
[
'workTime'
]))
45
{
46
$this->
setWorkTime
(
$params
[
'workTime'
]);
47
}
48
49
if
(isset(
$params
[
'waitWorkDay'
]))
50
{
51
$this->
setWaitWorkDay
(
$params
[
'waitWorkDay'
]);
52
}
53
54
if
(isset(
$params
[
'inTime'
]) && is_array(
$params
[
'inTime'
]))
55
{
56
$this->
setInTime
(
$params
[
'inTime'
]);
57
}
58
}
59
}
60
65
public
static
function
createFromActivityProperties
(
array
$properties)
66
{
67
$params
= [];
68
if
(is_array($properties))
69
{
70
if
(isset($properties[
'TimeoutTime'
]))
71
{
72
$params
= Helper::parseDateTimeInterval($properties[
'TimeoutTime'
]);
73
}
74
elseif
75
(
76
isset($properties[
'TimeoutDuration'
])
77
&& isset($properties[
'TimeoutDurationType'
])
78
&& is_numeric($properties[
'TimeoutDuration'
])
79
&& $properties[
'TimeoutDurationType'
] !==
's'
80
)
81
{
82
if
($properties[
'TimeoutDurationType'
] ===
'm'
)
83
{
84
$properties[
'TimeoutDurationType'
] =
'i'
;
85
}
86
$params
=
array
(
87
'type'
=> static::TYPE_AFTER,
88
'value'
=> (
int
)$properties[
'TimeoutDuration'
],
89
'valueType'
=> $properties[
'TimeoutDurationType'
],
90
);
91
}
92
93
if
(!empty($properties[
'WaitWorkDayUser'
]))
94
{
95
$params
[
'waitWorkDay'
] =
true
;
96
}
97
}
98
99
return
new
static
(
$params
);
100
}
101
105
public
function
getType
()
106
{
107
return
$this->type
;
108
}
109
114
public
function
setType
(
$type
)
115
{
116
$type
= (string)
$type
;
117
if
(
$type
=== static::TYPE_BEFORE ||
$type
=== static::TYPE_AFTER ||
$type
=== static::TYPE_IN)
118
{
119
$this->type =
$type
;
120
}
121
122
return
$this;
123
}
124
128
public
function
getValue
()
129
{
130
return
$this->value
;
131
}
132
137
public
function
setValue
(
$value
)
138
{
139
$this->value = (int)
$value
;
140
141
return
$this;
142
}
143
147
public
function
getValueType
()
148
{
149
return
$this->valueType
;
150
}
151
156
public
function
setValueType
(
$valueType
)
157
{
158
if
(
$valueType
===
'i'
||
$valueType
===
'h'
||
$valueType
===
'd'
)
159
{
160
$this->valueType =
$valueType
;
161
}
162
163
return
$this;
164
}
165
169
public
function
getBasis
()
170
{
171
return
$this->basis
;
172
}
173
178
public
function
setBasis
(
$basis
)
179
{
180
$this->basis =
$basis
;
181
182
return
$this;
183
}
184
188
public
function
isWorkTime
()
189
{
190
return
$this->workTime
;
191
}
192
197
public
function
setWorkTime
($flag)
198
{
199
$this->workTime = (bool)$flag;
200
return
$this;
201
}
202
203
public
function
isWaitWorkDay
(): bool
204
{
205
return
$this->waitWorkDay
;
206
}
207
211
public
function
setWaitWorkDay
(
bool
$flag)
212
{
213
$this->waitWorkDay = $flag;
214
215
return
$this;
216
}
217
221
public
function
setInTime
(?
array
$inTime
)
222
{
223
$this->inTime =
$inTime
;
224
225
return
$this;
226
}
227
228
public
function
getInTime
(): ?
array
229
{
230
return
$this->inTime
;
231
}
232
233
public
function
setActivated
(
bool
$activated
): void
234
{
235
$this->activated =
$activated
;
236
}
237
238
public
function
isActivated
(): bool
239
{
240
return
$this->activated
;
241
}
242
247
public
function
toArray
()
248
{
249
return
[
250
'type'
=> $this->
getType
(),
251
'value'
=> $this->
getValue
(),
252
'valueType'
=> $this->
getValueType
(),
253
'basis'
=> $this->
getBasis
(),
254
'workTime'
=> $this->
isWorkTime
(),
255
'waitWorkDay'
=> $this->
isWaitWorkDay
(),
256
'inTime'
=> $this->
getInTime
(),
257
];
258
}
259
265
public
function
toActivityProperties
(
array
$documentType)
266
{
267
$properties = [
268
'TimeoutTimeIsLocal'
=>
'N'
,
269
];
270
271
$worker = Helper::getResponsibleUserExpression($documentType);
272
273
if
(
274
$this->
getBasis
() === Helper::CURRENT_DATETIME_BASIS
275
&& $this->
getType
() === static::TYPE_AFTER
276
&& !$this->
isWorkTime
()
277
&& !$this->
getInTime
()
278
)
279
{
280
$valueType
= $this->
getValueType
();
281
if
(
$valueType
===
'i'
)
282
{
283
$valueType
=
'm'
;
284
}
285
286
$properties[
'TimeoutDuration'
] = $this->
getValue
();
287
$properties[
'TimeoutDurationType'
] =
$valueType
;
288
}
289
elseif
($this->
getType
() === static::TYPE_IN && !$this->
isWorkTime
() && !$this->
getInTime
())
290
{
291
$properties[
'TimeoutTime'
] = $this->
getBasis
();
292
}
293
else
294
{
295
$intervalProperties = $this->
toArray
();
296
$intervalProperties[
'worker'
] = $worker;
297
298
$properties[
'TimeoutTime'
] = Helper::getDateTimeIntervalString($intervalProperties);
299
}
300
301
if
($this->
isWaitWorkDay
())
302
{
303
$properties[
'WaitWorkDayUser'
] = $worker;
304
}
305
306
return
$properties;
307
}
308
313
public
function
isNow
()
314
{
315
return
(
316
!$this->
isWorkTime
()
317
&& !$this->
isWaitWorkDay
()
318
&& !$this->
getInTime
()
319
&& $this->
getBasis
() === Helper::CURRENT_DATETIME_BASIS
320
&& $this->
getValue
() === 0
321
);
322
}
323
}
Bitrix\Bizproc\Automation\Engine\DelayInterval
Определения
delayinterval.php:7
Bitrix\Bizproc\Automation\Engine\DelayInterval\setValueType
setValueType($valueType)
Определения
delayinterval.php:156
Bitrix\Bizproc\Automation\Engine\DelayInterval\$value
$value
Определения
delayinterval.php:13
Bitrix\Bizproc\Automation\Engine\DelayInterval\getBasis
getBasis()
Определения
delayinterval.php:169
Bitrix\Bizproc\Automation\Engine\DelayInterval\isNow
isNow()
Определения
delayinterval.php:313
Bitrix\Bizproc\Automation\Engine\DelayInterval\setActivated
setActivated(bool $activated)
Определения
delayinterval.php:233
Bitrix\Bizproc\Automation\Engine\DelayInterval\isActivated
isActivated()
Определения
delayinterval.php:238
Bitrix\Bizproc\Automation\Engine\DelayInterval\__construct
__construct(array $params=null)
Определения
delayinterval.php:25
Bitrix\Bizproc\Automation\Engine\DelayInterval\setBasis
setBasis($basis)
Определения
delayinterval.php:178
Bitrix\Bizproc\Automation\Engine\DelayInterval\getValueType
getValueType()
Определения
delayinterval.php:147
Bitrix\Bizproc\Automation\Engine\DelayInterval\$activated
bool $activated
Определения
delayinterval.php:19
Bitrix\Bizproc\Automation\Engine\DelayInterval\toArray
toArray()
Определения
delayinterval.php:247
Bitrix\Bizproc\Automation\Engine\DelayInterval\createFromActivityProperties
static createFromActivityProperties(array $properties)
Определения
delayinterval.php:65
Bitrix\Bizproc\Automation\Engine\DelayInterval\setValue
setValue($value)
Определения
delayinterval.php:137
Bitrix\Bizproc\Automation\Engine\DelayInterval\getInTime
getInTime()
Определения
delayinterval.php:228
Bitrix\Bizproc\Automation\Engine\DelayInterval\$valueType
$valueType
Определения
delayinterval.php:14
Bitrix\Bizproc\Automation\Engine\DelayInterval\getType
getType()
Определения
delayinterval.php:105
Bitrix\Bizproc\Automation\Engine\DelayInterval\isWaitWorkDay
isWaitWorkDay()
Определения
delayinterval.php:203
Bitrix\Bizproc\Automation\Engine\DelayInterval\$workTime
$workTime
Определения
delayinterval.php:16
Bitrix\Bizproc\Automation\Engine\DelayInterval\TYPE_AFTER
const TYPE_AFTER
Определения
delayinterval.php:9
Bitrix\Bizproc\Automation\Engine\DelayInterval\$type
$type
Определения
delayinterval.php:12
Bitrix\Bizproc\Automation\Engine\DelayInterval\isWorkTime
isWorkTime()
Определения
delayinterval.php:188
Bitrix\Bizproc\Automation\Engine\DelayInterval\TYPE_BEFORE
const TYPE_BEFORE
Определения
delayinterval.php:8
Bitrix\Bizproc\Automation\Engine\DelayInterval\getValue
getValue()
Определения
delayinterval.php:128
Bitrix\Bizproc\Automation\Engine\DelayInterval\TYPE_IN
const TYPE_IN
Определения
delayinterval.php:10
Bitrix\Bizproc\Automation\Engine\DelayInterval\$waitWorkDay
bool $waitWorkDay
Определения
delayinterval.php:17
Bitrix\Bizproc\Automation\Engine\DelayInterval\setWaitWorkDay
setWaitWorkDay(bool $flag)
Определения
delayinterval.php:211
Bitrix\Bizproc\Automation\Engine\DelayInterval\$basis
$basis
Определения
delayinterval.php:15
Bitrix\Bizproc\Automation\Engine\DelayInterval\$inTime
array $inTime
Определения
delayinterval.php:18
Bitrix\Bizproc\Automation\Engine\DelayInterval\setType
setType($type)
Определения
delayinterval.php:114
Bitrix\Bizproc\Automation\Engine\DelayInterval\setWorkTime
setWorkTime($flag)
Определения
delayinterval.php:197
Bitrix\Bizproc\Automation\Engine\DelayInterval\setInTime
setInTime(?array $inTime)
Определения
delayinterval.php:221
Bitrix\Bizproc\Automation\Engine\DelayInterval\toActivityProperties
toActivityProperties(array $documentType)
Определения
delayinterval.php:265
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
bizproc
lib
automation
engine
delayinterval.php
Создано системой
1.14.0