• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskdependence.php
  • Класс: CTaskDependence
  • Вызов: CTaskDependence::CheckFields
function CheckFields(&$arFields)
{
	/** @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
	{
		$r = CTasks::GetByID($arFields["TASK_ID"]);
		if (!$r->Fetch())
		{
			$arMsg[] = array("text" => GetMessage("TASKS_BAD_TASK_ID_EX"), "id" => "ERROR_TASKS_BAD_TASK_ID_EX");
		}
	}

	if (!is_set($arFields, "DEPENDS_ON_ID"))
	{
		$arMsg[] = array("text" => GetMessage("TASKS_BAD_DEPENDS_ON_ID"), "id" => "ERROR_TASKS_BAD_DEPENDS_ON_ID");
	}
	else
	{
		$r = CTasks::GetByID($arFields["DEPENDS_ON_ID"]);
		if (!$r->Fetch())
		{
			$arMsg[] = array("text" => GetMessage("TASKS_BAD_DEPENDS_ON_ID_EX"), "id" => "ERROR_TASKS_BAD_DEPENDS_ON_ID_EX");
		}
	}

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

	return true;
}