- Модуль: timeman
- Путь к файлу: ~/bitrix/modules/timeman/lib/form/schedule/scheduleform.php
- Класс: BitrixTimemanFormScheduleScheduleForm
- Вызов: ScheduleForm::runAfterValidate
protected function runAfterValidate()
{
parent::runAfterValidate();
if (!$this->hasErrors('assignments'))
{
$this->fillAssignments('assignments', 'userIds', 'departmentIds', true);
}
if (!$this->hasErrors('assignmentsExcluded'))
{
$this->fillAssignments('assignmentsExcluded', 'userIdsExcluded', 'departmentIdsExcluded');
}
// remove ids if they are included and excluded at the same time
foreach (array_intersect($this->userIds, $this->userIdsExcluded) as $id)
{
$this->userIds = $this->filterDuplicateId($this->userIds, $id);
$this->userIdsExcluded = $this->filterDuplicateId($this->userIdsExcluded, $id);
}
foreach (array_intersect($this->departmentIds, $this->departmentIdsExcluded) as $id)
{
$this->departmentIds = $this->filterDuplicateId($this->departmentIds, $id);
$this->departmentIdsExcluded = $this->filterDuplicateId($this->departmentIdsExcluded, $id);
}
if ($this->isFixed() && !empty($this->shiftForms))
{
$days = [];
foreach ($this->shiftForms as $shiftForm)
{
if ($shiftForm->workDays)
{
$days = array_merge($days, str_split($shiftForm->workDays));
}
}
if (count(array_unique($days)) !== count($days))
{
$this->addError('shiftForms.0.workDays', Loc::getMessage('TM_SCHEDULE_FORM_ERROR_DUPLICATE_WORK_DAYS'));
}
}
}