• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/checklist/checklistfacade.php
  • Класс: BitrixTasksCheckListCheckListFacade
  • Вызов: CheckListFacade::update
static function update($entityId, $userId, CheckList $checkList, $fields)
{
	$updateResult = new Result();

	$code = 'ACTION_NOT_ALLOWED';

	if (
		array_key_exists('IS_COMPLETE', $fields)
		&& count($fields) === 1
	)
	{
		if (!static::checkAccess($entityId, $userId, ActionDictionary::ACTION_CHECKLIST_TOGGLE, $checkList))
		{
			$updateResult = static::addErrorToResult($updateResult, $code, self::ACTION_TOGGLE);
			return $updateResult;
		}
		$checkList->setSkipMembers();
	}
	else if (!static::checkAccess($entityId, $userId, ActionDictionary::ACTION_CHECKLIST_EDIT, $checkList))
	{
		$updateResult = static::addErrorToResult($updateResult, $code, self::ACTION_MODIFY);
		return $updateResult;
	}

	$fieldsChecking = static::checkFieldsForUpdate($fields);
	if (!$fieldsChecking->isSuccess())
	{
		$updateResult->loadErrors($fieldsChecking->getErrors());
		return $updateResult;
	}

	$checkList->setFields($fields);
	$updateResult = $checkList->save();

	static::onAfterUpdate($entityId);
	return $updateResult;
}