public static function update($userId, $taskId, array $data, array $parameters = array('PUBLIC_MODE' => false, 'RETURN_ENTITY' => false)) { $errors = new Collection(); if ($parameters['PUBLIC_MODE']) { $data = static::filterData($data, $errors); } if ($errors->checkNoFatals()) { $cacheAFWasDisabled = \CTasks::disableCacheAutoClear(); $notifADWasDisabled = \CTaskNotifications::disableAutoDeliver(); $updateParams = array('TASK_ACTION_UPDATE_PARAMETERS' => array('THROTTLE_MESSAGES' => $parameters['THROTTLE_MESSAGES'])); $data = static::prepareData($userId, $data); $task = static::doUpdate($userId, $taskId, $data, $updateParams, $errors); if ($notifADWasDisabled) { \CTaskNotifications::enableAutoDeliver(); } if ($cacheAFWasDisabled) { \CTasks::enableCacheAutoClear(); } if ($errors->checkNoFatals()) { $data = array('ID' => $task->getId()); if ($parameters['RETURN_ENTITY']) { $data = $task->getData(false); $can = static::translateAllowedActionNames($task->getAllowedActions(true)); } } } return array('TASK' => $task, 'ERRORS' => $errors, 'DATA' => $data, 'CAN' => $can); }
/** * Update a task with some new data */ public function update($id, array $data, array $parameters = array()) { global $USER; $result = array(); if ($id = $this->checkTaskId($id)) { if (!empty($data)) { $cacheAFWasDisabled = \CTasks::disableCacheAutoClear(); $notifADWasDisabled = \CTaskNotifications::disableAutoDeliver(); $task = new \CTaskItem($id, $USER->GetId()); $task->update($data); if ($notifADWasDisabled) { \CTaskNotifications::enableAutoDeliver(); } if ($cacheAFWasDisabled) { \CTasks::enableCacheAutoClear(); } if ($parameters['RETURN_OPERATION_RESULT_DATA']) { $result['DATA']['OPERATION_RESULT'] = $task->getLastOperationResultData('UPDATE'); } } } return $result; }
private static function disableUpdateBatchMode() { if (self::$notifADWasDisabled) { CTaskNotifications::enableAutoDeliver(); } if (self::$cacheAFWasDisabled) { CTasks::enableCacheAutoClear(); } }
public static function throttleRelease() { $items = ThrottleTable::getUpdateMessages(); if (is_array($items) && !empty($items)) { $cacheAFWasDisabled = \CTasks::disableCacheAutoClear(); $notifADWasDisabled = \CTaskNotifications::disableAutoDeliver(); // this function may be called on agent, so DO NOT relay on $USER as an author, use field AUTHOR_ID instead foreach ($items as $item) { //_dump_r('Release for '.$item['TASK_ID'].' from '.$item['AUTHOR_ID']); self::SendUpdateMessage($item['STATE_LAST'], $item['STATE_ORIG'], false, array('AUTHOR_ID' => $item['AUTHOR_ID'], 'IGNORE_AUTHOR' => isset($item['IGNORE_RECEPIENTS'][$item['AUTHOR_ID']]))); } if ($notifADWasDisabled) { \CTaskNotifications::enableAutoDeliver(); } if ($cacheAFWasDisabled) { \CTasks::enableCacheAutoClear(); } } }