- Модуль: timeman
- Путь к файлу: ~/bitrix/modules/timeman/lib/service/worktime/notification/worktimenotificationservice.php
- Класс: BitrixTimemanServiceWorktimeNotificationWorktimeNotificationService
- Вызов: WorktimeNotificationService::buildNotificationMessage
private function buildNotificationMessage($violation, $worktimeRecord)
{
$notifyMessage = '';
$gender = '_MALE';
if ($this->getUser($violation->userId) &&
$this->getUser($violation->userId)['PERSONAL_GENDER'] === 'F')
{
$gender = '_FEMALE';
}
switch ($violation->type)
{
case WorktimeViolation::TYPE_LATE_START:
$notifyMessage = Loc::getMessage(
'TM_VIOLATION_WORKTIME_MANAGER_LATE_START' . $gender,
['#USER_NAME#' => $this->getUserName($violation->userId)]
);
break;
case WorktimeViolation::TYPE_EARLY_START:
$notifyMessage = Loc::getMessage(
'TM_VIOLATION_WORKTIME_MANAGER_EARLY_START' . $gender,
['#USER_NAME#' => $this->getUserName($violation->userId)]
);
break;
case WorktimeViolation::TYPE_EARLY_ENDING:
$notifyMessage = Loc::getMessage(
'TM_VIOLATION_WORKTIME_MANAGER_EARLY_END' . $gender,
['#USER_NAME#' => $this->getUserName($violation->userId)]
);
break;
case WorktimeViolation::TYPE_LATE_ENDING:
$notifyMessage = Loc::getMessage(
'TM_VIOLATION_WORKTIME_MANAGER_LATE_END' . $gender,
['#USER_NAME#' => $this->getUserName($violation->userId)]
);
break;
case WorktimeViolation::TYPE_MIN_DAY_DURATION:
$notifyMessage = Loc::getMessage(
'TM_VIOLATION_WORKTIME_MANAGER_MIN_DAY_DURATION' . $gender,
['#USER_NAME#' => $this->getUserName($violation->userId)]
);
break;
case WorktimeViolation::TYPE_EDITED_ENDING:
case WorktimeViolation::TYPE_EDITED_START:
case WorktimeViolation::TYPE_EDITED_BREAK_LENGTH:
$date = $this->timeHelper->formatDateTime($worktimeRecord->getRecordedStartTimestamp(), 'j F');
$href = $this->urlManager->getUriTo('recordReport', ['RECORD_ID' => $worktimeRecord->getId()]);
$notifyMessage = Loc::getMessage(
'TM_VIOLATION_WORKTIME_MANAGER_EDIT_WITH_URL' . $gender,
[
'#USER_NAME#' => $this->getUserName($violation->userId),
'#URL#' => $href,
'#DATE#' => $date,
]
);
break;
case WorktimeViolation::TYPE_SHIFT_LATE_START:
$notifyMessage = Loc::getMessage(
'TM_VIOLATION_WORKTIME_MANAGER_LATE_SHIFT_START' . $gender,
['#USER_NAME#' => $this->getUserName($violation->userId)]
);
break;
}
return $notifyMessage;
}