コード例 #1
0
ファイル: timeman_entry.php プロジェクト: DarneoStudio/bitrix
 public 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(array(), array('ID' => $ID), false, false, array('*'));
             $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, array('ACTIVE' => 'Y'))) {
         CTimeManReport::Approve($ID);
         CTimeManReportDaily::SetActive($ID);
         CTimeManNotify::SendMessage($ID, 'U');
         return true;
     }
     return false;
 }