• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/update/timemanversion19converter.php
  • Класс: BitrixTimemanUpdateTimemanVersion19Converter
  • Вызов: TimemanVersion19Converter::createScheduleForm
private function createScheduleForm($key = null)
{
	$restrictions = [
		ScheduleTable::WORKTIME_RESTRICTION_ALLOWED_TO_REOPEN_RECORD => COption::getOptionString('timeman', 'workday_close_undo', 'Y') === 'Y',
		ScheduleTable::WORKTIME_RESTRICTION_ALLOWED_TO_EDIT_RECORD => COption::getOptionString('timeman', 'workday_can_edit_current', 'Y') === 'Y',
	];

	$shiftStart = COption::getOptionInt('timeman', 'workday_start', 32400);
	$shiftEnd = COption::getOptionInt('timeman', 'workday_finish', 64800);
	$scheduleForm = new BitrixTimemanFormScheduleScheduleForm();

	if ($key === 'FREE')
	{
		$scheduleForm->load([
			$scheduleForm->getFormName() => [
				'type' => ScheduleTable::SCHEDULE_TYPE_FLEXTIME,
				'name' => Loc::getMessage('TIMEMAN_CONVERTER_SCHEDULE_FLEXTIME_NAME'),
				'reportPeriod' => ScheduleTable::REPORT_PERIOD_MONTH,
				'reportPeriodStartWeekDay' => ScheduleTable::REPORT_PERIOD_OPTIONS_START_WEEK_DAY_MONDAY,
				'worktimeRestrictions' => [
					ScheduleTable::WORKTIME_RESTRICTION_ALLOWED_TO_REOPEN_RECORD => true,
					ScheduleTable::WORKTIME_RESTRICTION_ALLOWED_TO_EDIT_RECORD => true,
				],
				'assignments' => [],
				'ShiftForm' => [],
				'CalendarForm' => [
					'calendarId' => '',
					'parentId' => '',
					'datesJson' => '{}',
				],
				'ViolationForm' => [
					'scheduleId' => '',
					'maxExactStartFormatted' => '--:--',
					'minExactEndFormatted' => '--:--',
					'relativeStartFromFormatted' => '--:--',
					'relativeStartToFormatted' => '--:--',
					'relativeEndFromFormatted' => '--:--',
					'relativeEndToFormatted' => '--:--',
					'minDayDurationFormatted' => '--:--',
					'maxAllowedToEditWorkTimeFormatted' => '--:--',
					'maxShiftStartDelayFormatted' => '--:--',
					'maxWorkTimeLackForPeriod' => '',
				],
				'controlledActions' => ScheduleTable::CONTROLLED_ACTION_START_AND_END,
				'allowedDevices' => [
					'browser' => 'on',
					'b24time' => 'on',
					'mobile' => 'on',
					'mobileRecordLocation' => '',
				],
			],
		]);
		return $scheduleForm;

	}

	$scheduleForm->load([
		$scheduleForm->getFormName() => [
			'type' => ScheduleTable::SCHEDULE_TYPE_FIXED,
			'name' => Loc::getMessage('TIMEMAN_CONVERTER_SCHEDULE_FOR_ALL_USERS_NAME'),
			'reportPeriod' => ScheduleTable::REPORT_PERIOD_MONTH,
			'reportPeriodStartWeekDay' => ScheduleTable::REPORT_PERIOD_OPTIONS_START_WEEK_DAY_MONDAY,
			'worktimeRestrictions' => $restrictions,
			'assignments' => [],
			'ShiftForm' => [
				[
					'shiftId' => '',
					'workDays' => '12345',
					'name' => '',
					'startTimeFormatted' => TimeHelper::getInstance()->convertSecondsToHoursMinutes($shiftStart),
					'endTimeFormatted' => TimeHelper::getInstance()->convertSecondsToHoursMinutes($shiftEnd),
					'breakDurationFormatted' => '00:00',
				],
			],
			'CalendarForm' => [
				'calendarId' => '',
				'parentId' => '',
				'datesJson' => '{}',
			],
			'ViolationForm' => [
				'scheduleId' => '',
				'maxExactStartFormatted' => '--:--',
				'minExactEndFormatted' => '--:--',
				'relativeStartFromFormatted' => '--:--',
				'relativeStartToFormatted' => '--:--',
				'relativeEndFromFormatted' => '--:--',
				'relativeEndToFormatted' => '--:--',
				'minDayDurationFormatted' => '--:--',
				'maxAllowedToEditWorkTimeFormatted' => '--:--',
				'maxShiftStartDelayFormatted' => '--:--',
				'maxWorkTimeLackForPeriod' => '',
			],
			'controlledActions' => ScheduleTable::CONTROLLED_ACTION_START_AND_END,
			'allowedDevices' => [
				'browser' => 'on',
				'b24time' => 'on',
				'mobile' => 'on',
				'mobileRecordLocation' => '',
			],
		],
	]);

	return $scheduleForm;
}