- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/item/task/template.php
- Класс: BitrixTasksItemTaskTemplate
- Вызов: Template::checkFieldCombinations
private function checkFieldCombinations($result)
{
if($this->isFieldModified('TPARAM_TYPE'))
{
if($this->getActualFieldValue('TPARAM_TYPE') == 1) // type is or intend to be 1
{
// you cant replicate because of new user
if($this->getActualFieldValue('REPLICATE') == 'Y')
{
$this->setNoReplicationAllowed($result, Loc::getMessage('TASKS_ITEM_TASK_TEMPLATE_NO_REPLICATION_ALLOWED_ERROR_BECAUSE_TYPE_1'));
}
// you cant use base template because of new user
if($this->getActualFieldValue('BASE_TEMPLATE_ID'))
{
$this->setNoBaseTemplateAllowed($result, Loc::getMessage('TASKS_ITEM_TASK_TEMPLATE_NO_BASE_TEMPLATE_ALLOWED_ERROR_BECAUSE_TYPE_1'));
}
// you cant do multitasking because of new user
if($this->getActualFieldValue('MULTITASK') == 'Y')
{
$this->setNoMultitaskingAllowed($result, Loc::getMessage('TASKS_ITEM_TASK_TEMPLATE_NO_MULTITASKING_ALLOWED_ERROR_BECAUSE_TYPE_1'));
}
}
}
if($this->isFieldModified('REPLICATE'))
{
if($this->getActualFieldValue('REPLICATE') == 'Y') // template is replicating or will be
{
// you cant use base template because of REPLICATE
if($this->getActualFieldValue('BASE_TEMPLATE_ID'))
{
$this->setNoBaseTemplateAllowed($result, Loc::getMessage('TASKS_ITEM_TASK_TEMPLATE_NO_BASE_TEMPLATE_ALLOWED_ERROR_BECAUSE_REPLICATION'));
}
// you cant set type to 1 because of REPLICATE
if($this->getActualFieldValue('TPARAM_TYPE') == 1)
{
$this->setNoTParamType1Allowed($result, Loc::getMessage('TASKS_ITEM_TASK_TEMPLATE_NO_TPARAM_TYPE_1_ALLOWED_ERROR_BECAUSE_REPLICATION'));
}
}
}
if($this->isFieldModified('BASE_TEMPLATE_ID'))
{
if($this->getActualFieldValue('BASE_TEMPLATE_ID')) // base template is set or will be set
{
// you cant replicate because of base template
if($this->getActualFieldValue('REPLICATE') == 'Y')
{
$this->setNoReplicationAllowed($result, Loc::getMessage('TASKS_ITEM_TASK_TEMPLATE_NO_REPLICATION_ALLOWED_ERROR_BASE_TEMPLATE_ID'));
}
// you cant set type to 1 because of base template
if($this->getActualFieldValue('TPARAM_TYPE') == 1)
{
$this->setNoTParamType1Allowed($result, Loc::getMessage('TASKS_ITEM_TASK_TEMPLATE_NO_TPARAM_TYPE_1_ALLOWED_ERROR_BASE_TEMPLATE_ID'));
}
}
}
if($this->isFieldModified('MULTITASK'))
{
if($this->getActualFieldValue('MULTITASK') == 'Y') // template is producing multitask or will be
{
// you cant set type to 1 because of MULTITASK
if($this->getActualFieldValue('TPARAM_TYPE') == 1)
{
$this->setNoTParamType1Allowed($result, Loc::getMessage('TASKS_ITEM_TASK_TEMPLATE_NO_TPARAM_TYPE_1_ALLOWED_ERROR_BECAUSE_MULTITASK'));
}
// you cant use base template because of MULTITASK
if($this->getActualFieldValue('BASE_TEMPLATE_ID'))
{
$this->setNoBaseTemplateAllowed($result, Loc::getMessage('TASKS_ITEM_TASK_TEMPLATE_NO_BASE_TEMPLATE_ALLOWED_ERROR_BECAUSE_MULTITASK'));
}
}
}
return $result;
}