コード例 #1
0
ファイル: functions.php プロジェクト: Satariall/izurit
 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;
 }
コード例 #2
0
ファイル: support.php プロジェクト: DarneoStudio/bitrix
 function Set_sendMails($nf, $v, $arFields)
 {
     $I_Email = null;
     $U_Email = null;
     if (!$v->isNew) {
         $U_Email = "Y";
     } else {
         $I_Email = "Y";
     }
     IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/classes/general/messages.php", $v->arrSite["LANGUAGE_ID"]);
     $mf = self::GetCSupportTableFields("EventFields");
     $mf->ADMIN_EDIT_URL = "/bitrix/admin/ticket_edit.php";
     $mf->LANGUAGE = $v->arrSite["LANGUAGE_ID"];
     $mf->LANGUAGE_ID = $v->arrSite["LANGUAGE_ID"];
     $arrSet = array("ID" => "ID", "DATE_CREATE" => "DATE_CREATE", "TIMESTAMP" => "TIMESTAMP_X", "DATE_CLOSE" => "DATE_CLOSE", "TITLE" => "TITLE", "CATEGORY" => "CATEGORY_NAME", "CRITICALITY" => "CRITICALITY_NAME", "DIFFICULTY" => "DIFFICULTY_NAME", "STATUS" => "STATUS_NAME", "SLA" => "SLA_NAME", "OWNER_USER_ID" => "OWNER_USER_ID", "OWNER_GUEST_ID" => "OWNER_GUEST_ID", "OWNER_SID" => "OWNER_SID", "OWNER_USER_NAME" => "OWNER_NAME", "OWNER_USER_LOGIN" => "OWNER_LOGIN", "OWNER_USER_EMAIL" => "OWNER_EMAIL", "RESPONSIBLE_USER_ID" => "RESPONSIBLE_USER_ID", "RESPONSIBLE_USER_NAME" => "RESPONSIBLE_NAME", "RESPONSIBLE_USER_LOGIN" => "RESPONSIBLE_LOGIN", "RESPONSIBLE_USER_EMAIL" => "RESPONSIBLE_EMAIL", "CREATED_USER_ID" => "CREATED_USER_ID", "CREATED_GUEST_ID" => "CREATED_GUEST_ID", "CREATED_USER_LOGIN" => "CREATED_LOGIN", "CREATED_USER_EMAIL" => "CREATED_EMAIL", "CREATED_USER_NAME" => "CREATED_NAME");
     if (!$v->isNew) {
         $arrSet["MODIFIED_USER_ID"] = "MODIFIED_USER_ID";
         $arrSet["MODIFIED_GUEST_ID"] = "MODIFIED_GUEST_ID";
         $arrSet["MODIFIED_USER_LOGIN"] = "******";
         $arrSet["MODIFIED_USER_EMAIL"] = "MODIFIED_EMAIL";
         $arrSet["MODIFIED_USER_NAME"] = "MODIFIED_NAME";
         $arrSet["RATE"] = "MARK_NAME";
         $arrSet["MESSAGES_AMOUNT"] = "MESSAGES";
     }
     $mf->FromArray((array) $nf, $arrSet);
     $arUserIDs = array($mf->OWNER_USER_ID, $mf->CREATED_USER_ID, $mf->MODIFIED_USER_ID, $mf->RESPONSIBLE_USER_ID);
     $arGuestIDs = array($mf->OWNER_GUEST_ID, $mf->CREATED_GUEST_ID, $mf->MODIFIED_GUEST_ID);
     $arStrUsers = CTicket::GetUsersPropertiesArray($arUserIDs, $arGuestIDs);
     // set name, login, email
     $userCategories = array('OWNER', 'RESPONSIBLE', 'CREATED');
     if (!$v->isNew) {
         $userCategories[] = 'MODIFIED';
     }
     foreach ($userCategories as $userCategory) {
         $propertyId = $userCategory . '_USER_ID';
         if ($mf->{$propertyId} > 0 && isset($arStrUsers['arUsers'][$mf->{$propertyId}])) {
             $name = CUser::FormatName(CSite::GetNameFormat(), $arStrUsers['arUsers'][$mf->{$propertyId}], true, true);
             $propertyName = $userCategory . '_USER_NAME';
             $mf->{$propertyName} = $name;
             $propertyLogin = $userCategory . '_USER_LOGIN';
             $mf->{$propertyLogin} = $arStrUsers['arUsers'][$mf->{$propertyId}]['LOGIN'];
             $propertyEmail = $userCategory . '_USER_EMAIL';
             $mf->{$propertyEmail} = $arStrUsers['arUsers'][$mf->{$propertyId}]['EMAIL'];
         }
     }
     $mf->FILES_LINKS = self::Set_getFilesLinks($v->arrFILES, $v->arrSite["LANGUAGE_ID"]);
     $mf->IMAGE_LINK = $mf->FILES_LINKS;
     $mf->MESSAGE_BODY = PrepareTxtForEmail($arFields["MESSAGE"], $v->arrSite["LANGUAGE_ID"], false, false);
     // сформируем email автора
     // Событие: "TICKET_CHANGE_BY_AUTHOR_FOR_AUTHOR"	- #DEFAULT_EMAIL_FROM# -> #OWNER_EMAIL# (Обращение изменено автором (для автора))
     // Событие: "TICKET_CHANGE_BY_SUPPORT_FOR_AUTHOR"	- #DEFAULT_EMAIL_FROM# -> #OWNER_EMAIL# (Обращение изменено сотрудником техподдержки (для автора))
     // Событие: "TICKET_NEW_FOR_AUTHOR"					- #DEFAULT_EMAIL_FROM# -> #OWNER_EMAIL# (Новое обращение (для автора))
     $ownerEmail = "";
     if ($mf->OWNER_USER_ID > 0 && isset($arStrUsers["arUsers"][$mf->OWNER_USER_ID])) {
         $ownerEmail = $arStrUsers["arUsers"][$mf->OWNER_USER_ID]["EMAIL"];
     } elseif ($mf->OWNER_GUEST_ID > 0 && isset($arStrUsers["arGuests"][$mf->OWNER_GUEST_ID])) {
         $ownerEmail = $arStrUsers["arGuests"][$mf->OWNER_GUEST_ID]["EMAIL"];
     }
     $arrOwnerEmails = self::EmailsFromStringToArray($mf->OWNER_SID, array($ownerEmail));
     if (intval($mf->OWNER_USER_ID) > 0) {
         $rs = CTicket::GetResponsibleList($mf->OWNER_USER_ID, $I_Email, $U_Email);
         while ($arr0 = $rs->Fetch()) {
             if (strlen($arr0['EMAIL']) > 0) {
                 $arrOwnerEmails[] = $arr0['EMAIL'];
             }
         }
     }
     $mf->OWNER_EMAIL = implode(", ", array_unique($arrOwnerEmails));
     // выбираем административные email'ы
     $arrAdminEMails = CTicket::GetAdminEmails();
     if (!is_array($arrAdminEMails)) {
         $arrAdminEMails = array();
     }
     TrimArr($arrAdminEMails);
     // сформируем email техподдержки
     // Событие: "TICKET_OVERDUE_REMINDER"				- #DEFAULT_EMAIL_FROM# -> #SUPPORT_EMAIL# (Напоминание о необходимости ответа (для техподдержки))
     // Событие: "TICKET_CHANGE_FOR_TECHSUPPORT"			- #DEFAULT_EMAIL_FROM# -> #SUPPORT_EMAIL# (Изменения в обращении (для техподдержки))
     // Событие: "TICKET_NEW_FOR_TECHSUPPORT"			- #DEFAULT_EMAIL_FROM# -> #SUPPORT_EMAIL# (Новое обращение (для техподдержки))
     $arrSupportEmails = array();
     if ($mf->RESPONSIBLE_USER_ID > 0 && isset($arStrUsers["arUsers"][$mf->RESPONSIBLE_USER_ID])) {
         $arrSupportEmails[] = $arStrUsers["arUsers"][$mf->RESPONSIBLE_USER_ID]["EMAIL"];
         // из группы ответсвенного, выбираем всех пользователей кто имеет доступ к рассылке
         $rs = CTicket::GetResponsibleList($mf->RESPONSIBLE_USER_ID, $I_Email, $U_Email, "Y");
         while ($arr0 = $rs->Fetch()) {
             if (strlen($arr0['EMAIL']) > 0) {
                 $arrSupportEmails[] = $arr0['EMAIL'];
             }
         }
     }
     if (count($arrSupportEmails) <= 0) {
         $arrSupportEmails = $arrAdminEMails;
     }
     if (count($arrSupportEmails) <= 0) {
         $se = COption::GetOptionString("main", "email_from", "");
         if (strlen($se) > 0) {
             $arrSupportEmails[] = $se;
         }
     }
     TrimArr($arrSupportEmails);
     $mf->SUPPORT_EMAIL = count($arrSupportEmails) > 0 ? TrimEx(implode(",", array_unique($arrSupportEmails)), ",") : "";
     // удалим продублированные адреса из макроса #SUPPORT_ADMIN_EMAIL#
     if (count($arrSupportEmails) > 0) {
         foreach ($arrSupportEmails as $e) {
             unset($arrAdminEMails[$e]);
         }
     }
     $mf->SUPPORT_ADMIN_EMAIL = count($arrAdminEMails) > 0 ? TrimEx(implode(",", $arrAdminEMails), ",") : "";
     if (array_key_exists('PUBLIC_EDIT_URL', $arFields) && strlen($arFields['PUBLIC_EDIT_URL']) > 0) {
         $mf->PUBLIC_EDIT_URL = $arFields['PUBLIC_EDIT_URL'];
     } else {
         $peurl = COption::GetOptionString("support", "SUPPORT_DIR");
         $peurl = str_replace("#LANG_DIR#", $v->arrSite["DIR"], $peurl);
         // совместимость
         $peurl = str_replace("#SITE_DIR#", $v->arrSite["DIR"], $peurl);
         $peurl = str_replace("\\", "/", $peurl);
         $peurl = str_replace("//", "/", $peurl);
         $peurl = TrimEx($peurl, "/");
         $mf->PUBLIC_EDIT_URL = "/" . $peurl . "/" . COption::GetOptionString("support", "SUPPORT_EDIT");
     }
     $mf->SUPPORT_COMMENTS = PrepareTxtForEmail($arFields["SUPPORT_COMMENTS"], $v->arrSite["LANGUAGE_ID"]);
     if (strlen($mf->SUPPORT_COMMENTS) > 0) {
         $mf->SUPPORT_COMMENTS = "\n\n" . $mf->SUPPORT_COMMENTS . "\n";
     }
     $mf->SOURCE = strlen($nf->SOURCE_NAME) <= 0 ? "" : "[" . $nf->SOURCE_NAME . "] ";
     $oUID = intval($mf->OWNER_USER_ID);
     $oGID = intval($mf->OWNER_GUEST_ID);
     if ($oGID > 0) {
         $mf->OWNER_TEXT = $arStrUsers["arGuests"][$oGID]["HTML_NAME_S"];
         if ($oUID > 0) {
             $mf->OWNER_TEXT .= self::addSupportText($oUID);
         }
     } elseif ($oUID > 0) {
         $mf->OWNER_TEXT = $arStrUsers["arUsers"][$oUID]["HTML_NAME_S"];
         $mf->OWNER_TEXT .= self::addSupportText($oUID);
     }
     if (strlen(trim($mf->OWNER_SID)) > 0 && $mf->OWNER_SID != null) {
         $mf->OWNER_TEXT = " / " . $mf->OWNER_TEXT;
     }
     if ($nf->CREATED_MODULE_NAME == "support" || strlen($nf->CREATED_MODULE_NAME) <= 0) {
         $cUID = intval($mf->CREATED_USER_ID);
         $cGID = intval($mf->CREATED_GUEST_ID);
         if ($cGID > 0) {
             $mf->CREATED_TEXT = $arStrUsers["arGuests"][$cGID]["HTML_NAME_S"];
         } elseif ($cUID > 0) {
             $mf->CREATED_TEXT = $arStrUsers["arUsers"][$cUID]["HTML_NAME_S"];
         }
     } else {
         $mf->CREATED_MODULE_NAME = "[" . $nf->CREATED_MODULE_NAME . "]";
     }
     $rUID = intval($mf->RESPONSIBLE_USER_ID);
     if ($rUID > 0) {
         $mf->RESPONSIBLE_TEXT = $arStrUsers["arUsers"][$rUID]["HTML_NAME_S"];
         $mf->RESPONSIBLE_TEXT .= self::addSupportText($rUID);
     }
     /*
     if($mf->OWNER_USER_ID > 0 || strlen(trim($mf->OWNER_USER_LOGIN)) > 0)
     {
     	$mf->OWNER_TEXT = "[" . $mf->OWNER_USER_ID . "] (" . $mf->OWNER_USER_LOGIN . ") " . $mf->OWNER_USER_NAME;
     	if(strlen(trim($mf->OWNER_SID)) > 0 && $mf->OWNER_SID != null) $mf->OWNER_TEXT = " / " . $mf->OWNER_TEXT;
     	$mf->OWNER_TEXT .= self::addSupportText($mf->OWNER_USER_ID);
     }
     
     if($nf->CREATED_MODULE_NAME == "support")
     {
     	$mf->CREATED_MODULE_NAME = "";
     	if($mf->CREATED_USER_ID > 0)
     	{
     		$mf->CREATED_TEXT = "[" . $mf->CREATED_USER_ID . "] (" . $mf->CREATED_USER_LOGIN . ") " . $mf->CREATED_USER_NAME . self::addSupportText($mf->CREATED_USER_ID);
     	}
     }
     else
     {
     	$mf->CREATED_MODULE_NAME = "[" . $nf->CREATED_MODULE_NAME . "]";
     }
     
     if($mf->RESPONSIBLE_USER_ID > 0)
     {
     	$mf->RESPONSIBLE_TEXT = "[" . $mf->RESPONSIBLE_USER_ID . "] (" . $nf->RESPONSIBLE_LOGIN . ") " . $nf->RESPONSIBLE_NAME;
     	$mf->RESPONSIBLE_TEXT .= self::addSupportText($mf->RESPONSIBLE_USER_ID);
     }
     */
     if (!$v->isNew) {
         /*
         if($nf->MODIFIED_MODULE_NAME == "support" && strlen($nf->MODIFIED_MODULE_NAME) > 0)
         {
         	$mf->MODIFIED_MODULE_NAME = "";
         	if($mf->MODIFIED_USER_ID > 0)
         	{
         		$mf->MODIFIED_TEXT = "[" . $mf->MODIFIED_USER_ID . "] (" . $mf->MODIFIED_USER_LOGIN . ") " . $mf->MODIFIED_USER_NAME;
         		$mf->MODIFIED_TEXT .= self::addSupportText($mf->MODIFIED_USER_ID);
         	}
         }
         else $mf->MODIFIED_MODULE_NAME = "[" . $nf->MODIFIED_MODULE_NAME . "]";
         */
         if ($nf->MODIFIED_MODULE_NAME == "support" || strlen($nf->MODIFIED_MODULE_NAME) <= 0) {
             $rUID = intval($mf->MODIFIED_USER_ID);
             $rGID = intval($mf->MODIFIED_GUEST_ID);
             if ($rGID > 0) {
                 $mf->MODIFIED_TEXT = $arStrUsers["arGuests"][$rGID]["HTML_NAME_S"];
                 if ($rUID > 0) {
                     $mf->MODIFIED_TEXT .= self::addSupportText($rUID);
                 }
             } elseif ($rUID > 0) {
                 $mf->MODIFIED_TEXT = $arStrUsers["arUsers"][$rUID]["HTML_NAME_S"];
                 $mf->MODIFIED_TEXT .= self::addSupportText($rUID);
             }
         } else {
             $mf->MODIFIED_MODULE_NAME = "[" . $nf->MODIFIED_MODULE_NAME . "]";
         }
         $mf->MESSAGE_SOURCE = "";
         if ($rsSource = CTicketDictionary::GetByID($arFields["MESSAGE_SOURCE_ID"])) {
             $arSource = $rsSource->Fetch();
             $mf->MESSAGE_SOURCE = array_key_exists("NAME", $arSource) && strlen($arSource["NAME"]) > 0 ? "[" . $arSource["NAME"] . "] " : "";
         }
         if ((strlen(trim($arFields["MESSAGE_AUTHOR_SID"])) > 0 || intval($arFields["MESSAGE_AUTHOR_USER_ID"]) > 0) && $v->bSupportTeam) {
             $mf->MESSAGE_AUTHOR_USER_ID = $arFields["MESSAGE_AUTHOR_USER_ID"];
             $mf->MESSAGE_AUTHOR_SID = $arFields["MESSAGE_AUTHOR_SID"];
         } else {
             $mf->MESSAGE_AUTHOR_USER_ID = $v->uid;
         }
         $arMA = array();
         if ($rsMA = CUser::GetByID($mf->MESSAGE_AUTHOR_USER_ID)) {
             $arMA = $rsMA->Fetch();
         }
         if ($mf->MESSAGE_AUTHOR_USER_ID > 0 || strlen(trim($arMA["LOGIN"])) > 0) {
             $mf->MESSAGE_AUTHOR_TEXT = "[" . $mf->MESSAGE_AUTHOR_USER_ID . "] (" . $arMA["LOGIN"] . ") " . $arMA["NAME"] . " " . $arMA["LAST_NAME"];
             if (strlen(trim($arFields["MESSAGE_AUTHOR_SID"])) > 0) {
                 $mf->MESSAGE_AUTHOR_TEXT = " / " . $mf->MESSAGE_AUTHOR_TEXT;
             }
             if ($mf->MESSAGE_AUTHOR_USER_ID > 0) {
                 $mf->MESSAGE_AUTHOR_TEXT .= self::addSupportText($mf->MESSAGE_AUTHOR_USER_ID);
             }
         }
         if (strlen(trim($arMA["NAME"])) > 0 || strlen(trim($arMA["LAST_NAME"])) > 0) {
             $mf->MESSAGE_AUTHOR_USER_NAME = trim($arMA["NAME"]) . " " . trim($arMA["LAST_NAME"]);
         }
         if (strlen(trim($arMA["LOGIN"])) > 0) {
             $mf->MESSAGE_AUTHOR_USER_LOGIN = $arMA["LOGIN"];
         }
         if (strlen(trim($arMA["EMAIL"])) > 0) {
             $mf->MESSAGE_AUTHOR_USER_EMAIL = $arMA["EMAIL"];
         }
         $mf->MESSAGE_HEADER = str_repeat("=", 23) . " " . GetMessage("SUP_MAIL_MESSAGE") . " " . str_repeat("=", 34);
     }
     $mf->SPAM_MARK = "";
     if (strlen($nf->IS_SPAM) > 0) {
         if ($nf->IS_SPAM == "Y") {
             $mf->SPAM_MARK = "\n" . GetMessage("SUP_EXACTLY_SPAM") . "\n";
         } else {
             $mf->SPAM_MARK = "\n" . GetMessage("SUP_POSSIBLE_SPAM") . "\n";
         }
     }
     self::Set_WriteLog($nf, $v, $mf);
     //$v  +change, +change_hidden
     if (!$v->isNew) {
         $mf->MESSAGE_FOOTER = str_repeat("=", strlen($mf->MESSAGE_HEADER));
     }
     if ($v->isNew && $v->bActiveCoupon) {
         $mf->COUPON = $v->V_COUPON;
     }
     $arEventFields_author = $mf->ToArray(CSupportTableFields::ALL);
     //, array(CSupportTableFields::NOT_NULL)
     $arEventFields_support = $arEventFields_author;
     // отсылаем письмо автору
     if ($v->SEND_EMAIL_TO_AUTHOR == "Y" && ($v->isNew || strlen($v->change) > 0)) {
         $EventType = "TICKET_NEW_FOR_AUTHOR";
         if (!$v->isNew) {
             // HIDDEN
             if ($arFields["HIDDEN"] == "Y") {
                 $arrUnsetHidden = array("MESSAGE_BODY", "IMAGE_LINK");
                 foreach ($arrUnsetHidden as $value) {
                     $arEventFields_author[$value] = "";
                 }
             }
             $EventType = "TICKET_CHANGE_BY_AUTHOR_FOR_AUTHOR";
             if (CTicket::IsSupportTeam($mf->MESSAGE_AUTHOR_USER_ID) || CTicket::IsAdmin($mf->MESSAGE_AUTHOR_USER_ID)) {
                 $EventType = "TICKET_CHANGE_BY_SUPPORT_FOR_AUTHOR";
             }
         }
         $arEventFields_author = CTicket::ExecuteEvents('OnBeforeSendMailToAuthor', $arEventFields_author, $v->isNew, $EventType);
         if ($arEventFields_author) {
             CEvent::Send($EventType, $v->arrSite["ID"], $arEventFields_author);
         }
     }
     // отсылаем письмо техподдержке
     if ($v->SEND_EMAIL_TO_TECHSUPPORT == "Y" && ($v->isNew || strlen($v->change) > 0 || strlen($v->change_hidden) > 0)) {
         $EventType = "TICKET_NEW_FOR_TECHSUPPORT";
         if (!$v->isNew) {
             $arEventFields_support["WHAT_CHANGE"] .= $v->change_hidden;
             $EventType = "TICKET_CHANGE_FOR_TECHSUPPORT";
         }
         $arEventFields_support = CTicket::ExecuteEvents('OnBeforeSendMailToSupport', $arEventFields_support, $v->isNew);
         if ($arEventFields_support) {
             CEvent::Send($EventType, $v->arrSite["ID"], $arEventFields_support);
         }
     }
 }
