Task::cloneDiskAttachments

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Task
  4. cloneDiskAttachments
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/control/task.php
  • Класс: BitrixTasksControlTask
  • Вызов: Task::cloneDiskAttachments
private function cloneDiskAttachments(array $fields): array
{
	if (
		!$this->cloneAttachments
		|| !Loader::includeModule('disk')
	)
	{
		return $fields;
	}

	if (
		array_key_exists('UF_TASK_WEBDAV_FILES', $fields)
		&& is_array($fields['UF_TASK_WEBDAV_FILES'])
		&& !empty($fields['UF_TASK_WEBDAV_FILES'])
	)
	{
		$source = $fields['UF_TASK_WEBDAV_FILES'];
		$fields['UF_TASK_WEBDAV_FILES'] = Disk::cloneFileAttachment($fields['UF_TASK_WEBDAV_FILES'], $this->userId);

		if (count($source) !== count($fields['UF_TASK_WEBDAV_FILES']))
		{
			return $fields;
		}

		$relations = array_combine($source, $fields['UF_TASK_WEBDAV_FILES']);
		$fields = $this->updateInlineFiles($fields, $relations);
	}

	return $fields;
}

Добавить комментарий