• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/util/replicator/task/fromtemplate.php
  • Класс: BitrixTasksUtilReplicatorTaskFromTemplate
  • Вызов: FromTemplate::getSubItemData
private function getSubItemData($id)
{
	$result = array();

	$id = intval($id);
	if(!$id)
	{
		return $result;
	}

	// todo: move it to BitrixTasksItemTaskTemplate::find(array('select' => array('*', 'SE_CHECKLIST')))
	// todo: do not forget about access controller
	$res = CTaskTemplates::getList(array('BASE_TEMPLATE_ID' => 'asc'), array('BASE_TEMPLATE_ID' => $id), false, array('INCLUDE_TEMPLATE_SUBTREE' => true), array('*', 'UF_*', 'BASE_TEMPLATE_ID'));
	while($item = $res->fetch())
	{
		if($item['ID'] == $id)
		{
			continue;
		}

		// unpack values
		$item['RESPONSIBLES'] = unserialize($item['RESPONSIBLES'] ?? '', ['allowed_classes' => false]);
		$item['ACCOMPLICES'] = unserialize($item['ACCOMPLICES'] ?? '', ['allowed_classes' => false]);
		$item['AUDITORS'] = unserialize($item['AUDITORS'] ?? '', ['allowed_classes' => false]);
		$item['TAGS'] = unserialize($item['TAGS'] ?? '', ['allowed_classes' => false]);
		$item['REPLICATE_PARAMS'] = unserialize($item['REPLICATE_PARAMS'] ?? '', ['allowed_classes' => false]);
		$item['DEPENDS_ON'] = unserialize($item['DEPENDS_ON'] ?? '', ['allowed_classes' => false]);

		$result[$item['ID']] = $item;
	}

	// get checklist data
	// todo: convert getListByTemplateDependency() to a runtime mixin for the template entity
	$res = BitrixTasksInternalsTaskTemplateCheckListTable::getListByTemplateDependency($id, array(
		'order' => array('SORT' => 'ASC'),
		'select' => array('ID', 'TEMPLATE_ID', 'CHECKED', 'SORT', 'TITLE')
	));
	while($item = $res->fetch())
	{
		if(isset($result[$item['TEMPLATE_ID']]))
		{
			$result[$item['TEMPLATE_ID']]['SE_CHECKLIST'][$item['ID']] = $item;
		}
	}

	return $result;
}