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"]; } }
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; }
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; }
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; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } //Communication section include dirname(__FILE__) . "/../communication/install.php"; 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"));
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'; } }
$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); } } } }
continue; } $ID = intval($ID); switch ($_REQUEST['action']) { case "delete": @set_time_limit(0); CTicketDictionary::Delete($ID); break; } } } // если была нажата кнопка "Сохранить изменения" if ($find_type == "C" || $find_type == "K" || $find_type == "SR" || $find_type == "NOT_REF" || strlen($find_type) <= 0) { $show_responsible_column = "Y"; } $rsData = CTicketDictionary::GetList($by, $order, $arFilter, $is_filtered); $rsData = new CAdminResult($rsData, $sTableID); $rsData->NavStart(); // установка строки навигации $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);
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"]; } } }
} $arrSites = array(); $rs = CSite::GetList($by = "sort", $order = "asc"); while ($ar = $rs->Fetch()) { $arrSites[$ar["ID"]] = $ar; } $arCategory = $arMark = $arCriticality = array(); $rs = CTicketDictionary::GetList($v3 = "s_dropdown", $v4, array("TYPE" => "C"), $v5); while ($ar = $rs->Fetch()) { $arCategory[] = $ar; } $rs = CTicketDictionary::GetList($v3 = "s_dropdown", $v4, array("TYPE" => "K"), $v5); while ($ar = $rs->Fetch()) { $arCriticality[] = $ar; } $rs = CTicketDictionary::GetList($v3 = "s_dropdown", $v4, array("TYPE" => "M"), $v5); while ($ar = $rs->Fetch()) { $arMark[] = $ar; } $rs = CTicketSLA::GetByID($ID); if (!$rs || !$rs->ExtractFields()) { $ID = 0; $str_PRIORITY = 100; for ($i = 0; $i <= 6; $i++) { $arSHEDULE[$i]["OPEN_TIME"] = "24H"; } } else { $arGROUPS = CTicketSLA::GetGroupArray($ID); $arSHEDULE = CTicketSLA::GetSheduleArray($ID); $arSITES = CTicketSLA::GetSiteArray($ID); $arCATEGORIES = CTicketSLA::GetCategoryArray($ID);