- Модуль: timeman
- Путь к файлу: ~/bitrix/modules/timeman/classes/general/timeman_entry.php
- Класс: CAllTimeManEntry
- Вызов: CAllTimeManEntry::Approve
static function Approve($ID, $check_rights = true)
{
if ($check_rights)
{
$hasAccess = false;
$arAccessUsers = CTimeMan::GetAccess();
if (count($arAccessUsers['WRITE']) > 0)
{
$bCanEditAll = in_array('*', $arAccessUsers['WRITE']);
$dbRes = CTimeManEntry::GetList(
[],
['ID' => $ID],
false, false, ['*']
);
$arRes = $dbRes->Fetch();
if ($arRes)
{
$hasAccess = ($bCanEditAll || in_array($arRes['USER_ID'], $arAccessUsers['WRITE']));
}
}
if (!$hasAccess)
{
$GLOBALS['APPLICATION']->ThrowException('Access denied');
return false;
}
}
if (CTimeManEntry::Update($ID, ['ACTIVE' => 'Y']))
{
CTimeManReport::Approve($ID);
CTimeManReportDaily::SetActive($ID);
CTimeManNotify::SendMessage($ID, 'U');
return true;
}
return false;
}