1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
baseoperator.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Bizproc\Activity\Operator
;
4
5
use
Bitrix\Bizproc\FieldType
;
6
7
class
BaseOperator
8
{
9
protected
$toCheck
;
10
protected
$value
;
11
protected
FieldType
$fieldType
;
12
13
public
static
function
getCode
(): string
14
{
15
return
'BASE'
;
16
}
17
18
public
static
function
getTitle
(): string
19
{
20
return
''
;
21
}
22
23
public
function
__construct
(
$toCheck
,
$value
,
FieldType
$fieldType
)
24
{
25
$this->fieldType =
$fieldType
;
26
$this->toCheck =
$toCheck
;
27
$this->value =
$value
;
28
29
$this->
toBaseType
();
30
}
31
32
protected
function
toBaseType
(): void
33
{
34
$baseType = $this->fieldType->getBaseType();
35
$documentId = $this->fieldType->getDocumentId();
36
if
($baseType ===
'user'
)
37
{
38
$this->toCheck = \CBPHelper::extractUsers($this->toCheck, $documentId);
39
$this->value = \CBPHelper::extractUsers($this->value, $documentId);
40
}
41
elseif
($baseType ===
'select'
)
42
{
43
if
(is_array($this->toCheck) && \CBPHelper::isAssociativeArray($this->toCheck))
44
{
45
$this->toCheck = array_keys($this->toCheck);
46
}
47
}
48
}
49
50
public
function
check
(): bool
51
{
52
$toCheck
= $this->
valueToArray
($this->toCheck);
53
$value
= $this->
valueToArray
($this->value);
54
55
$result
=
false
;
56
57
$fieldCount =
count
(
$toCheck
);
58
$valueCount =
count
(
$value
);
59
for
(
$i
= 0;
$i
< max($fieldCount, $valueCount);
$i
++)
60
{
61
$fieldI = ($fieldCount >
$i
) ?
$toCheck
[
$i
] :
$toCheck
[$fieldCount -1];
62
$valueI = ($valueCount >
$i
) ?
$value
[
$i
] :
$value
[$valueCount - 1];
63
64
[$valueI, $fieldI] = $this->
normalizeZeroComparing
($valueI, $fieldI);
65
66
$result
= $this->
compare
($fieldI, $valueI);
67
68
if
(!
$result
)
69
{
70
break
;
71
}
72
}
73
74
return
$result
;
75
}
76
77
protected
function
compare
(
$toCheck
,
$value
): bool
78
{
79
return
$toCheck
===
$value
;
80
}
81
82
protected
function
valueToArray
(
$value
):
array
83
{
84
$value
= is_array(
$value
) ?
$value
: [
$value
];
85
$value
= \CBPHelper::isAssociativeArray(
$value
) ? array_keys(
$value
) :
$value
;
86
if
(empty(
$value
))
87
{
88
$value
= [
null
];
89
}
90
91
return
$value
;
92
}
93
94
protected
function
normalizeZeroComparing
(
$value
, $field):
array
95
{
96
if
(
$value
===
''
&& ($field ===
'0'
|| $field === 0.0))
97
{
98
return
[
null
,
null
];
99
}
100
101
if
((
$value
===
'0'
||
$value
=== 0.0) && $field ===
''
)
102
{
103
return
[
null
,
null
];
104
}
105
106
return
[
$value
, $field];
107
}
108
}
Bitrix\Bizproc\Activity\Operator\BaseOperator
Определения
baseoperator.php:8
Bitrix\Bizproc\Activity\Operator\BaseOperator\$value
$value
Определения
baseoperator.php:10
Bitrix\Bizproc\Activity\Operator\BaseOperator\toBaseType
toBaseType()
Определения
baseoperator.php:32
Bitrix\Bizproc\Activity\Operator\BaseOperator\$fieldType
FieldType $fieldType
Определения
baseoperator.php:11
Bitrix\Bizproc\Activity\Operator\BaseOperator\valueToArray
valueToArray($value)
Определения
baseoperator.php:82
Bitrix\Bizproc\Activity\Operator\BaseOperator\getCode
static getCode()
Определения
baseoperator.php:13
Bitrix\Bizproc\Activity\Operator\BaseOperator\check
check()
Определения
baseoperator.php:50
Bitrix\Bizproc\Activity\Operator\BaseOperator\$toCheck
$toCheck
Определения
baseoperator.php:9
Bitrix\Bizproc\Activity\Operator\BaseOperator\normalizeZeroComparing
normalizeZeroComparing($value, $field)
Определения
baseoperator.php:94
Bitrix\Bizproc\Activity\Operator\BaseOperator\compare
compare($toCheck, $value)
Определения
baseoperator.php:77
Bitrix\Bizproc\Activity\Operator\BaseOperator\__construct
__construct($toCheck, $value, FieldType $fieldType)
Определения
baseoperator.php:23
Bitrix\Bizproc\Activity\Operator\BaseOperator\getTitle
static getTitle()
Определения
baseoperator.php:18
Bitrix\Bizproc\FieldType
Определения
fieldtype.php:12
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
Bitrix\Bizproc\Activity\Operator
Определения
baseoperator.php:3
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$i
$i
Определения
factura.php:643
count
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения
waybill.php:936
bitrix
modules
bizproc
lib
activity
operator
baseoperator.php
Создано системой
1.14.0