• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskitem.php
  • Класс: CTaskItem
  • Вызов: CTaskItem::removeAttachedFile
public function removeAttachedFile($fileId)
{
	CTaskAssert::assertLaxIntegers($fileId);
	CTaskAssert::assert($fileId > 0);

	if ( ! $this->checkAccess(ActionDictionary::ACTION_TASK_EDIT) )
	{
		CTaskAssert::log(
			'access denied while trying to remove file: fileId=' . $fileId
			. ', taskId=' . $this->taskId . ', userId=' . $this->executiveUserId,
			CTaskAssert::ELL_WARNING
		);

		throw new TasksException('', TasksException::TE_ACTION_NOT_ALLOWED);
	}

	if ( ! CTaskFiles::Delete($this->taskId, $fileId) )
	{
		throw new TasksException(
			'File #' . $fileId . ' not attached to task #' . $this->taskId,
			TasksException::TE_FILE_NOT_ATTACHED_TO_TASK
		);
	}
}