1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
conditiongroup.php
См. документацию.
1<?php
2
3namespace Bitrix\Bizproc\Activity;
4
5use Bitrix\Bizproc\FieldType;
6
8{
9 public const JOINER_AND = 'AND'; // 0
10 public const JOINER_OR = 'OR'; // 1
11
12 protected array $items = [];
13 protected array $result = [];
15
16 public function __construct(array $params = [])
17 {
18 if (!empty($params))
19 {
20 if (isset($params['items']) && is_array($params['items']))
21 {
22 foreach ($params['items'] as $item)
23 {
24 $this->addItem($item);
25 }
26 }
27 if (isset($params['parameterDocumentId']) && is_array($params['parameterDocumentId']))
28 {
29 $this->parameterDocumentId = $params['parameterDocumentId'];
30 }
31 }
32 }
33
34 public function addItem(array $item): ConditionGroup
35 {
36 if (!empty($item))
37 {
38 $this->items[] = [
39 'condition' => new Condition($item),
40 'joiner' => isset($item['joiner']) && $item['joiner'] === 0 ? static::JOINER_AND : self::JOINER_OR,
41 'valueToCheck' => $item['valueToCheck'] ?? null,
42 'fieldType' => $item['fieldType'] ?? new FieldType([], [], 'Bitrix\Bizproc\BaseType\StringType')
43 ];
44 }
45
46 return $this;
47 }
48
49 public function getItems(): array
50 {
51 return $this->items;
52 }
53
54 public function getParameterDocumentId(): array
55 {
57 }
58
59 public function evaluate(): bool
60 {
61 $result = [0 => true];
62 $i = 0;
63
64 $this->result = [];
65
66 foreach ($this->getItems() as $item)
67 {
68 $joiner = $item['joiner'];
70 $condition = $item['condition'];
71
72 if ($condition->getOperator() === 'modified')
73 {
74 $conditionResult =
75 is_array($condition->getValue()) && in_array($item['valueToCheck'], $condition->getValue(), true)
76 ;
77 }
78 else
79 {
80 $conditionResult = $condition->checkValue($item['valueToCheck'], $item['fieldType'], $this->parameterDocumentId);
81 }
82
83 if ($joiner === static::JOINER_OR)
84 {
85 ++$i;
86 $result[$i] = $conditionResult;
87 }
88 elseif (!$conditionResult)
89 {
90 $result[$i] = false;
91 }
92
93 $this->result[] = $conditionResult;
94 }
95
96 return (count(array_filter($result)) > 0);
97 }
98
99 public function getEvaluateResults(): array
100 {
101 return $this->result;
102 }
103}
__construct(array $params=[])
Определения conditiongroup.php:16
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$i
Определения factura.php:643
</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
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799