Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/bizproc/lib/activity/operator/ |
Upload File : |
<?php namespace Bitrix\Bizproc\Activity\Operator; use Bitrix\Bizproc\FieldType; use Bitrix\Main\Localization\Loc; class BetweenOperator extends BaseOperator { public static function getCode(): string { return 'between'; } public static function getTitle(): string { return Loc::getMessage('BIZPROC_ACTIVITY_CONDITION_OPERATORS_BETWEEN_OPERATOR_TITLE') ?? ''; } public function __construct($toCheck, $value, FieldType $fieldType) { parent::__construct($toCheck, $value, $fieldType); $this->toCheck = is_array($this->toCheck) ? $this->toCheck : [$this->toCheck]; $this->value = is_array($this->value) ? $this->value : [$this->value]; } public function check(): bool { $greaterThen = is_array($this->value[0]) ? $this->value[0] : [$this->value[0]]; $lessThen = is_array($this->value[1]) ? $this->value[1] : [$this->value[1]]; $toCheck = $this->toCheck; reset($greaterThen); reset($lessThen); reset($toCheck); $firstGreaterThen = current($greaterThen); $firstLessThen = current($lessThen); $checkValue = current($toCheck); return $this->compare($checkValue, [$firstGreaterThen, $firstLessThen]); } protected function compare($toCheck, $value): bool { $classType = $this->fieldType->getTypeClass(); [$greaterThen, $lessThen] = $value; // $firstGreaterThen <= $checkValue <= $firstLessThen return ( $classType::compareValues($toCheck, $greaterThen) >= 0 && $classType::compareValues($toCheck, $lessThen) <= 0 ); } }