• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/task/template.php
  • Класс: BitrixTasksInternalsTaskTemplateTable
  • Вызов: TemplateTable::getMap
static function getMap()
{
	return array(

		// common with TaskTable
		'ID' => array(
			'data_type' => 'integer',
			'primary' => true,
			'autocomplete' => true,
		),
		'TITLE' => array(
			'data_type' => 'string',
			'required' => true,
			'validation' => array(__CLASS__, 'validateTitle'),
			'title' => Loc::getMessage('TASKS_TASK_TEMPLATE_ENTITY_TITLE_FIELD'),
		),
		'DESCRIPTION' => array(
			'data_type' => 'text',
		),
		'DESCRIPTION_IN_BBCODE' => array(
			'data_type' => 'boolean',
			'values' => array('N', 'Y'),
			'default_value' => 'Y',
		),
		new EnumField('PRIORITY', [
			'values' => array_merge(
				array_values(Priority::getAll()),
				array_map('strval', array_values(Priority::getAll()))
			),
			'default_value' => (string)Priority::AVERAGE,
		]),

		// wtf? status in template?
		'STATUS' => array(
			'data_type' => 'string',
			'default_value' => '1',
			'validation' => array(__CLASS__, 'validateStatus'),
		),
		'RESPONSIBLE_ID' => array(
			'data_type' => 'integer',
			'required' => true,
			'title' => Loc::getMessage('TASKS_TASK_TEMPLATE_ENTITY_RESPONSIBLE_ID_FIELD'),
		),
		'TIME_ESTIMATE' => array( // in seconds
			'data_type' => 'integer',
			'default_value' => '0',
		),
		'REPLICATE' => array(
			'data_type' => 'boolean',
			'values' => array('N', 'Y'),
			'default_value' => 'N',
		),
		'CREATED_BY' => array(
			'data_type' => 'integer',
			'required' => true,
			'title' => Loc::getMessage('TASKS_TASK_TEMPLATE_ENTITY_CREATED_BY_FIELD'),
		),
		'XML_ID' => array(
			'data_type' => 'string',
			'validation' => array(__CLASS__, 'validateXmlId'),
		),
		'ALLOW_CHANGE_DEADLINE' => array(
			'data_type' => 'boolean',
			'values' => array('N', 'Y'),
			'default_value' => 'N',
		),
		'ALLOW_TIME_TRACKING' => array(
			'data_type' => 'boolean',
			'values' => array('N', 'Y'),
			'default_value' => 'N',
		),
		'TASK_CONTROL' => array(
			'data_type' => 'boolean',
			'values' => array('N', 'Y'),
			'default_value' => 'N',
		),
		'ADD_IN_REPORT' => array(
			'data_type' => 'boolean',
			'values' => array('N', 'Y'),
			'default_value' => 'N',
		),
		'MATCH_WORK_TIME' => array(
			'data_type' => 'boolean',
			'values' => array('N', 'Y'),
			'default_value' => 'N',
		),
		'GROUP_ID' => array(
			'data_type' => 'integer',
		),
		'PARENT_ID' => array(
			'data_type' => 'integer',
		),
		'MULTITASK' => array(
			'data_type' => 'boolean',
			'values' => array('N', 'Y'),
			'default_value' => 'N',
		),
		'SITE_ID' => array(
			'data_type' => 'string',
			'required' => true,
			'validation' => array(__CLASS__, 'validateSiteId'),
			'title' => Loc::getMessage('TASKS_TASK_TEMPLATE_ENTITY_SITE_ID_FIELD'),
		),

		// template-specific
		'REPLICATE_PARAMS' => array(
			'data_type' => 'text',
		),
		'TAGS' => array(
			'data_type' => 'text',
		),
		'ACCOMPLICES' => array(
			'data_type' => 'text',
		),
		'AUDITORS' => array(
			'data_type' => 'text',
		),
		'RESPONSIBLES' => array(
			'data_type' => 'text',
		),
		'DEPENDS_ON' => array(
			'data_type' => 'text',
		),
		'DEADLINE_AFTER' => array(
			'data_type' => 'integer',
		),
		'START_DATE_PLAN_AFTER' => array(
			'data_type' => 'integer',
		),
		'END_DATE_PLAN_AFTER' => array(
			'data_type' => 'integer',
		),
		'TASK_ID' => array(
			'data_type' => 'integer',
		),

		// template parameters
		'TPARAM_TYPE' => array(
			'data_type' => 'integer',
			//'validation' => array(__CLASS__, 'validateType'),
		),
		'TPARAM_REPLICATION_COUNT' => array(
			'data_type' => 'integer',
			'default_value' => 0,
		),
		'ZOMBIE' => array(
			'data_type' => 'text',
			'default_value' => 'N'
		),

		// deprecated
		'FILES' => array(
			'data_type' => 'string',
		),

		// references
		'CREATOR' => [
			'data_type' => 'BitrixMainUser',
			'reference' => ['=this.CREATED_BY' => 'ref.ID']
		],
		'RESPONSIBLE' => [
			'data_type' => 'BitrixMainUser',
			'reference' => ['=this.RESPONSIBLE_ID' => 'ref.ID']
		],
		(new OneToMany("MEMBERS", TemplateMemberTable::class, "TEMPLATE")),
		(new OneToMany("TAG_LIST", TemplateTagTable::class, "TEMPLATE")),
		(new OneToMany("DEPENDENCIES", TemplateDependenceTable::class, "TEMPLATE")),
		(
			new Reference(
				'SCENARIO',
				BitrixTasksInternalsTaskTemplateScenarioTable::class,
				Join::on('this.ID', 'ref.TEMPLATE_ID')
			)
		)->configureJoinType('left'),
		(new Reference(
			'CHECKLIST_DATA',
			BitrixTasksInternalsTaskTemplateCheckListTable::getEntity(),
			['this.ID' => 'ref.TEMPLATE_ID'],
		))->configureJoinType(Join::TYPE_LEFT)
	);
}