27 public function setField(
string $fieldId, $value,
string $operator =
''): static
29 if ($fieldId ===
'FIND' || $fieldId ===
'SEARCHABLE_CONTENT')
34 if ($fieldId ===
'WORKFLOW_STATE')
39 return parent::setField($fieldId, $value, $operator);
44 if ($fieldId ===
'WORKFLOW_STATE')
46 return $this->computedFilter[
'state'];
49 return parent::getFieldValue($fieldId);
56 $this->filter[
'?SEARCHABLE_CONTENT'] = $value;
57 $this->keyMatching[
'SEARCHABLE_CONTENT'] =
'?SEARCHABLE_CONTENT';
65 if ($state ===
'R' || $state ===
'C')
67 $this->computedFilter[
'state'] = $state;
68 $this->keyMatching[
'WORKFLOW_STATE'] =
'WORKFLOW_STATE';
78 $this->
setField(
'CREATED_BY', (
string)$userId,
'=');
86 if (!empty($iBlockType))
88 $this->
setField(
'IBLOCK_TYPE', $iBlockType,
'=');
96 if ($this->computedFilter[
'state'] !==
null)
98 $this->execWorkflowStateFilter();
102 private function execWorkflowStateFilter(): void
104 $state = $this->computedFilter[
'state'];
106 if (Loader::includeModule(
'bizproc') && in_array($state, [
'R',
'C'],
true))
109 WorkflowInstanceTable::query()
111 ->setSelect([
'DOCUMENT_ID'])
112 ->where(
'MODULE_ID',
'lists')
113 ->where(
'ENTITY', \BizprocDocument::class)
117 $query->where(
'STARTED_BY',$this->
getFieldValue(
'CREATED_BY'));
120 $activeWorkflow = array_column($query->exec()->fetchAll(),
'DOCUMENT_ID');
124 $this->filter[
'=ID'] = $activeWorkflow;
125 $this->keyMatching[
'ID'] =
'=ID';
130 $this->filter[
'!=ID'] = $activeWorkflow;
131 $this->keyMatching[
'ID'] =
'!=ID';