Task::prepareFieldsToCopy

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Task
  4. prepareFieldsToCopy
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/copy/implement/task.php
  • Класс: BitrixTasksCopyImplementTask
  • Вызов: Task::prepareFieldsToCopy
public function prepareFieldsToCopy(Container $container, array $fields)
{
	$dictionary = $container->getDictionary();

	$dictionary["FORUM_TOPIC_ID"] = $fields["FORUM_TOPIC_ID"];
	$dictionary["REPLICATE"] = ($fields["REPLICATE"] === "Y" ? "Y" : "N");

	$container->setDictionary($dictionary);

	if ($this->targetGroupId)
	{
		$fields["GROUP_ID"] = $this->targetGroupId;
	}

	if (!empty($container->getParentId()))
	{
		$fields["PARENT_ID"] = $container->getParentId();
	}

	// it's really possible:
	// http://jabber.bx/view.php?id=161576
	// http://jabber.bx/view.php?id=162694
	if ($this->projectTerm && !empty($fields['CREATED_DATE']))
	{
		$isProject = (!empty($this->projectTerm["project"]));

		if ($isProject)
		{
			if (!empty($fields["DEADLINE"]))
			{
				$fields["DEADLINE"] = $this->getProjectDeadline($fields["DEADLINE"], $fields["CREATED_DATE"]);
			}
			if (!empty($fields["START_DATE_PLAN"]))
			{
				$fields["START_DATE_PLAN"] = $this->getProjectDatePlan(
					$fields["START_DATE_PLAN"], $fields["CREATED_DATE"]);
			}
			if (!empty($fields["END_DATE_PLAN"]))
			{
				$fields["END_DATE_PLAN"] = $this->getProjectDatePlan(
					$fields["END_DATE_PLAN"], $fields["CREATED_DATE"]);
			}
		}
		else
		{
			if (!empty($fields["DEADLINE"]))
			{
				$fields["DEADLINE"] = $this->getGroupDeadline($fields["DEADLINE"], $fields["CREATED_DATE"]);
			}
			if (!empty($fields["START_DATE_PLAN"]))
			{
				$fields["START_DATE_PLAN"] = $this->getGroupDatePlan(
					$fields["START_DATE_PLAN"], $fields["CREATED_DATE"]);
			}
			if (!empty($fields["END_DATE_PLAN"]))
			{
				$fields["END_DATE_PLAN"] = $this->getGroupDatePlan(
					$fields["END_DATE_PLAN"], $fields["CREATED_DATE"]);
			}
		}
	}

	$fields = $this->cleanDataToCopy($fields);

	return $fields;
}

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