Exemplo n.º 1
0
function fill_all_values($sid, $type, $mess=false, $site=false)
{
	global $arrTickets, $arrT, $MESS;
	if(is_array($site))
	{
		$site = implode("|", $site);
	}
	$z = ($type=="SLA") ? CTicketSLA::GetDropDown($site) : CTicketDictionary::GetList($v1="s_dropdown", $v2="asc", array("TYPE" => $type, "SITE" => $site), $v3);
	if ($type!="SLA")
	{
		if ($mess===false) $mess = GetMessage("SUP_NO");
		$arrTickets[$sid][0]["NAME"] = "(".$mess.")";
		$arrTickets[$sid][0]["COUNTER_OPEN"] = $arrT[$sid][0]["COUNTER_OPEN"];
		$arrTickets[$sid][0]["COUNTER_OPEN_RED"] = $arrT[$sid][0]["COUNTER_OPEN_RED"];
		$arrTickets[$sid][0]["COUNTER_OPEN_GREEN"] = $arrT[$sid][0]["COUNTER_OPEN_GREEN"];
		$arrTickets[$sid][0]["COUNTER_CLOSE"] = $arrT[$sid][0]["COUNTER_CLOSE"];
		$arrTickets[$sid][0]["MESSAGES_OPEN"] = $arrT[$sid][0]["MESSAGES_OPEN"];
		$arrTickets[$sid][0]["OVERDUE_MESSAGES_OPEN"] = $arrT[$sid][0]["OVERDUE_MESSAGES_OPEN"];
		$arrTickets[$sid][0]["MESSAGES_CLOSE"] = $arrT[$sid][0]["MESSAGES_CLOSE"];
		$arrTickets[$sid][0]["OVERDUE_MESSAGES_CLOSE"] = $arrT[$sid][0]["OVERDUE_MESSAGES_CLOSE"];
	}
	while ($zr = $z->Fetch())
	{
		$arrTickets[$sid][$zr["ID"]]["NAME"] = "[<a title='".GetMessage("MAIN_ADMIN_MENU_EDIT")."' href='/bitrix/admin/ticket_dict_edit.php?ID=".$zr["ID"]."'>".$zr["ID"]."</a>] ".htmlspecialcharsbx($zr["NAME"]);
		$arrTickets[$sid][$zr["ID"]]["COUNTER_OPEN"] = $arrT[$sid][$zr["ID"]]["COUNTER_OPEN"];
		$arrTickets[$sid][$zr["ID"]]["COUNTER_OPEN_RED"] = $arrT[$sid][$zr["ID"]]["COUNTER_OPEN_RED"];
		$arrTickets[$sid][$zr["ID"]]["COUNTER_OPEN_GREEN"] = $arrT[$sid][$zr["ID"]]["COUNTER_OPEN_GREEN"];
		$arrTickets[$sid][$zr["ID"]]["COUNTER_CLOSE"] = $arrT[$sid][$zr["ID"]]["COUNTER_CLOSE"];
		$arrTickets[$sid][$zr["ID"]]["MESSAGES_OPEN"] = $arrT[$sid][$zr["ID"]]["MESSAGES_OPEN"];
		$arrTickets[$sid][$zr["ID"]]["OVERDUE_MESSAGES_OPEN"] = $arrT[$sid][$zr["ID"]]["OVERDUE_MESSAGES_OPEN"];
		$arrTickets[$sid][$zr["ID"]]["MESSAGES_CLOSE"] = $arrT[$sid][$zr["ID"]]["MESSAGES_CLOSE"];
		$arrTickets[$sid][$zr["ID"]]["OVERDUE_MESSAGES_CLOSE"] = $arrT[$sid][$zr["ID"]]["OVERDUE_MESSAGES_CLOSE"];
	}
}
Exemplo n.º 2
0
function CheckFields()
{
    global $ID, $NAME, $SID, $C_TYPE, $arrSITE, $DB;
    $str = "";
    $arMsg = array();
    if (strlen(trim($NAME)) <= 0) {
        //$str .= GetMessage("SUP_FORGOT_NAME")."<br>";
        $arMsg[] = array("id" => "NAME", "text" => GetMessage("SUP_FORGOT_NAME"));
    }
    if (preg_match("/[^A-Za-z_0-9]/", $SID)) {
        //$str .= GetMessage("SUP_INCORRECT_SID")."<br>";
        $arMsg[] = array("id" => "SID", "text" => GetMessage("SUP_INCORRECT_SID"));
    } elseif (strlen($SID) > 0 && is_array($arrSITE) && count($arrSITE) > 0) {
        $arFilter = array("ID" => "~" . $ID, "TYPE" => $C_TYPE, "SID" => $SID, "SITE" => $arrSITE);
        $z = CTicketDictionary::GetList($v1, $v2, $arFilter, $v3);
        if ($zr = $z->Fetch()) {
            $s = str_replace("#TYPE#", CTicketDictionary::GetTypeNameByID($str_C_TYPE), GetMessage("SUP_SID_ALREADY_IN_USE"));
            $s = str_replace("#LANG#", strlen($zr['LID']) > 0 ? $zr['LID'] : strtolower($zr['SITE_ID']), $s);
            $s = str_replace("#RECORD_ID#", $zr["ID"], $s);
            //$str .= $s."<br>";
            $arMsg[] = array("id" => "SID", "text" => $s);
        }
    }
    if (!empty($arMsg)) {
        $e = new CAdminException($arMsg);
        $GLOBALS["APPLICATION"]->ThrowException($e);
        return false;
    }
    return true;
}
Exemplo n.º 3
0
 function _GetDictionaryInfo($ID, $TYPE, $CODE, &$arTicketDictionary)
 {
     $ID = intval($ID);
     $arReturn = array($CODE . "_NAME" => "", $CODE . "_DESC" => "", $CODE . "_SID" => "");
     if (array_key_exists($TYPE, $arTicketDictionary) && array_key_exists($ID, $arTicketDictionary[$TYPE])) {
         $arReturn = array($CODE . "_NAME" => htmlspecialcharsbx($arTicketDictionary[$TYPE][$ID]["NAME"]), $CODE . "_DESC" => htmlspecialcharsbx($arTicketDictionary[$TYPE][$ID]["DESCR"]), $CODE . "_SID" => htmlspecialcharsbx($arTicketDictionary[$TYPE][$ID]["SID"]));
     } elseif ($ID > 0) {
         $rsD = CTicketDictionary::GetByID($ID);
         if ($arD = $rsD->Fetch()) {
             $arReturn = array($CODE . "_NAME" => htmlspecialcharsbx($arD["NAME"]), $CODE . "_DESC" => htmlspecialcharsbx($arD["DESCR"]), $CODE . "_SID" => htmlspecialcharsbx($arD["SID"]));
         }
     }
     return $arReturn;
 }
