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/js/bizproc/automation/src/condition/ |
Upload File : |
import { Type } from 'main.core'; import { Operator } from 'bizproc.condition'; export class Condition { #object: string; #field: string; #operator: string; #value: string; parentGroup; constructor(params: ?Object, group) { this.#object = 'Document'; this.#field = ''; this.#operator = '!empty'; this.#value = ''; this.parentGroup = null; if (Type.isPlainObject(params)) { if (params.object) { this.setObject(params.object); } if (params.field) { this.setField(params.field); } if (params.operator) { this.setOperator(params.operator); } if ('value' in params) { this.setValue(params.value); } } if (group) { this.parentGroup = group; } } clone(): Condition { return new Condition( { object: this.#object, field: this.#field, operator: this.#operator, value: this.#value, }, this.parentGroup, ); } setObject(object) { if (Type.isStringFilled(object)) { this.#object = object; } } get object() { return this.#object; } setField(field) { if (Type.isStringFilled(field)) { this.#field = field; } } get field() { return this.#field; } setOperator(operator) { this.#operator = operator ?? Operator.EQUAL; } get operator(): string { return this.#operator; } setValue(value) { this.#value = value; if (this.#operator === Operator.EQUAL && this.#value === '') { this.#operator = 'empty'; } else if (this.#operator === Operator.NOT_EQUAL && this.#value === '') { this.#operator = '!empty'; } } get value() { return this.#value; } serialize(): Object { return { object: this.#object, field: this.#field, operator: this.#operator, value: this.#value, }; } }