- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskitem.php
- Класс: CTaskItem
- Вызов: CTaskItem::startWatch
public function startWatch($userId = 0, $bSkipNotification = false)
{
// Force reload cache
$this->markCacheAsDirty();
try
{
$arTask = $this->getData($bEscaped = false);
}
catch (TasksException $e)
{
static::throwExceptionVerbose();
}
if(!($userId = intval($userId)))
{
$userId = $this->executiveUserId;
}
self::pinInStage($this->getId(), array(
'AUDITORS' => $userId
));
// Am I auditor?
if ( ! in_array($userId, $arTask['AUDITORS']))
{
$arTask['AUDITORS'][] = $userId;
$arFields = array('AUDITORS' => $arTask['AUDITORS']);
$this->markCacheAsDirty();
$o = new CTasks();
$arParams = array(
'USER_ID' => $this->executiveUserId,
'CHECK_RIGHTS_ON_FILES' => true,
'SKIP_NOTIFICATION' => $bSkipNotification
);
/** @noinspection PhpDeprecationInspection */
if ($o->update($this->taskId, $arFields, $arParams) !== true)
{
static::throwExceptionVerbose($o->GetErrors());
}
}
}