- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/dispatcher/publicaction/task/reminder.php
- Класс: Bitrix\Tasks\Dispatcher\PublicAction\Task\Reminder
- Вызов: Reminder::add
public function add(array $data, array $parameters = array())
{
$result = [];
if (!TaskAccessController::can($this->userId, ActionDictionary::ACTION_TASK_READ, (int)$data['TASK_ID']))
{
$this->addForbiddenError();
return $result;
}
if($taskId = $this->checkTaskId($data['TASK_ID']))
{
// todo: introduce a new policy here: who can add a new reminder for a different user OR even for himself?
$reminder = new \CTaskReminders();
$field = array(
"TASK_ID" => $taskId,
"USER_ID" => $this->userId,
"REMIND_DATE" => $data["DATE"],
"TYPE" => $data["TYPE"],
"TRANSPORT" => $data["TRANSPORT"]
);
if(!$reminder->add($field))
{
throw new \Bitrix\Tasks\ActionFailedException('Reminder add', array(
'AUX' => array(
'ERROR' => array(
'TASK_ID' => $taskId,
),
)
));
}
}
return $result;
}