- Модуль: timeman
- Путь к файлу: ~/bitrix/modules/timeman/lib/service/agent/worktimeagentmanager.php
- Класс: BitrixTimemanServiceAgentWorktimeAgentManager
- Вызов: WorktimeAgentManager::deleteAutoClosingAgents
public function deleteAutoClosingAgents(Schedule $schedule, $shiftCollection = null)
{
$shiftCollection = $shiftCollection === null ? new ShiftCollection() : $shiftCollection;
$result = new WorktimeServiceResult();
$records = $this->worktimeRepository->findAll(
['ID', 'AUTO_CLOSING_AGENT_ID',],
$this->worktimeRepository->buildOpenRecordsQuery($schedule, $shiftCollection)
->where('AUTO_CLOSING_AGENT_ID', '>', 0)
);
if ($records->count() === 0)
{
return $result;
}
$this->deleteAgentsByIds($records->getAutoClosingAgentIdList());
$this->worktimeRepository->saveAll($records, ['AUTO_CLOSING_AGENT_ID' => 0]);
return $result;
}