$arResult['ERRORS'][] = array('text' => 'UNKNOWN ERROR OCCURED', 'id' => 'ERROR_TASKS_UNKNOWN'); } } $arTemplateFields = $arFields; if ($arTemplateFields["MULTITASK"] == "Y") { $arTemplateFields["RESPONSIBLES"] = serialize($_POST["RESPONSIBLES"]); } // Save checklist data $arChecklistItems = $APPLICATION->IncludeComponent("bitrix:tasks.task.detail.parts", ".default", array('MODE' => 'JUST AFTER TASK CREATED', 'BLOCKS' => array("checklist"), 'TASK_ID' => (int) $taskID), null, array('HIDE_ICONS' => 'Y')); if ($taskID) { if (isset($arResult['COPY_PARAMS'])) { try { // copy child tasks if ($arResult['COPY_PARAMS']['COPY_CHILD_TASKS'] && intval($arResult['COPY_PARAMS']['ORIGIN_TASK'])) { $parentTaskInstance = new CTaskItem(intval($arResult['COPY_PARAMS']['ORIGIN_TASK']), $loggedInUserId); $parentTaskInstance->duplicateChildTasks($oTask); } // create child tasks by child templates if ($arResult['COPY_PARAMS']['COPY_CHILD_TEMPLATES'] && intval($arResult['COPY_PARAMS']['ORIGIN_TEMPLATE'])) { // get template to ensure we own it... $templateData = CTaskTemplates::GetList(false, array('ID' => intval($arResult['COPY_PARAMS']['ORIGIN_TEMPLATE'])), false, array('USER_ID' => $loggedInUserId), array('ID'))->fetch(); if (is_array($templateData)) { $oTask->addChildTasksByTemplate(intval($arResult['COPY_PARAMS']['ORIGIN_TEMPLATE'])); // task access rights check inside } } } catch (Exception $e) { if ($e->GetCode() & TasksException::TE_FLAG_SERIALIZED_ERRORS_IN_MESSAGE) { $arResult['ERRORS'] = unserialize($e->GetMessage()); } else { $arResult['ERRORS'][] = array('text' => 'UNKNOWN ERROR OCCURED', 'id' => 'ERROR_TASKS_UNKNOWN');