• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/controller/locationajax.php
  • Класс: BitrixCalendarControllerLocationAjax
  • Вызов: LocationAjax::cancelBookingAction
public function cancelBookingAction(): ?array
{
	if (Loader::includeModule('intranet') && !BitrixIntranetUtil::isIntranetUser())
	{
		return [];
	}

	$request = $this->getRequest();

	$params['recursion_mode'] = $request->getPost('recursion_mode');
	$params['parent_event_id'] = (int)$request->getPost('parent_event_id');
	$params['section_id'] = (int)$request->getPost('section_id');
	$params['current_event_date_from'] = $request->getPost('current_event_date_from');
	$params['current_event_date_to'] = $request->getPost('current_event_date_to');
	$params['owner_id'] = (int)$request->getPost('owner_id');

	/** @var SectionModel $sectionModel */
	$sectionModel =
		SectionModel::createFromId($params['section_id'])
			->setType(Dictionary::CALENDAR_TYPE['location'])
	;
	$accessController = new SectionAccessController(CCalendar::GetUserId());
	if (!$accessController->check(ActionDictionary::ACTION_SECTION_ACCESS, $sectionModel, []))
	{
		$this->addError(new BitrixMainError(Loc::getMessage('EC_ACCESS_DENIED')));
		return [];
	}

	$manager =
		RoomsManager::createInstance()
		->cancelBooking($params)
	;

	if ($manager->getError())
	{
		$this->addError(
			$manager->getError()
		);
	}

	return [];
}