Current Path : /home/bitrix/ext_www/school1535.yacl.site/local/ajax/ |
Current File : /home/bitrix/ext_www/school1535.yacl.site/local/ajax/quickTaskAdd.php |
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); \Bitrix\Main\Loader::includeModule('tasks'); $taskFields = [ 'TITLE' => htmlspecialchars($_POST['fast-task-title']), 'CREATED_BY' => $USER->GetID(), 'RESPONSIBLE_ID' => $USER->GetID(), ]; $timeSpent = intval($_POST['fast-task-time']); if ($timeSpent && $timeSpent <= 120) { try { $res = CTaskItem::add($taskFields, $USER->GetID()); $id = $res->getId(); if ($id > 0) { $timeRes = CTaskElapsedItem::add($res, [ 'MINUTES' => $timeSpent, 'USER_ID' => $USER->GetID(), 'COMMENT_TEXT' => htmlspecialchars($_POST['fast-task-done']), ]); } } catch (Exception $e) { $error = $e->getMessage(); } } else { $error = 'Неверно указано время!'; } echo $error ? $error : ''; //okp($_POST);