- Модуль: form
- Путь к файлу: ~/bitrix/modules/form/classes/mysql/form_cform.php
- Класс: CForm
- Вызов: CForm::GetByID
static function GetByID($ID, $GET_BY_SID="N")
{
$err_mess = (CForm::err_mess())."
Function: GetByID
Line: ";
global $DB, $strError;
$where = ($GET_BY_SID=="N") ? " F.ID = '".intval($ID)."' " : " F.SID='".$DB->ForSql($ID,50)."' ";
$strSql = "
SELECT
F.*,
F.FIRST_SITE_ID,
F.FIRST_SITE_ID LID,
F.SID,
F.SID VARNAME,
".$DB->DateToCharFunction("F.TIMESTAMP_X")." TIMESTAMP_X,
count(distinct D1.ID) C_FIELDS,
count(distinct D2.ID) QUESTIONS,
count(distinct S.ID) STATUSES
FROM b_form F
LEFT JOIN b_form_status S ON (S.FORM_ID = F.ID)
LEFT JOIN b_form_field D1 ON (D1.FORM_ID = F.ID and D1.ADDITIONAL='Y')
LEFT JOIN b_form_field D2 ON (D2.FORM_ID = F.ID and D2.ADDITIONAL<>'Y')
WHERE
$where
GROUP BY
F.ID
";
$res = $DB->Query($strSql, false, $err_mess.__LINE__);
return $res;
}