• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskfiles.php
  • Класс: CTaskFiles
  • Вызов: CTaskFiles::CheckFields
function CheckFields(&$arFields, /** @noinspection PhpUnusedParameterInspection */ $ID = false)
{
	/**
	 * @global CMain $APPLICATION
	 */
	global $APPLICATION;

	$arMsg = Array();

	if (!is_set($arFields, "TASK_ID"))
	{
		$arMsg[] = array("text" => GetMessage("TASKS_BAD_TASK_ID"), "id" => "ERROR_TASKS_BAD_TASK_ID");
	}
	else
	{
		/** @noinspection PhpDeprecationInspection */
		$r = CTasks::GetByID($arFields["TASK_ID"], false);
		if (!$r->Fetch())
		{
			$arMsg[] = array("text" => GetMessage("TASKS_BAD_TASK_ID_EX"), "id" => "ERROR_TASKS_BAD_TASK_ID_EX");
		}
	}

	if (!is_set($arFields, "FILE_ID"))
	{
		$arMsg[] = array("text" => GetMessage("TASKS_BAD_FILE_ID"), "id" => "ERROR_TASKS_BAD_FILE_ID");
	}
	else
	{

		$r = CFile::GetByID($arFields["FILE_ID"]);
		if (!$r->Fetch())
		{
			$arMsg[] = array("text" => GetMessage("TASKS_BAD_FILE_ID_EX"), "id" => "ERROR_TASKS_BAD_FILE_ID_EX");
		}
	}

	if (!empty($arMsg))
	{
		$e = new CAdminException($arMsg);
		$APPLICATION->ThrowException($e);
		return false;
	}

	return true;
}