public static function GetMailTemplateArray($STATUS_ID) { $err_mess = (CAllFormStatus::err_mess())."<br>Function: GetMailTemplateArray<br>Line: "; global $DB, $USER, $strError; $STATUS_ID = intval($STATUS_ID); if ($STATUS_ID <= 0) return false; $arrRes = array(); $strSql = " SELECT FM.MAIL_TEMPLATE_ID FROM b_form_status_2_mail_template FM WHERE FM.STATUS_ID='".$STATUS_ID."' "; //echo "<pre>".$strSql."</pre>"; $rs = $DB->Query($strSql, false, $err_mess.__LINE__); while ($ar = $rs->Fetch()) $arrRes[] = $ar["MAIL_TEMPLATE_ID"]; //echo "<pre>".print_r($arrRes, true)."</pre>"; return $arrRes; }
function Copy($ID, $CHECK_RIGHTS = "Y", $NEW_FORM_ID = false) { global $DB, $APPLICATION, $strError; $err_mess = CAllFormStatus::err_mess() . "<br>Function: Copy<br>Line: "; $ID = intval($ID); $NEW_FORM_ID = intval($NEW_FORM_ID); $rsStatus = CFormStatus::GetByID($ID); if ($arStatus = $rsStatus->Fetch()) { $RIGHT_OK = "N"; if ($CHECK_RIGHTS != "Y" || CForm::IsAdmin()) { $RIGHT_OK = "Y"; } else { $F_RIGHT = CForm::GetPermission($arStatus["FORM_ID"]); // если имеем право на просмотр параметров формы if ($F_RIGHT >= 25) { // если задана новая форма if ($NEW_FORM_ID > 0) { $NEW_F_RIGHT = CForm::GetPermission($NEW_FORM_ID); // если имеем полный доступ на новую форму if ($NEW_F_RIGHT >= 30) { $RIGHT_OK = "Y"; } } elseif ($F_RIGHT >= 30) { $RIGHT_OK = "Y"; } } } // если права проверили то if ($RIGHT_OK == "Y") { CFormStatus::GetPermissionList($ID, $arPERMISSION_VIEW, $arPERMISSION_MOVE, $arPERMISSION_EDIT, $arPERMISSION_DELETE); // копируем $arFields = array("FORM_ID" => $NEW_FORM_ID > 0 ? $NEW_FORM_ID : $arStatus["FORM_ID"], "C_SORT" => $arStatus["C_SORT"], "ACTIVE" => $arStatus["ACTIVE"], "TITLE" => $arStatus["TITLE"], "DESCRIPTION" => $arStatus["DESCRIPTION"], "CSS" => $arStatus["CSS"], "HANDLER_OUT" => $arStatus["HANDLER_OUT"], "HANDLER_IN" => $arStatus["HANDLER_IN"], "DEFAULT_VALUE" => $arStatus["DEFAULT_VALUE"], "arPERMISSION_VIEW" => $arPERMISSION_VIEW, "arPERMISSION_MOVE" => $arPERMISSION_MOVE, "arPERMISSION_EDIT" => $arPERMISSION_EDIT, "arPERMISSION_DELETE" => $arPERMISSION_DELETE); $NEW_ID = CFormStatus::Set($arFields); return $NEW_ID; } else { $strError .= GetMessage("FORM_ERROR_ACCESS_DENIED") . "<br>"; } } else { $strError .= GetMessage("FORM_ERROR_STATUS_NOT_FOUND") . "<br>"; } return false; }