• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/service/schedule/scheduleservice.php
  • Класс: BitrixTimemanServiceScheduleScheduleService
  • Вызов: ScheduleService::removeShifts
private function removeShifts(Schedule $schedule, $scheduleForm = null)
{
	$existedShiftIds = $schedule->getShifts()->getIdList();
	$removedShiftIds = $existedShiftIds;
	if ($scheduleForm)
	{
		$removedShiftIds = array_diff($existedShiftIds, $scheduleForm->getShiftIds());
	}
	if (empty($existedShiftIds) || empty($removedShiftIds))
	{
		return new Result();
	}
	foreach ($removedShiftIds as $removedShiftId)
	{
		$this->safeRun($this->shiftService->deleteShiftById(
			$schedule->getShifts()->getByPrimary($removedShiftId),
			$schedule
		));
		$schedule->removeFromShifts($schedule->obtainShiftByPrimary($removedShiftId));
	}
	return new Result();
}