21 global $USER_FIELD_MANAGER;
23 $existsResult = $this->
exists($documentId);
24 if (!$existsResult->isSuccess())
26 $this->addErrors($existsResult->getErrors());
30 $documentType = $fields[
'DOC_TYPE'];
31 unset($fields[
'DOC_TYPE']);
34 if (!$permissionCheckResult->isSuccess())
36 $this->addErrors($permissionCheckResult->getErrors());
46 $fields = $this->prepareFileFieldsForUpdate((
int)$documentId, $documentType, $fields);
48 $USER_FIELD_MANAGER->Update($entityId, $documentId, $fields);
50 return [static::ITEM => $this->
get($documentId)];
53 private function prepareFileFieldsForUpdate(
int $documentId,
string $documentType, array $fields): array
89 if (!in_array(
'DOC_TYPE', $select,
true))
91 $this->addError(
new Error(
'The documentType field is not specified in the select parameter'));
95 if (!isset($filter[
'DOC_TYPE']))
97 $this->addError(
new Error(
'The documentType field is not specified in the filter parameter'));
101 $documentType = $filter[
'DOC_TYPE'];
102 unset($filter[
'DOC_TYPE']);
105 if (!$permissionCheckResult->isSuccess())
107 $this->addErrors($permissionCheckResult->getErrors());
117 $result = $tableClass::getList([
121 'offset' => $pageNavigation->
getOffset(),
122 'limit' => $pageNavigation->
getLimit(),
125 return new Page(static::LIST, $result, $tableClass::getCount($filter));