• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/historyservice.php
  • Класс: CBPHistoryService
  • Вызов: CBPHistoryService::prepareFileForHistory
static function prepareFileForHistory($documentId, $arFileId, $historyIndex)
{
	$dest = self::GenerateFilePath($documentId);

	$fileParameterIsArray = true;
	if (!is_array($arFileId))
	{
		$arFileId = array($arFileId);
		$fileParameterIsArray = false;
	}

	$result = array();

	foreach ($arFileId as $fileId)
	{
		if($ar = CFile::GetFileArray($fileId))
		{
			$newFilePath = CFile::CopyFile($fileId, false, $dest."/".$historyIndex."/".$ar["FILE_NAME"]);
			if ($newFilePath)
				$result[] = $newFilePath;
		}
	}

	if (!$fileParameterIsArray)
	{
		if (count($result) > 0)
			$result = $result[0];
		else
			$result = "";
	}

	return $result;
}