Exemplo n.º 4
0
function _GetDictionaryInfoEx($arDictionary)
{
    $arID = $arReturn = array();
    foreach ($arDictionary as $code => $arDic) {
        if ($arDic[1] == 0) {
            $arReturn[$arDic[0] . "_NAME"] = $arReturn[$arDic[0] . "_DESC"] = $arReturn[$arDic[0] . "_SID"] = "";
        } else {
            $arID[] = $arDic[1];
        }
    }
    if (!empty($arID)) {
        $rs = CTicketDictionary::GetList($v1, $v2, array("ID" => $arID), $v3);
        while ($ar = $rs->Fetch()) {
            if (array_key_exists($ar["C_TYPE"], $arDictionary)) {
                $dic = $arDictionary[$ar["C_TYPE"]][0];
                $arReturn[$dic . "_NAME"] = htmlspecialcharsbx($ar["NAME"]);
                $arReturn[$dic . "_DESC"] = htmlspecialcharsbx($ar["DESCR"]);
                $arReturn[$dic . "_SID"] = htmlspecialcharsbx($ar["SID"]);
            }
        }
    }
    return $arReturn;
}
Exemplo n.º 5
0
if (!CModule::IncludeModule('support')) {
    return;
}
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
$pathToService = str_replace("\\", "/", dirname(__FILE__));
//Left menu
DemoSiteUtil::AddMenuItem("/communication/.left.menu.php", array(GetMessage("SUPP_DEMO_INSTALL_MENUITEM"), "/communication/support/?show_wizard=Y", array("/communication/support/"), array(), ""));
$arCategories = array(GetMessage('SUPP_DEMO_INSTALL_COMMON_QUESTION') => array('NAME' => GetMessage('SUPP_DEMO_INSTALL_COMMON_QUESTION'), 'arrSITE' => array('s1'), 'C_TYPE' => 'C', 'C_SORT' => 100, 'EVENT1' => 'ticket'), GetMessage('SUPP_DEMO_INSTALL_ESTORE_QUESTION') => array('NAME' => GetMessage('SUPP_DEMO_INSTALL_ESTORE_QUESTION'), 'arrSITE' => array('s1'), 'C_TYPE' => 'C', 'C_SORT' => 100, 'EVENT1' => 'ticket'));
$dbCategory = CTicketDictionary::GetList($by = "s_id", $order = "asc", array("TYPE" => "C", "TYPE_EXACT_MATCH" => "Y"), $is_filtered);
while ($arCategory = $dbCategory->Fetch()) {
    if (array_key_exists($arCategory["NAME"], $arCategories)) {
        unset($arCategories[$arCategory["NAME"]]);
    }
}
foreach ($arCategories as $arCategory) {
    $categoryID = (int) CTicketDictionary::Add($arCategory);
}
COption::SetOptionString("support", "SUPPORT_MAX_FILESIZE", "10000");
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "REGISTERED_USERS"));
if ($arGroup = $dbResult->Fetch()) {
    $APPLICATION->SetGroupRight("support", $arGroup["ID"], "R");
}
//Create support admins group if needed
$rsGroup = CGroup::GetList($by = "c_sort", $order = "asc", array("STRING_ID_EXACT_MATCH" => "Y", "STRING_ID" => "SUPPORT_ADMINISTRATORS"));
if ($arGroup = $rsGroup->Fetch()) {
    $group_id = $arGroup["ID"];
} else {
    $obGroup = new CGroup();
    $group_id = $obGroup->Add(array("ACTIVE" => "Y", "C_SORT" => 500, "NAME" => GetMessage("SUPP_DEMO_INSTALL_GROUP_NAME"), "DESCRIPTION" => GetMessage("SUPP_DEMO_INSTALL_GROUP_DESCRIPTION"), "STRING_ID" => "SUPPORT_ADMINISTRATORS"));
}
if ($group_id) {
Exemplo n.º 6
0
 function __CleanDefault(&$arFields)
 {
     if (array_key_exists('SET_AS_DEFAULT', $arFields) && $arFields['SET_AS_DEFAULT'] == 'Y' && array_key_exists('arrSITE', $arFields) && array_key_exists('C_TYPE', $arFields)) {
         global $DB;
         $arFilter = array('TYPE' => $arFields['C_TYPE'], 'SITE' => $arFields['arrSITE']);
         $z = CTicketDictionary::GetList($v1, $v2, $arFilter, $v3);
         while ($zr = $z->Fetch()) {
             $DB->Update('b_ticket_dictionary', array('SET_AS_DEFAULT' => "'N'"), 'WHERE ID=' . $zr['ID'], '', false, false, false);
         }
     } else {
         $arFields['SET_AS_DEFAULT'] = 'N';
     }
 }
Exemplo n.º 7
0
$arrUF = $USER_FIELD_MANAGER->GetUserFields("SUPPORT", 0, LANGUAGE_ID);
if (isset($arParams["SET_SHOW_USER_FIELD"])) {
    foreach ($arParams["SET_SHOW_USER_FIELD"] as $k => $v) {
        if (strlen(trim($v)) > 0) {
            $UFAT[$v] = array("NAME_C" => $arrUF[$v]["LIST_COLUMN_LABEL"], "NAME_F" => $arrUF[$v]["EDIT_FORM_LABEL"], "ALL" => $arrUF[$v]);
            $UFA[] = $v;
        }
    }
}
$arParams["SET_SHOW_USER_FIELD_T"] = $UFAT;
$rsTickets = CTicket::GetList($GLOBALS["by"], $GLOBALS["order"], $arFilter, $is_filtered, $check_rights = "Y", $get_user_name = "N", $get_dictionary_name = "N", false, array("SELECT" => $UFA));
$rsTickets->NavStart($arParams["TICKETS_PER_PAGE"]);
//Result array
$arResult = array("TICKETS" => array(), "TICKETS_COUNT" => $rsTickets->SelectedRowsCount(), "NAV_STRING" => $rsTickets->GetPageNavString(GetMessage("SUP_PAGES")), "CURRENT_PAGE" => htmlspecialcharsbx($APPLICATION->GetCurPage()), "NEW_TICKET_PAGE" => htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($arParams["TICKET_EDIT_TEMPLATE"], array("ID" => "0"))));
//Get Dictionary Array
$arTicketDictionary = CTicketDictionary::GetDropDownArray();
//Dictionary table
$arDictType = array("C" => "CATEGORY", "K" => "CRITICALITY", "S" => "STATUS", "M" => "MARK", "SR" => "SOURCE");
while ($arTicket = $rsTickets->GetNext()) {
    $arUsersName = _GetUserInfo($arTicket["RESPONSIBLE_USER_ID"], "RESPONSIBLE") + _GetUserInfo($arTicket["OWNER_USER_ID"], "OWNER") + _GetUserInfo($arTicket["MODIFIED_USER_ID"], "MODIFIED");
    $arDict = array();
    foreach ($arDictType as $TYPE => $CODE) {
        $arDict += _GetDictionaryInfo($arTicket[$CODE . "_ID"], $TYPE, $CODE, $arTicketDictionary);
    }
    $url = CComponentEngine::MakePathFromTemplate($arParams["TICKET_EDIT_TEMPLATE"], array("ID" => $arTicket["ID"]));
    $arResult["TICKETS"][] = $arTicket + $arDict + $arUsersName + array("TICKET_EDIT_URL" => $url);
}
//Set Title
$arParams["SET_PAGE_TITLE"] = $arParams["SET_PAGE_TITLE"] == "N" ? "N" : "Y";
if ($arParams["SET_PAGE_TITLE"] == "Y") {
    $APPLICATION->SetTitle(GetMessage("SUP_DEFAULT_TITLE"));
Exemplo n.º 8
0
function Support_GetDictionaryInfo($DID, $TYPE, &$TICKET_DICTIONARY, &$name, &$desc, &$sid)
{
	static $arrDic;

	$name = "";
	$desc = "";
	$sid = "";
	if (intval($DID)>0)
	{
		if (is_array($arrDic) && in_array($DID, array_keys($arrDic)))
		{
			$name = $arrDic[$DID]["NAME"];
			$desc = $arrDic[$DID]["DESC"];
			$sid = $arrDic[$DID]["SID"];
		}
		elseif(array_key_exists($TYPE, $TICKET_DICTIONARY) && array_key_exists($DID, $TICKET_DICTIONARY[$TYPE]))
		{
			$name = htmlspecialcharsbx($TICKET_DICTIONARY[$TYPE][$DID]["NAME"]);
			$desc = htmlspecialcharsbx($TICKET_DICTIONARY[$TYPE][$DID]["DESCR"]);
			$sid = $TICKET_DICTIONARY[$TYPE][$DID]["SID"];
			$arrDic[$DID] = array("NAME" => $name, "DESC" => $desc, "SID" => $sid);
		}
		else
		{
			$rsD = CTicketDictionary::GetByID($DID);
			$arD = $rsD->Fetch();
			$name = htmlspecialcharsbx($arD["NAME"]);
			$desc = htmlspecialcharsbx($arD["DESCR"]);
			$sid = $arD["SID"];
			$arrDic[$DID] = array("NAME" => $name, "DESC" => $desc, "SID" => $sid);
		}
	}
}
Exemplo n.º 9
0
 function GetList(&$by, &$order, $arFilter = array(), &$isFiltered)
 {
     $err_mess = CTicketDictionary::err_mess() . "<br>Function: GetList<br>Line: ";
     global $DB;
     $arSqlSearch = array();
     $strSqlSearch = "";
     $leftJoinSite = "";
     $leftJoinUser = "";
     if (is_array($arFilter)) {
         $filterKeys = array_keys($arFilter);
         for ($i = 0; $i < count($filterKeys); $i++) {
             $key = $filterKeys[$i];
             $val = $arFilter[$filterKeys[$i]];
             if (is_array($val) && count($val) <= 0 || !is_array($val) && (strlen($val) <= 0 || $val === 'NOT_REF')) {
                 continue;
             }
             $match_value_set = in_array($key . "_EXACT_MATCH", $filterKeys) ? true : false;
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                 case "SID":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("D." . $key, $val, $match);
                     break;
                 case "SITE":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("DS.SITE_ID", $val, $match);
                     $leftJoinSite .= "LEFT JOIN b_ticket_dictionary_2_site DS ON (D.ID = DS.DICTIONARY_ID)";
                     $select_user = "******";
                     break;
                 case "TYPE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("D.C_TYPE", $val, $match);
                     break;
                 case "NAME":
                 case "DESCR":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("D." . $key, $val, $match);
                     break;
                 case "RESPONSIBLE_ID":
                     if (intval($val) > 0) {
                         $arSqlSearch[] = "D.RESPONSIBLE_USER_ID = '" . intval($val) . "'";
                     } elseif ($val == 0) {
                         $arSqlSearch[] = "(D.RESPONSIBLE_USER_ID is null or D.RESPONSIBLE_USER_ID=0)";
                     }
                     break;
                 case "RESPONSIBLE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("D.RESPONSIBLE_USER_ID, U.LOGIN, U.LAST_NAME, U.NAME", $val, $match);
                     $select_user = "******";
                     $leftJoinUser = "******";
                     break;
                 case "DEFAULT":
                     $arSqlSearch[] = $val == "Y" ? "D.SET_AS_DEFAULT='Y'" : "D.SET_AS_DEFAULT='N'";
                     break;
                 case "LID":
                 case "FIRST_SITE_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("D.FIRST_SITE_ID", $val, $match);
                     break;
             }
         }
     }
     if ($by == "s_id") {
         $strSqlOrder = "D.ID";
     } elseif ($by == "s_c_sort") {
         $strSqlOrder = "D.C_SORT";
     } elseif ($by == "s_sid") {
         $strSqlOrder = "D.SID";
     } elseif ($by == "s_lid") {
         $strSqlOrder = "D.FIRST_SITE_ID";
     } elseif ($by == "s_name") {
         $strSqlOrder = "D.NAME";
     } elseif ($by == "s_responsible") {
         $strSqlOrder = "D.RESPONSIBLE_USER_ID";
     } elseif ($by == "s_dropdown") {
         $strSqlOrder = "D.C_SORT, D.ID, D.NAME";
     } else {
         $by = "s_c_sort";
         $strSqlOrder = "D.C_SORT";
     }
     if ($order != "desc") {
         $strSqlOrder .= " asc ";
         $order = "asc";
     } else {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tD.*,\n\t\t\t\tD.FIRST_SITE_ID\t\t\t\t\t\tLID,\n\t\t\t\tD.ID\t\t\t\t\t\t\t\tREFERENCE_ID,\n\t\t\t\tD.NAME\t\t\t\t\t\t\t\tREFERENCE\n\t\t\t\t{$select_user}\n\t\t\tFROM\n\t\t\t\tb_ticket_dictionary D\n\t\t\t{$leftJoinUser}\n\t\t\t{$leftJoinSite}\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\tGROUP BY\n\t\t\t\tD.ID\n\t\t\tORDER BY\n\t\t\t\tcase D.C_TYPE\n\t\t\t\t\twhen 'C'\tthen '1'\n\t\t\t\t\twhen 'F'\tthen '2'\n\t\t\t\t\twhen 'S'\tthen '3'\n\t\t\t\t\twhen 'M'\tthen '4'\n\t\t\t\t\twhen 'K'\tthen '5'\n\t\t\t\t\twhen 'SR'\tthen '6'\n\t\t\t\t\twhen 'D'\tthen '7'\n\t\t\t\t\telse ''\tend,\n\t\t\t{$strSqlOrder}\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $isFiltered = IsFiltered($strSqlSearch);
     return $res;
 }
Exemplo n.º 10
0
// установка строки навигации
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("SUP_PAGES")));
//$tdic = CTicketDictionary::GetList($by, $order, $arFilter, $is_filtered);
$APPLICATION->SetTitle(GetMessage("SUP_TICKETS_DIC_TITLE"));
$arHeaders = array();
$arHeaders[] = array("id" => "ID", "content" => "ID", "default" => true, "sort" => "s_id");
$arHeaders[] = array("id" => "C_SORT", "content" => GetMessage("SUP_SORT"), "default" => true, "sort" => "s_c_sort");
$arHeaders[] = array("id" => "C_SITE", "content" => GetMessage("SUP_SITE"), "default" => true);
$arHeaders[] = array("id" => "NAME", "content" => GetMessage("SUP_NAME"), "default" => true, "sort" => "s_name");
if ($show_responsible_column == "Y") {
    $arHeaders[] = array("id" => "RESPONSIBLE_USER_ID", "content" => GetMessage("SUP_RESPONSIBLE"), "default" => true, "sort" => "s_responsible");
}
$lAdmin->AddHeaders($arHeaders);
// построение списка
$arRows = array();
$arSiteArrayForAllDict = CTicketDictionary::GetSiteArrayForAllDictionaries();
$arRespUserIDs = array();
while ($arRes = $rsData->Fetch()) {
    if (intval($arRes["RESPONSIBLE_USER_ID"]) > 0) {
        $arRespUserIDs[] = intval($arRes["RESPONSIBLE_USER_ID"]);
    }
    $row =& $lAdmin->AddRow($arRes["ID"], $arRes);
    $arRow = array("objRow" => $row, "arFields" => $arRes);
    $row->AddInputField("C_SORT", array("size" => "3"));
    $str_SITE = "";
    if (array_key_exists($arRes["ID"], $arSiteArrayForAllDict)) {
        $arrSITE = $arSiteArrayForAllDict[$arRes["ID"]];
        foreach ($arrSITE as $sid) {
            $sidS = htmlspecialcharsbx($sid);
            $str_SITE .= ($str_SITE == "" ? "" : " / ") . '<a title="' . GetMessage("MAIN_ADMIN_MENU_EDIT") . '" href="/bitrix/admin/site_edit.php?LID=' . $sidS . '&lang=' . LANG . '">' . $sidS . '</a>';
        }
Exemplo n.º 11
0
 function EMailMessageAdd($arMessageFields, $ACTION_VARS)
 {
     $arActionVars = explode("&", $ACTION_VARS);
     $countAr = count($arActionVars);
     for ($i = 0; $i < $countAr; $i++) {
         $v = $arActionVars[$i];
         if ($pos = strpos($v, "=")) {
             ${substr($v, 0, $pos)} = urldecode(substr($v, $pos + 1));
         }
     }
     if (!CModule::IncludeModule("support")) {
         return false;
     }
     if (strlen($W_SUPPORT_SITE_ID) > 0) {
         $rs = CSite::GetByID($W_SUPPORT_SITE_ID);
         if ($ar = $rs->Fetch()) {
             $SITE_ID = $ar["LID"];
         }
     }
     if (strlen($SITE_ID) <= 0) {
         $SITE_ID = $arMessageFields["LID"];
     }
     $sourceMail = COption::GetOptionString("support", "SOURCE_MAIL");
     $dbr = CTicketDictionary::GetBySID($sourceMail, "SR", $SITE_ID);
     if (!($ar = $dbr->Fetch())) {
         return false;
     }
     $TICKET_SOURCE_ID = $ar["ID"];
     $ID = $arMessageFields["ID"];
     $message_email = strlen($arMessageFields["FIELD_REPLY_TO"]) > 0 ? $arMessageFields["FIELD_REPLY_TO"] : $arMessageFields["FIELD_FROM"];
     $message_email_addr = strtolower(CMailUtil::ExtractMailAddress($message_email));
     $TID = 0;
     $arSubjects = explode("\n", trim($W_SUPPORT_SUBJECT));
     $countAr = count($arSubjects);
     for ($i = 0; $i < $countAr; $i++) {
         $arSubjects[$i] = Trim($arSubjects[$i]);
         if (strlen($arSubjects[$i]) > 0) {
             if (preg_match("/" . $arSubjects[$i] . "/" . BX_UTF_PCRE_MODIFIER, $arMessageFields["SUBJECT"], $regs)) {
                 $TID = IntVal($regs[1]);
                 break;
             }
         }
     }
     if ($TID > 0) {
         $db_ticket = CTicket::GetByID($TID, $SITE_ID, "N", "N", "N");
         if ($ar_ticket = $db_ticket->Fetch()) {
             //check user email address limits
             if ($W_SUPPORT_SEC == "domain" || $W_SUPPORT_SEC == "email") {
                 $bEMailOK = false;
                 if ($TICKET_SOURCE_ID == $ar_ticket["SOURCE_ID"]) {
                     $ticket_email = strtolower(CMailUtil::ExtractMailAddress($ar_ticket["OWNER_SID"]));
                     if ($W_SUPPORT_SEC == "domain") {
                         $ticket_email = substr($ticket_email, strpos($ticket_email, "@"));
                     }
                     if (strpos($message_email_addr, $ticket_email) !== false) {
                         $bEMailOK = true;
                     }
                 }
                 if (!$bEMailOK && $ar_ticket["OWNER_USER_ID"] > 0) {
                     $db_user = CUser::GetByID($ar_ticket["OWNER_USER_ID"]);
                     if ($arUser = $db_user->Fetch()) {
                         $ticket_email = strtolower(CMailUtil::ExtractMailAddress($arUser["EMAIL"]));
                         if ($check_type == "domain") {
                             $ticket_email = substr($ticket_email, strpos($ticket_email, "@"));
                         }
                         if (strpos($message_email_addr, $ticket_email) !== false) {
                             $bEMailOK = true;
                         }
                     }
                 }
                 if (!$bEMailOK) {
                     $TID = 0;
                 }
             }
         } else {
             $TID = 0;
         }
     }
     //when message subject is empty - generate it from message body
     $title = trim($arMessageFields["SUBJECT"]);
     if (strlen($title) <= 0) {
         $title = trim($arMessageFields["BODY"]);
         $title = preg_replace("/[\n\r\t ]+/s" . BX_UTF_PCRE_MODIFIER, " ", $title);
         $title = substr($title, 0, 50);
     }
     $arFieldsTicket = array("CLOSE" => "N", "TITLE" => $title, "MESSAGE" => $arMessageFields["BODY"], "MESSAGE_AUTHOR_SID" => $message_email, "MESSAGE_SOURCE_SID" => "email", "MODIFIED_MODULE_NAME" => "mail", "EXTERNAL_ID" => $ID, "EXTERNAL_FIELD_1" => $arMessageFields["HEADER"]);
     if ($W_SUPPORT_USER_FIND == "Y") {
         $o = "LAST_LOGIN";
         $b = "DESC";
         $res = CUser::GetList($o, $b, array("ACTIVE" => "Y", "=EMAIL" => $message_email_addr));
         if (($arr = $res->Fetch()) && strtolower(CMailUtil::ExtractMailAddress($arr["EMAIL"])) == $message_email_addr) {
             $AUTHOR_USER_ID = $arr["ID"];
         }
     }
     // process attach files
     $arFILES = array();
     $rsAttach = CMailAttachment::GetList(array(), array("MESSAGE_ID" => $ID));
     while ($arAttach = $rsAttach->Fetch()) {
         // save from db to hdd
         $filename = CTempFile::GetFileName(md5(uniqid("")) . ".tmp");
         CheckDirPath($filename);
         if (file_put_contents($filename, $arAttach["FILE_DATA"]) !== false) {
             $arFILES[] = array("name" => $arAttach["FILE_NAME"], "type" => $arAttach["CONTENT_TYPE"], "size" => filesize($filename), "tmp_name" => $filename, "MODULE_ID" => "support");
         }
     }
     if (count($arFILES) > 0) {
         $arFieldsTicket["FILES"] = $arFILES;
     }
     $arFieldsTicket["CURRENT_USER_ID"] = null;
     if (intval($AUTHOR_USER_ID) > 0) {
         $resU = CUser::GetByID(intval($AUTHOR_USER_ID));
         if ($arU = $resU->Fetch()) {
             $arFieldsTicket["CURRENT_USER_ID"] = $arU["ID"];
         }
     }
     if ($TID > 0) {
         $arFieldsTicket["MESSAGE_AUTHOR_USER_ID"] = $AUTHOR_USER_ID;
         if ($W_SUPPORT_ADD_MESSAGE_AS_HIDDEN == "Y") {
             $arFieldsTicket["HIDDEN"] = "Y";
         }
         if ($arMessageFields["SPAM"] == "Y") {
             $arFieldsTicket["IS_SPAM"] = "Y";
         }
         $TID = CTicket::Set($arFieldsTicket, $MESSAGE_ID, $TID, "N");
     } else {
         $arFieldsTicket["SITE_ID"] = $SITE_ID;
         $arFieldsTicket["OWNER_USER_ID"] = $AUTHOR_USER_ID;
         $arFieldsTicket["OWNER_SID"] = $message_email;
         $arFieldsTicket["CREATED_MODULE_NAME"] = "mail";
         $arFieldsTicket["SOURCE_SID"] = "email";
         if ($arMessageFields["SPAM"] == "Y") {
             $arFieldsTicket["IS_SPAM"] = "Y";
         }
         if ($W_SUPPORT_CATEGORY > 0) {
             $arFieldsTicket["CATEGORY_ID"] = $W_SUPPORT_CATEGORY;
         }
         if ($W_SUPPORT_CRITICALITY > 0) {
             $arFieldsTicket["CRITICALITY_ID"] = $W_SUPPORT_CRITICALITY;
         }
         if (strlen(trim($arFieldsTicket["TITLE"])) <= 0) {
             $arFieldsTicket["TITLE"] = " ";
         }
         if (strlen(trim($arFieldsTicket["MESSAGE"])) <= 0) {
             $arFieldsTicket["MESSAGE"] = " ";
         }
         $TID = CTicket::Set($arFieldsTicket, $MESSAGE_ID, "", "N");
     }
 }
Exemplo n.º 12
0
echo SelectBoxFromArray("find_mark_id", $arr, $find_mark_id, GetMessage("SUP_ALL"));
?>
</td>
</tr>
<tr> 
	<td nowrap>
		<?php 
echo GetMessage("SUP_F_SOURCE");
?>
:</td>
	<td><?php 
$ref = array();
$ref_id = array();
$ref[] = "web";
$ref_id[] = "0";
$z = CTicketDictionary::GetDropDown("SR");
while ($zr = $z->Fetch()) {
    $ref[] = "[" . $zr["ID"] . "] (" . $zr["SID"] . ") " . $zr["NAME"];
    $ref_id[] = $zr["REFERENCE_ID"];
}
$arr = array("REFERENCE" => $ref, "REFERENCE_ID" => $ref_id);
echo SelectBoxFromArray("find_source_id", $arr, $find_source_id, GetMessage("SUP_ALL"));
?>
</td>
</tr>
<tr valign="top">
	<td width="0%" nowrap><?php 
echo GetMessage("SUP_SHOW");
?>
:</td>
	<td width="0%" nowrap  valign="top">
Exemplo n.º 13
0
$APPLICATION->SetTitle(GetMessage("SUP_TICKETS_DIC_TITLE"));
$arHeaders = array();
$arHeaders[] = array("id" => "ID", "content" => "ID", "default" => true, "sort" => "s_id");
$arHeaders[] = array("id" => "C_SORT", "content" => GetMessage("SUP_SORT"), "default" => true, "sort" => "s_c_sort");
$arHeaders[] = array("id" => "C_SITE", "content" => GetMessage("SUP_SITE"), "default" => true);
$arHeaders[] = array("id" => "NAME", "content" => GetMessage("SUP_NAME"), "default" => true, "sort" => "s_name");
if ($show_responsible_column == "Y") {
    $arHeaders[] = array("id" => "RESPONSIBLE_USER_ID", "content" => GetMessage("SUP_RESPONSIBLE"), "default" => true, "sort" => "s_responsible");
}
$lAdmin->AddHeaders($arHeaders);
// построение списка
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes);
    //$row->AddViewField("ID", $f_ID);
    $row->AddInputField("C_SORT", array("size" => "3"));
    $arrSITE = CTicketDictionary::GetSiteArray($f_ID);
    reset($arrSITE);
    $str_SITE = "";
    if (is_array($arrSITE)) {
        foreach ($arrSITE as $sid) {
            $str_SITE .= ($str_SITE == "" ? "" : " / ") . '<a title="' . GetMessage("MAIN_ADMIN_MENU_EDIT") . '" href="/bitrix/admin/site_edit.php?LID=' . $sid . '&lang=' . LANG . '">' . $sid . '</a>';
        }
    }
    $row->AddViewField("C_SITE", $str_SITE);
    $row->AddInputField("NAME", array("size" => "35"));
    //$row->AddViewField("NAME", TxtToHTML(htmlspecialcharsback($f_NAME)));
    $str = "&nbsp;";
    if (intval($f_RESPONSIBLE_USER_ID) > 0) {
        if (strlen($f_RESPONSIBLE_LOGIN) > 0) {
            $str = '[<a title="' . GetMessage("SUP_USER_PROFILE") . '" href="/bitrix/admin/user_edit.php?lang=' . LANG . '&ID=' . $f_RESPONSIBLE_USER_ID . '">' . $f_RESPONSIBLE_USER_ID . '</a>] (' . $f_RESPONSIBLE_LOGIN . ') ' . $f_RESPONSIBLE_NAME;
        } else {
Exemplo n.º 14
0
function _Support_GetDictionaryInfoEx($arDictionary = array())
{
    //$arID = array_values($arDictionary);
    $arID = array();
    foreach ($arDictionary as $dic => $value) {
        if (intval($value) > 0) {
            $arID[] = $value;
        } else {
            $GLOBALS["str_" . $dic . "_NAME"] = $GLOBALS["str_" . $dic . "_DESC"] = $GLOBALS["str_" . $dic . "_SID"] = "";
        }
    }
    if (!empty($arID)) {
        $arTypes = array("C" => "CATEGORY", "K" => "CRITICALITY", "S" => "STATUS", "M" => "MARK", "F" => "FUA", "SR" => "SOURCE", "D" => "DIFFICULTY");
        $v1 = $v2 = $v3 = null;
        $rs = CTicketDictionary::GetList($v1, $v2, array("ID" => $arID), $v3);
        while ($ar = $rs->Fetch()) {
            $dic = $ar["C_TYPE"];
            $GLOBALS["str_" . $arTypes[$dic] . "_NAME"] = $ar["NAME"];
            $GLOBALS["str_" . $arTypes[$dic] . "_DESC"] = $ar["DESCR"];
            $GLOBALS["str_" . $arTypes[$dic] . "_SID"] = $ar["SID"];
        }
    }
}
Exemplo n.º 15
0
    }
    if (count($arr) > 0) {
        ?>
		arMark["<?php 
        echo $sid;
        ?>
"]=Array(<?php 
        echo "0";
        foreach ($arr as $ar) {
            echo "," . addslashes(htmlspecialchars($ar["REFERENCE_ID"]));
        }
        ?>
);
			<?php 
    }
    $rs = CTicketDictionary::GetDropDown("K", $sid);
    $arr = array();
    while ($ar = $rs->Fetch()) {
        $arr[] = $ar;
    }
    if (count($arr) > 0) {
        ?>
		arCriticality["<?php 
        echo $sid;
        ?>
"]=Array(<?php 
        echo "0";
        foreach ($arr as $ar) {
            echo "," . addslashes(htmlspecialchars($ar["REFERENCE_ID"]));
        }
        ?>
Exemplo n.º 16
0
    //Online
    CTicket::UpdateOnline($arParams["ID"], $USER->GetID());
    $rsOnline = CTicket::GetOnline($arParams["ID"]);
    while ($arOnline = $rsOnline->GetNext()) {
        $arResult["ONLINE"][] = $arOnline;
    }
    $ticketSite = $arTicket["SITE_ID"];
    $ticketSla = $arTicket["SLA_ID"];
} else {
    $ticketSite = SITE_ID;
    $ticketSla = CTicketSLA::GetForUser();
    $arResult["DICTIONARY"]["CRITICALITY_DEFAULT"] = CTicketDictionary::GetDefault("K", $ticketSite);
    $arResult["DICTIONARY"]["CATEGORY_DEFAULT"] = CTicketDictionary::GetDefault("C", $ticketSite);
}
//Mark, Category, Criticality dictionary list
$ticketDictionary = CTicketDictionary::GetDropDownArray($ticketSite, $ticketSla);
$arResult["DICTIONARY"]["MARK"] = _GetDropDownDictionary("M", $ticketDictionary);
$arResult["DICTIONARY"]["CRITICALITY"] = _GetDropDownDictionary("K", $ticketDictionary);
$arResult["DICTIONARY"]["CATEGORY"] = _GetDropDownDictionary("C", $ticketDictionary);
unset($rsTicket);
unset($rsMessage);
unset($arMessagesFiles);
unset($ticketDictionary);
//Set Title
$arParams["SET_PAGE_TITLE"] = $arParams["SET_PAGE_TITLE"] == "N" ? "N" : "Y";
if ($arParams["SET_PAGE_TITLE"] == "Y") {
    if (empty($arResult["TICKET"])) {
        $APPLICATION->SetTitle(GetMessage("SUP_NEW_TICKET_TITLE"));
    } else {
        $APPLICATION->SetTitle(GetMessage("SUP_EDIT_TICKET_TITLE", array("#ID#" => $arResult["TICKET"]["ID"], "#TITLE#" => $arResult["TICKET"]["TITLE"])));
    }
Exemplo n.º 17
0
 function GetRefBookValues($type, $site_id = false)
 {
     $err_mess = CAllTicket::err_mess() . "<br>Function: GetRefBookValues<br>Line: ";
     global $DB;
     if ($site_id == "all") {
         $site_id = "";
     }
     $arFilter = array("TYPE" => $type, "SITE" => $site_id);
     $v2 = $v3 = null;
     $rs = CTicketDictionary::GetList($v1 = "s_dropdown", $v2, $arFilter, $v3);
     return $rs;
 }
Exemplo n.º 18
0
$SHOW_USER_FIELD = array("" => "");
$arrUF = $USER_FIELD_MANAGER->GetUserFields("SUPPORT", 0, LANGUAGE_ID);
foreach ($arrUF as $FIELD_ID => $arField) {
    $SHOW_USER_FIELD[$FIELD_ID] = $arField["EDIT_FORM_LABEL"];
}
$arComponentParameters = array("GROUPS" => array("SECTIONS_TO_CATEGORIES" => array("NAME" => GetMessage("WZ_GRP_SECTIONS_TO_CATEGORIES"))), "PARAMETERS" => array("VARIABLE_ALIASES" => array("ID" => array("NAME" => GetMessage("SUP_TICKET_ID_DESC"))), "IBLOCK_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("WZ_IBTYPE"), "TYPE" => "LIST", "VALUES" => $arTypesEx, "DEFAULT" => "news", "REFRESH" => "Y"), "IBLOCK_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("WZ_IBLOCK"), "TYPE" => "LIST", "VALUES" => $arIBlocks, "DEFAULT" => '={$_REQUEST["ID"]}', "ADDITIONAL_VALUES" => "Y", "REFRESH" => "Y"), "PROPERTY_FIELD_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("WZ_PROPERTY"), "TYPE" => "LIST", "VALUES" => $arProperty_S), "PROPERTY_FIELD_VALUES" => array("PARENT" => "BASE", "NAME" => GetMessage("WZ_PROPERTY_VALUES"), "TYPE" => "LIST", "VALUES" => $arProperty_M), "AJAX_MODE" => array(), "INCLUDE_IBLOCK_INTO_CHAIN" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("WZ_INCLUDE_INTO_CHAIN"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "TICKETS_PER_PAGE" => array("NAME" => GetMessage("SUP_LIST_TICKETS_PER_PAGE"), "TYPE" => "STRING", "MULTIPLE" => "N", "PARENT" => "ADDITIONAL_SETTINGS", "DEFAULT" => "50"), "MESSAGES_PER_PAGE" => array("NAME" => GetMessage("SUP_EDIT_MESSAGES_PER_PAGE"), "TYPE" => "STRING", "MULTIPLE" => "N", "PARENT" => "ADDITIONAL_SETTINGS", "DEFAULT" => "20"), "MESSAGE_MAX_LENGTH" => array("NAME" => GetMessage("SUP_MESSAGE_MAX_LENGTH"), "TYPE" => "STRING", "MULTIPLE" => "N", "PARENT" => "ADDITIONAL_SETTINGS", "DEFAULT" => "70"), "MESSAGE_SORT_ORDER" => array("NAME" => GetMessage("SUP_MESSAGE_SORT_ORDER"), "TYPE" => "LIST", "MULTIPLE" => "N", "PARENT" => "ADDITIONAL_SETTINGS", "VALUES" => array("asc" => GetMessage("SUP_SORT_ASC"), "desc" => GetMessage("SUP_SORT_DESC"))), "SET_PAGE_TITLE" => array("NAME" => GetMessage("SUP_SET_PAGE_TITLE"), "TYPE" => "LIST", "MULTIPLE" => "N", "DEFAULT" => "Y", "PARENT" => "ADDITIONAL_SETTINGS", "VALUES" => $arYesNo, "ADDITIONAL_VALUES" => "N"), "TEMPLATE_TYPE" => array("NAME" => GetMessage("WZ_TEMPLATE"), "TYPE" => "LIST", "MULTIPLE" => "N", "PARENT" => "ADDITIONAL_SETTINGS", "VALUES" => array("standard" => GetMessage("WZ_STANDARD"), ".default" => GetMessage("WZ_DEFAULT"))), "SHOW_RESULT" => array("NAME" => GetMessage("WZ_SHOW_RESULT"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "PARENT" => "ADDITIONAL_SETTINGS"), "SHOW_COUPON_FIELD" => array("NAME" => GetMessage("SUP_SHOW_COUPON_FIELD"), "TYPE" => "CHECKBOX", "PARENT" => "ADDITIONAL_SETTINGS", "DEFAULT" => "N"), "SECTIONS_TO_CATEGORIES" => array("PARENT" => "SECTIONS_TO_CATEGORIES", "NAME" => GetMessage("SECTIONS_TO_CATEGORIES"), "TYPE" => "CHECKBOX", "REFRESH" => "Y"), "SET_SHOW_USER_FIELD" => array("NAME" => GetMessage("SUP_SHOW_USER_FIELD"), "TYPE" => "LIST", "MULTIPLE" => "Y", "PARENT" => "ADDITIONAL_SETTINGS", "VALUES" => $SHOW_USER_FIELD)));
if ($arCurrentValues['SECTIONS_TO_CATEGORIES'] == 'Y') {
    if (!CModule::IncludeModule('support')) {
        return;
    }
    $arSections = array();
    $rs = CIBlockSection::GetList(array("left_margin" => "ASC", "SORT" => "ASC"), array("IBLOCK_ID" => $arCurrentValues['IBLOCK_ID']));
    while ($f = $rs->GetNext()) {
        $arSectionsDot[$f['ID']] = str_repeat(" . ", $f['DEPTH_LEVEL'] - 1) . $f['NAME'];
        $arSections[$f['ID']] = $f['NAME'];
    }
    $arComponentParameters['PARAMETERS']['SELECTED_SECTIONS'] = array("PARENT" => "SECTIONS_TO_CATEGORIES", "NAME" => GetMessage('WZ_SELECT_SECTIONS'), "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => $arSectionsDot, "REFRESH" => "Y");
    $arSelectedSections = $arCurrentValues['SELECTED_SECTIONS'];
    if (is_array($arSelectedSections) && count($arSelectedSections) > 0) {
        $arCategories = array();
        $rs = CTicketDictionary::GetList($by, $order, array("TYPE" => "C"), $is_filtered);
        while ($f = $rs->GetNext()) {
            $arCategories[$f['ID']] = $f['NAME'];
        }
        foreach ($arSelectedSections as $k) {
            if ($k) {
                $arComponentParameters['PARAMETERS']['SECTION_' . $k] = array("PARENT" => "SECTIONS_TO_CATEGORIES", "NAME" => $arSections[$k], "TYPE" => "LIST", "VALUES" => $arCategories);
            }
        }
    }
}
Exemplo n.º 19
0
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_E_MAIL'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'SR', 'C_SORT' => 100, 'SID' => 'email'));
    if (!$e) {
        $DD_ERROR = true;
        return;
    }
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_PHONE'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'SR', 'C_SORT' => 200));
    if (!$e) {
        $DD_ERROR = true;
        return;
    }
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_FORUM'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'SR', 'C_SORT' => 300));
    if (!$e) {
        $DD_ERROR = true;
        return;
    }
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_EASY'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'D', 'C_SORT' => 100));
    if (!$e) {
        $DD_ERROR = true;
        return;
    }
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_MEDIUM'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'D', 'C_SORT' => 200));
    if (!$e) {
        $DD_ERROR = true;
        return;
    }
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_HARD'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'D', 'C_SORT' => 300));
    if (!$e) {
        $DD_ERROR = true;
        return;
    }
}
Exemplo n.º 20
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
//if (WIZARD_IS_RERUN)
//return;
if (!CModule::IncludeModule("support")) {
    return;
}
WizardServices::CopyFile(WIZARD_SERVICE_RELATIVE_PATH . "/public/" . LANGUAGE_ID . "/support.php", WIZARD_SITE_DIR . "services/support.php");
$arCategories = array(array('NAME' => GetMessage('CATEGORY_CORP_QUESTION'), 'arrSITE' => array(WIZARD_SITE_ID), 'C_TYPE' => 'C', 'C_SORT' => 100, 'EVENT1' => 'ticket'), array('NAME' => GetMessage('CATEGORY_COMPUTER_QUESTION'), 'arrSITE' => array(WIZARD_SITE_ID), 'C_TYPE' => 'C', 'C_SORT' => 100, 'EVENT1' => 'ticket'));
$newCategoryID = array();
foreach ($arCategories as $arCategory) {
    $categoryID = (int) CTicketDictionary::Add($arCategory);
    $newCategoryID[] = $categoryID;
}
$dbCategory = CTicketDictionary::GetList($by = "s_id", $order = "asc", array("TYPE" => "C", "TYPE_EXACT_MATCH" => "Y"), $is_filtered);
while ($arCategory = $dbCategory->Fetch()) {
    if (!in_array($arCategory["ID"], $newCategoryID)) {
        CTicketDictionary::Delete($arCategory["ID"]);
    }
}
$APPLICATION->SetGroupRight("support", WIZARD_EMPLOYEES_GROUP, "R");
$APPLICATION->SetGroupRight("support", WIZARD_SUPPORT_GROUP, "W");
COption::SetOptionString("support", "SUPPORT_MAX_FILESIZE", "10000");