コード例 #3
0
 function CheckFields($arFields, $id = false)
 {
     $arMsg = array();
     if ($id === false && !(array_key_exists('NAME', $arFields) && strlen($arFields['NAME']) > 0)) {
         $arMsg[] = array("id" => "NAME", "text" => GetMessage("SUP_FORGOT_NAME"));
     }
     if ($id !== false) {
         $rs = CTicketDictionary::GetByID($id);
         if (!$rs->Fetch()) {
             $arMsg[] = array("id" => "ID", "text" => GetMessage("SUP_UNKNOWN_ID", array('#ID#' => $id)));
         }
     }
     if (array_key_exists('SID', $arFields) && preg_match("#[^A-Za-z_0-9]#", $arFields['SID'])) {
         $arMsg[] = array("id" => "SID", "text" => GetMessage("SUP_INCORRECT_SID"));
     } elseif (strlen($arFields['SID']) > 0 && array_key_exists('arrSITE', $arFields) && is_array($arFields['arrSITE']) && count($arFields['arrSITE']) > 0) {
         $arFilter = array("TYPE" => $arFields['C_TYPE'], "SID" => $arFields['SID'], "SITE" => $arFields['arrSITE']);
         if (intval($id) > 0) {
             $arFilter['ID'] = '~' . intval($id);
         }
         $z = CTicketDictionary::GetList($v1, $v2, $arFilter, $v3);
         if ($zr = $z->Fetch()) {
             $arMsg[] = array("id" => "SID", "text" => GetMessage('SUP_SID_ALREADY_IN_USE', array('#TYPE#' => CTicketDictionary::GetTypeNameByID($arFields['C_TYPE']), '#LANG#' => strlen($zr['LID']) > 0 ? $zr['LID'] : $zr['SITE_ID'], '#RECORD_ID#' => $zr['ID'])));
         }
     }
     if (count($arMsg) > 0) {
         $e = new CAdminException($arMsg);
         $GLOBALS['APPLICATION']->ThrowException($e);
         return false;
     }
     return true;
 }
