20 $existsResult = $this->
exists($documentId);
21 if (!$existsResult->isSuccess())
23 $this->addErrors($existsResult->getErrors());
27 $documentType =
$fields[
'DOC_TYPE'];
31 if (!$permissionCheckResult->isSuccess())
33 $this->addErrors($permissionCheckResult->getErrors());
43 $fields = $this->prepareFileFieldsForUpdate((
int)$documentId, $documentType,
$fields);
52 private function prepareFileFieldsForUpdate(
int $documentId,
string $documentType,
array $fields):
array
59 foreach ($preparedFields as $fieldId => $field)
61 if (isset($userFields[$fieldId]) && $userFields[$fieldId][
'USER_TYPE_ID'] ===
'file')
63 if ($userFields[$fieldId][
'MULTIPLE'] ===
'Y')
65 $preparedFields[$fieldId][] = [
66 'old_id' => $userFields[$fieldId][
'VALUE'],
71 $preparedFields[$fieldId][
'old_id'] = $userFields[$fieldId][
'VALUE'];
76 return $preparedFields;
81 $this->addError(
new Error(
'The get method is not implemented; please use the list method and filter by documentId'));
91 bool $__calculateTotalCount =
true
94 if (!in_array(
'DOC_TYPE',
$select,
true))
96 $this->addError(
new Error(
'The documentType field is not specified in the select parameter'));
100 if (!isset(
$filter[
'DOC_TYPE']))
102 $this->addError(
new Error(
'The documentType field is not specified in the filter parameter'));
106 $documentType =
$filter[
'DOC_TYPE'];
110 if (!$permissionCheckResult->isSuccess())
112 $this->addErrors($permissionCheckResult->getErrors());
122 $result = $tableClass::getList([
126 'offset' => $pageNavigation->
getOffset(),
127 'limit' => $pageNavigation->
getLimit(),
133 $__calculateTotalCount ? $tableClass::getCount(
$filter) : 0
139 $this->addError(
new Error(
'The add method is not implemented; please use the update method to set the values'));
146 $this->addError(
new Error(
'The delete method is not implemented; please use the update method to unset the values'));
175 protected function get($id)
180 'select' => [
'DOC_TYPE'],
181 'filter' => [
'=ID' => $id]
198 'DOC_TYPE' => $documentType,
201 foreach ($values as $value)
203 $result[
'FIELD_' . $value[
'ID']] = $value[
'VALUE'];
212 if(isset($this->
get($id)[
'ID']) ===
false)
214 $r->addError(
new Error(
'The specified document does not exist'));
236 &&
$accessController->check(ActionDictionary::ACTION_INVENTORY_MANAGEMENT_ACCESS)
239 ActionDictionary::ACTION_STORE_DOCUMENT_VIEW,
242 if (!($basePermission && $typePermission))
253 if (!$readPermissionCheckResult->isSuccess())
255 return $readPermissionCheckResult;
261 ActionDictionary::ACTION_STORE_DOCUMENT_MODIFY,
264 if (!$modifyPermission)
AccessController $accessController
checkModifyPermissionEntity()
checkReadPermissionEntity()
updateAction($documentId, $fields)
checkUpdatePermissionByType(string $documentType)
listAction(PageNavigation $pageNavigation, $select=[], $filter=[], $order=[], bool $__calculateTotalCount=true)
checkReadPermissionByType(string $documentType)
static getEntityIdForType(string $docType)
static getUserFieldsForType(string $docType)
static getTableClassByType(string $docType)
static getRow(array $parameters)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
global $USER_FIELD_MANAGER