コード例 #4
0
ファイル: ticket_list.php プロジェクト: ASDAFF/bitrix-5
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);
		}
	}
}
コード例 #5
0
    			elseif ($new=="Y") LocalRedirect("/bitrix/admin/ticket_dict_edit.php?ID=".$ID. "&lang=".LANGUAGE_ID."&find_type=".$str_C_TYPE."&set_filter=Y&tabControl_active_tab=".urlencode($tabControl_active_tab));
    		}
    	}
    	else
    	{
    		if ($e = $APPLICATION->GetException())
    			$message = new CAdminMessage(GetMessage("SUP_ERROR"), $e);
    	}
    	//*/
}
$arrSites = array();
$rs = CSite::GetList($by = "sort", $order = "asc");
while ($ar = $rs->Fetch()) {
    $arrSites[$ar["ID"]] = $ar;
}
$tdic = CTicketDictionary::GetByID($ID);
if (!($tdic && $tdic->ExtractFields())) {
    $ID = 0;
    $str_C_SORT = "100";
    $arrSite = $_SESSION["SESS_TICKET_DIC_SITE"];
    $str_C_TYPE = symbolsAndNumbers($find_type);
    if (strlen($str_C_TYPE) > 0) {
        $str_C_SORT = CTicketDictionary::GetNextSort($TYPE_ID);
    }
    //$str_EVENT1 = "ticket";
    $str_EVENT1 = "";
} else {
    $arrSITE = CTicketDictionary::GetSiteArray($ID);
    if ($str_C_TYPE != "C") {
        $str_EVENT1 = "";
        $str_EVENT2 = "";
コード例 #6
0
ファイル: ticket_edit.php プロジェクト: DarneoStudio/bitrix
function Support_GetDictionaryInfo($DID, &$name, &$desc, &$sid, $safe_for_html = true)
{
    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"];
        } else {
            $rsD = CTicketDictionary::GetByID($DID);
            $arD = $rsD->Fetch();
            $name = $arD["NAME"];
            $desc = $arD["DESCR"];
            $sid = $arD["SID"];
            $arrDic[$DID] = array("NAME" => $name, "DESC" => $desc, "SID" => $sid);
        }
        if ($safe_for_html) {
            $name = htmlspecialcharsbx($name);
            $desc = htmlspecialcharsbx($desc);
            $sid = htmlspecialcharsbx($sid);
        }
    }
}