예제 #1
0
 }
 if ($gadget["SECURITY_ONLY"] == true) {
     $aGlobalOpt = CUserOptions::GetOption("global", "settings", array());
     $bShowSecurity = file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/security/install/index.php") && $aGlobalOpt['messages']['security'] != 'N';
     if (!$bShowSecurity) {
         continue;
     }
 }
 if ($gadget["PERFMON_ONLY"] == true) {
     $aGlobalOpt = CUserOptions::GetOption("global", "settings", array());
     $bShowPerfmon = file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/perfmon/install/index.php") && $aGlobalOpt['messages']['perfmon'] != 'N';
     if (!$bShowPerfmon) {
         continue;
     }
 }
 if ($gadget["SUPPORT_ONLY"] == true && (!CModule::IncludeModule("support") || !$USER->IsAuthorized() || !CTicket::IsSupportClient() && !CTicket::IsAdmin() && !CTicket::IsSupportTeam())) {
     continue;
 }
 if ($gadget["WIKI_ONLY"] == true && !IsModuleInstalled("wiki")) {
     continue;
 }
 if ($gadget["CRM_ONLY"] == true && !IsModuleInstalled("crm")) {
     continue;
 }
 if ($gadget["VOTE_ONLY"] == true && (!IsModuleInstalled("vote") || !CBXFeatures::IsFeatureEnabled("Vote"))) {
     continue;
 }
 if ($gadget["TASKS_ONLY"] == true && !CBXFeatures::IsFeatureEnabled("Tasks")) {
     continue;
 }
 if ($gadget["MESSENGER_ONLY"] == true && !CBXFeatures::IsFeatureEnabled("WebMessenger")) {
예제 #2
0
<?php

/*
##############################################
# Bitrix: SiteManager                        #
# Copyright (c) 2004 Bitrix                  #
# http://www.bitrix.ru                       #
# mailto:admin@bitrix.ru                     #
##############################################
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/include.php";
$bDemo = CTicket::IsDemo() ? "Y" : "N";
$bAdmin = CTicket::IsAdmin() ? "Y" : "N";
$bSupportTeam = CTicket::IsSupportTeam() ? "Y" : "N";
if ($bAdmin != "Y" && $bSupportTeam != "Y" && $bDemo != "Y") {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/colors.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/img.php";
$diameter = intval($diameter) > 0 ? intval($diameter) : 180;
InitBVar($find_responsible_exact_match);
$arFilter = array("SITE" => $find_site, "DATE_CREATE_1" => $find_date1, "DATE_CREATE_2" => $find_date2, "RESPONSIBLE_ID" => $find_responsible_id, "RESPONSIBLE" => $find_responsible, "RESPONSIBLE_EXACT_MATCH" => $find_responsible_exact_match, "SLA" => $find_sla_id, "CATEGORY" => $find_category_id, "CRITICALITY" => $find_criticality_id, "STATUS" => $find_status_id, "MARK" => $find_mark_id, "SOURCE" => $find_source_id);
$CHECK_RIGHTS = $bDemo == "Y" ? "N" : "Y";
$rsTickets = CTicket::GetList($by, $order, $arFilter, $is_filtered, $CHECK_RIGHTS, "N", "N");
$arrMess = array();
$arrMess["2_m"] = 0;
$arrMess["3_m"] = 0;
$arrMess["4_m"] = 0;
$arrMess["5_m"] = 0;
$arrMess["6_m"] = 0;
예제 #3
0
 function GetMessageList(&$by, &$order, $arFilter = array(), &$isFiltered, $checkRights = "Y", $getUserName = "******")
 {
     $err_mess = CTicket::err_mess() . "<br>Function: GetMessageList<br>Line: ";
     global $DB, $USER, $APPLICATION;
     $bAdmin = "N";
     $bSupportTeam = "N";
     $bSupportClient = "N";
     $bDemo = "N";
     if ($checkRights == "Y") {
         $bAdmin = CTicket::IsAdmin() ? "Y" : "N";
         $bSupportTeam = CTicket::IsSupportTeam() ? "Y" : "N";
         $bSupportClient = CTicket::IsSupportClient() ? "Y" : "N";
         $bDemo = CTicket::IsDemo() ? "Y" : "N";
         $uid = intval($USER->GetID());
     } else {
         $bAdmin = "Y";
         $bSupportTeam = "Y";
         $bSupportClient = "Y";
         $bDemo = "Y";
         $uid = 0;
     }
     if ($bAdmin != "Y" && $bSupportTeam != "Y" && $bSupportClient != "Y" && $bDemo != "Y") {
         return false;
     }
     $arSqlSearch = array();
     $strSqlSearch = "";
     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;
             }
             $matchValueSet = in_array($key . "_EXACT_MATCH", $filterKeys) ? true : false;
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $matchValueSet ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("M.ID", $val, $match);
                     break;
                 case "TICKET_ID":
                     $arSqlSearch[] = "M.TICKET_ID = " . intval($val);
                     break;
                 case "TICKET":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $matchValueSet ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("M.TICKET_ID", $val, $match);
                     break;
                 case "IS_MESSAGE":
                     $arSqlSearch[] = $val == "Y" ? "(M.IS_HIDDEN = 'N' and M.IS_LOG='N' and M.IS_OVERDUE='N')" : "(M.IS_HIDDEN = 'Y' or M.IS_LOG='Y' or M.IS_OVERDUE='Y')";
                     break;
                 case "IS_HIDDEN":
                 case "IS_LOG":
                 case "IS_OVERDUE":
                 case "NOT_CHANGE_STATUS":
                 case "MESSAGE_BY_SUPPORT_TEAM":
                     $arSqlSearch[] = $val == "Y" ? "M." . $key . "='Y'" : "M." . $key . "='N'";
                     break;
                 case "EXTERNAL_FIELD_1":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $matchValueSet ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("M.EXTERNAL_FIELD_1", $val, $match);
                     break;
             }
         }
     }
     if ($getUserName == "Y") {
         $u_select = "\n\t\t\t\t,\n\t\t\t\tUO.EMAIL\t\t\t\t\t\t\t\t\t\t\t\tOWNER_EMAIL,\n\t\t\t\tUO.LOGIN\t\t\t\t\t\t\t\t\t\t\t\tOWNER_LOGIN,\n\t\t\t\tconcat(ifnull(UO.NAME,''),' ',ifnull(UO.LAST_NAME,''))\tOWNER_NAME,\n\t\t\t\tUO.LOGIN\t\t\t\t\t\t\t\t\t\t\t\tLOGIN,\n\t\t\t\tconcat(ifnull(UO.NAME,''),' ',ifnull(UO.LAST_NAME,''))\tNAME,\n\t\t\t\tUC.EMAIL\t\t\t\t\t\t\t\t\t\t\t\tCREATED_EMAIL,\n\t\t\t\tUC.LOGIN\t\t\t\t\t\t\t\t\t\t\t\tCREATED_LOGIN,\n\t\t\t\tconcat(ifnull(UC.NAME,''),' ',ifnull(UC.LAST_NAME,''))\tCREATED_NAME,\n\t\t\t\tUM.EMAIL\t\t\t\t\t\t\t\t\t\t\t\tMODIFIED_EMAIL,\n\t\t\t\tUM.LOGIN\t\t\t\t\t\t\t\t\t\t\t\tMODIFIED_LOGIN,\n\t\t\t\tconcat(ifnull(UM.NAME,''),' ',ifnull(UM.LAST_NAME,''))\tMODIFIED_NAME\n\t\t\t\t";
         $u_join = "\n\t\t\tLEFT JOIN b_user UO ON (UO.ID = M.OWNER_USER_ID)\n\t\t\tLEFT JOIN b_user UC ON (UC.ID = M.CREATED_USER_ID)\n\t\t\tLEFT JOIN b_user UM ON (UM.ID = M.MODIFIED_USER_ID)\n\t\t\t";
     }
     if ($bSupportTeam != "Y" && $bAdmin != "Y") {
         $arSqlSearch[] = "M.IS_HIDDEN='N'";
         $arSqlSearch[] = "M.IS_LOG='N'";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY M.ID";
     } elseif ($by == "s_number") {
         $strSqlOrder = "ORDER BY M.C_NUMBER";
     } else {
         $by = "s_number";
         $strSqlOrder = "ORDER BY M.C_NUMBER";
     }
     if ($order == "desc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     } else {
         $strSqlOrder .= " asc ";
         $order = "asc";
     }
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tM.*,\n\t\t\t\tT.SLA_ID,\n\t\t\t\t" . $DB->DateToCharFunction("M.DATE_CREATE") . "\t\t\tDATE_CREATE,\n\t\t\t\t" . $DB->DateToCharFunction("M.TIMESTAMP_X") . "\t\t\tTIMESTAMP_X,\n\t\t\t\tDS.NAME\t\t\t\t\t\t\t\t\t\t\t\t\tSOURCE_NAME\n\t\t\t\t{$u_select}\n\t\t\tFROM\n\t\t\t\tb_ticket_message M\n\t\t\tINNER JOIN b_ticket T ON (T.ID = M.TICKET_ID)\n\t\t\tLEFT JOIN b_ticket_dictionary DS ON (DS.ID = M.SOURCE_ID)\n\t\t\t{$u_join}\n\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t{$strSqlOrder}\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     return $res;
 }
예제 #4
0
 if (is_array($arFILES) && count($arFILES) > 0) {
     $max_size = COption::GetOptionString("support", "SUPPORT_MAX_FILESIZE");
     $max_size = intval($max_size) * 1024;
     foreach ($arFILES as $key => $arFILE) {
         if (intval($arFILE["size"]) > $max_size || intval($arFILE["error"]) > 0) {
             $strError .= str_replace("#FILE_NAME#", $arFILE["name"], GetMessage("SUP_MAX_FILE_SIZE_EXCEEDING")) . "<br>";
         }
     }
 }
 $arParams["TICKET_LIST_URL"] = trim($arParams["TICKET_LIST_URL"]);
 $arParams["TICKET_LIST_URL"] = strlen($arParams["TICKET_LIST_URL"]) > 0 ? htmlspecialcharsbx($arParams["TICKET_LIST_URL"]) : "ticket_list.php";
 if ($strError == "") {
     // check before writing,  user access to ticket
     $bSetTicket = false;
     if ($arParams["ID"] > 0) {
         if (CTicket::IsAdmin()) {
             $bSetTicket = true;
         } else {
             $rsTicket = CTicket::GetByID($arParams["ID"], SITE_ID, $check_rights = "Y", $get_user_name = "N", $get_extra_names = "N");
             if ($arTicket = $rsTicket->GetNext()) {
                 $bSetTicket = true;
             }
         }
     } else {
         $bSetTicket = true;
     }
     if ($bSetTicket) {
         if ($_REQUEST["OPEN"] == "Y") {
             $_REQUEST["CLOSE"] = "N";
         }
         if ($_REQUEST["CLOSE"] == "Y") {
예제 #5
0
 function Set_InitVar(&$arFields, $id, $checkRights, $sendEmailToAuthor, $sendEmailToTechsupport)
 {
     global $APPLICATION, $USER, $DB;
     $f = self::GetCSupportTableFields("b_ticket");
     $v = (object) array();
     if (!is_object($USER)) {
         $USER = new CUser();
     }
     $uid = $USER->GetID();
     if (isset($arFields["CURRENT_USER_ID"]) && intval($arFields["CURRENT_USER_ID"]) > 0) {
         $uid = intval($arFields["CURRENT_USER_ID"]);
     }
     $f->ID = intval($id);
     $v->isNew = $f->ID <= 0;
     $v->CHECK_RIGHTS = $checkRights == "Y" ? "Y" : "N";
     $v->SEND_EMAIL_TO_AUTHOR = $sendEmailToAuthor == "Y" ? "Y" : "N";
     $v->SEND_EMAIL_TO_TECHSUPPORT = $sendEmailToTechsupport == "Y" ? "Y" : "N";
     $v->newSLA = false;
     // заголовок и сообщение - обязательные поля для нового обращения
     if ($v->isNew) {
         if (strlen($arFields["TITLE"]) <= 0) {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_EMPTY_TITLE'));
             return false;
         }
         if (strlen($arFields["MESSAGE"]) <= 0) {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_EMPTY_MESSAGE'));
             return false;
         }
     }
     if (is_object($APPLICATION)) {
         $APPLICATION->ResetException();
     }
     if (!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("SUPPORT", $f->ID, $arFields)) {
         if (is_object($APPLICATION) && $APPLICATION->GetException()) {
             return false;
         } else {
             $APPLICATION->ThrowException("Unknown error. ");
             return false;
         }
     }
     // установка прав
     $v->bAdmin = $v->bSupportTeam = $v->bSupportClient = $v->bDemo = $v->bOwner = false;
     if ($v->CHECK_RIGHTS == "Y") {
         $v->uid = $uid;
         $v->bAdmin = CTicket::IsAdmin($uid);
         $v->bSupportTeam = CTicket::IsSupportTeam($uid);
         $v->bSupportClient = CTicket::IsSupportClient($uid);
         $v->bDemo = CTicket::IsDemo($uid);
         if ($v->isNew) {
             $v->bOwner = true;
         } else {
             $v->bOwner = CTicket::IsOwner($f->ID, $v->uid);
         }
     } else {
         $v->bAdmin = $v->bSupportTeam = $v->bSupportClient = $v->bDemo = $v->bOwner = true;
         $v->uid = 0;
     }
     if (!$v->bAdmin && !$v->bSupportTeam && !$v->bSupportClient) {
         return false;
     }
     if (!$v->bAdmin && !$v->bSupportTeam && ($v->bDemo && !$v->bOwner)) {
         return false;
     }
     // Это спам?
     $f->FromArray($arFields, "IS_SPAM");
     $v->bActiveCoupon = false;
     $f->FromArray($_SESSION, array("MODIFIED_GUEST_ID" => "SESS_GUEST_ID"), array(CSupportTableFields::MORE0));
     $f->FromArray($arFields, "OWNER_USER_ID,OWNER_SID,HOLD_ON", array(CSupportTableFields::MORE0, CSupportTableFields::NOT_EMTY_STR));
     // получим SITE_ID
     if (strlen($arFields["SITE_ID"]) > 0) {
         $f->SITE_ID = $arFields["SITE_ID"];
     } elseif (strlen($arFields["SITE"]) > 0) {
         $f->SITE_ID = $arFields["SITE"];
     } elseif (strlen($arFields["LANG"]) > 0) {
         $f->SITE_ID = $arFields["LANG"];
     } else {
         $f->SITE_ID = SITE_ID;
     }
     // получаем ID записей справочника по SID
     $arr = array("CATEGORY" => "C", "CRITICALITY" => "K", "STATUS" => "S", "MARK" => "M", "SOURCE" => "SR", "MESSAGE_SOURCE" => "SR", "DIFFICULTY" => "D");
     foreach ($arr as $key => $value) {
         if ((array_key_exists($key . "_ID", $arFields) || intval($arFields[$key . "_ID"]) <= 0) && array_key_exists($key . "_SID", $arFields) && strlen($arFields[$key . "_SID"]) > 0) {
             $z = CTicketDictionary::GetBySID($arFields[$key . "_SID"], $value, $f->SITE_ID);
             $zr = $z->Fetch();
             $arFields[$key . "_ID"] = $zr["ID"];
         }
     }
     return array("v" => $v, "f" => $f);
 }
예제 #6
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
require_once $_SERVER["DOCUMENT_ROOT"] . $componentPath . "/functions.php";
if (!CModule::IncludeModule("support")) {
    ShowError(GetMessage("MODULE_NOT_INSTALL"));
    return;
}
//Permissions
if (!($USER->IsAuthorized() && (CTicket::IsSupportClient() || CTicket::IsAdmin() || CTicket::IsSupportTeam()))) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
//Sorting
InitSorting();
if (strlen($GLOBALS["by"]) <= 0) {
    $GLOBALS["by"] = "s_timestamp";
    $GLOBALS["order"] = "s_timestamp";
}
//Filter
$FilterArr = array("find_id", "find_id_exact_match", "find_site", "find_lamp", "find_close", "find_title", "find_title_exact_match", "find_message", "find_message_exact_match");
_InitFilter($FilterArr);
InitBVar($_REQUEST["find_id_exact_match"]);
InitBVar($_REQUEST["find_title_exact_match"]);
InitBVar($_REQUEST["find_message_exact_match"]);
$arFilter = array("ID" => $_REQUEST["find_id"], "ID_EXACT_MATCH" => $_REQUEST["find_id_exact_match"], "LAMP" => $_REQUEST["find_lamp"], "CLOSE" => $_REQUEST["find_close"], "TITLE" => $_REQUEST["find_title"], "TITLE_EXACT_MATCH" => $_REQUEST["find_title_exact_match"], "MESSAGE" => $_REQUEST["find_message"], "MESSAGE_EXACT_MATCH" => $_REQUEST["find_message_exact_match"]);
if (strlen($arParams["SITE_ID"]) > 0) {
    $arFilter["LID"] = $arParams["SITE_ID"];
}
//TICKET_EDIT_TEMPLATE
예제 #7
0
 function Delete($id, $CHECK_RIGHTS = "Y")
 {
     $err_mess = CAllTicketDictionary::err_mess() . "<br>Function: Delete<br>Line: ";
     global $DB, $APPLICATION;
     $id = intval($id);
     if ($id <= 0) {
         return;
     }
     $bAdmin = "N";
     if ($CHECK_RIGHTS == "Y") {
         $bAdmin = CTicket::IsAdmin() ? "Y" : "N";
     } else {
         $bAdmin = "Y";
     }
     if ($bAdmin == "Y") {
         $DB->Query("DELETE FROM b_ticket_dictionary WHERE ID='{$id}'", false, $err_mess . __LINE__);
         $DB->Query('DELETE FROM b_ticket_dictionary_2_site WHERE DICTIONARY_ID=' . $id, false, $err_mess . __LINE__);
     }
 }
예제 #8
0
			continue;
	}
	if ($gadget["PERFMON_ONLY"] == true)
	{
		$aGlobalOpt = CUserOptions::GetOption("global", "settings", array());
		$bShowPerfmon = (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/perfmon/install/index.php") && $aGlobalOpt['messages']['perfmon'] <> 'N');
		if (!$bShowPerfmon)
			continue;
	}
	if (
		$gadget["SUPPORT_ONLY"] == true
		&&
		(
			!CModule::IncludeModule("support")
			|| !$USER->IsAuthorized()
			|| (!CTicket::IsSupportClient() && !CTicket::IsAdmin() && !CTicket::IsSupportTeam())
		)
	)
		continue;
	if ($gadget["WIKI_ONLY"] == true && !IsModuleInstalled("wiki"))
		continue;
	if ($gadget["CRM_ONLY"] == true && !IsModuleInstalled("crm"))
		continue;
	if ($gadget["VOTE_ONLY"] == true && (!IsModuleInstalled("vote") || !CBXFeatures::IsFeatureEnabled("Vote")))
		continue;
	if ($gadget["TASKS_ONLY"] == true && !CBXFeatures::IsFeatureEnabled("Tasks"))
		continue;
	if ($gadget["MESSENGER_ONLY"] == true && !CBXFeatures::IsFeatureEnabled("WebMessenger"))
		continue;
	if ($gadget["ABSENCE_ONLY"] == true && !CBXFeatures::IsFeatureEnabled("StaffAbsence"))
		continue;
예제 #9
0
<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/support/prolog.php");
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/support/include.php");

$bDemo = (CTicket::IsDemo()) ? "Y" : "N";
$bAdmin = (CTicket::IsAdmin()) ? "Y" : "N";
$bSupportClient = (CTicket::IsSupportClient()) ? "Y" : "N";
$bSupportTeam = (CTicket::IsSupportTeam()) ? "Y" : "N";
$message = null;

$entity_id = $PROPERTY_ID = "SUPPORT";

$bADS = $bDemo == 'Y' || $bAdmin == 'Y' || $bSupportTeam == 'Y';

if($bAdmin!="Y" && $bSupportTeam!="Y" && $bDemo!="Y" && $bSupportClient!="Y") $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));

IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/support/include.php");
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/support/admin/ticket_list.php");

$err_mess = "File: ".__FILE__."<br>Line: ";
/***************************************************************************
									Функции
***************************************************************************/

function CheckFilter() // проверка введенных полей
{
	global $strError, $arFilterFields;
	reset($arFilterFields); foreach ($arFilterFields as $f) global $$f;
	$str = "";
	$arMsg = Array();
예제 #10
0
             echo $arStrUsersM["arUsers"][$oUID]["HTML_NAME_S"];
             //echo "[" . $arM["OWNER_USER_ID"] . "] (" . $arM["OWNER_LOGIN"] . ") " . $arM["OWNER_USER_NAME"] . " " . $arrSUPPORT_TEAM[$arM["OWNER_USER_ID"]] . "";
         }
     }
 } else {
     $cUID = isset($arM["CREATED_USER_ID"]) ? intval($arM["CREATED_USER_ID"]) : 0;
     $cGID = isset($arM["CREATED_GUEST_ID"]) ? intval($arM["CREATED_GUEST_ID"]) : 0;
     if ($cUID > 0) {
         //Support_GetUserInfo($arM["CREATED_USER_ID"], $arM["CREATED_LOGIN"], $arM["CREATED_USER_NAME"]);
         if (!in_array($cUID, array_keys($arrSUPPORT_TEAM))) {
             if ($arM["MESSAGE_BY_SUPPORT_TEAM"] == "Y") {
                 $arrSUPPORT_TEAM[$cUID] = "(<span class=\"supportrequired\">" . GetMessage("SUP_TECHSUPPORT") . "</span>)";
             } elseif ($arM["MESSAGE_BY_SUPPORT_TEAM"] == "N") {
                 $arrSUPPORT_TEAM[$cUID] = "";
             } else {
                 $arrSUPPORT_TEAM[$cUID] = CTicket::IsSupportTeam($cUID) || CTicket::IsAdmin($cUID) ? "(<span class=\"supportrequired\">" . GetMessage("SUP_TECHSUPPORT") . ")</span>" : "";
             }
         }
     }
     if (strlen($arM["CREATED_MODULE_NAME"]) <= 0 || $arM["CREATED_MODULE_NAME"] == "support") {
         /*?>[<a title="<?=GetMessage("SUP_USER_PROFILE")?>" href="/bitrix/admin/user_edit.php?lang=<?=LANGUAGE_ID?>&ID=<? echo $arM["CREATED_USER_ID"]; ?>"><? echo $arM["CREATED_USER_ID"]; ?></a>] (<? echo $arM["CREATED_LOGIN"]; ?>) <? echo $arM["CREATED_USER_NAME"]; ?> <? echo $arrSUPPORT_TEAM[$arM["CREATED_USER_ID"]]; ?><?*/
         if ($cUID <= 0 && $cGID > 0 && CModule::IncludeModule("statistic")) {
             echo $arStrUsersM["arGuests"][$cGID]["HTML_NAME"];
             echo $cUID > 0 ? " " . $arrSUPPORT_TEAM[$cUID] : "";
             /*echo " [<a title='".GetMessage("SUP_GUEST_ID")."'  href='/bitrix/admin/guest_list.php?lang=".LANG."&find_id=". $arM["CREATED_GUEST_ID"]."&find_id_exact_match=Y&set_filter=Y'>".$arM["CREATED_GUEST_ID"]."</a>]";*/
         } elseif ($cUID > 0) {
             echo $arStrUsersM["arUsers"][$cUID]["HTML_NAME"];
             echo " " . $arrSUPPORT_TEAM[$cUID];
         }
     } else {
         echo $arM["CREATED_MODULE_NAME"];
예제 #11
0
$url = $APPLICATION->GetCurPage() . "?TICKET_ID=" . $TICKET_ID . "&OWNER_USER_ID=" . intval($OWNER_USER_ID) . "&lang=" . LANGUAGE_ID . "&ONLINE_AUTO_REFRESH=" . intval($ONLINE_AUTO_REFRESH);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_popup_admin.php";
$lamp = CTicket::GetStatus($TICKET_ID);
$ticket = CTicket::GetByID($TICKET_ID);
$arTicket = $ticket->ExtractFields();
?>
<table cellspacing=0 cellpadding=0 class="support-online">
	<?php 
$mode = strlen($mode) > 0 ? $mode : false;
CTicket::UpdateOnline($TICKET_ID, false, $mode);
$rs = CTicket::GetOnline($TICKET_ID);
while ($ar = $rs->GetNext()) {
    $is_support = "";
    if (intval($OWNER_USER_ID) == $ar["USER_ID"]) {
        $is_support = "N";
    } elseif (CTicket::IsSupportTeam($ar["USER_ID"]) || CTicket::IsAdmin($ar["USER_ID"]) || CTicket::IsDemo($ar["USER_ID"])) {
        $is_support = "Y";
    }
    ?>
	<tr>
		<td valign="top" width="16%"><?php 
    if ($is_support == "Y") {
        if ($ar["CURRENT_MODE"] == "edit") {
            ?>
<img src="/bitrix/images/support/sup_write.gif" width="15" height="13" border="0" alt="<?php 
            echo GetMessage("SUP_EDIT_MODE_ALT");
            ?>
"><?php 
        } else {
            ?>
<img src="/bitrix/images/support/sup_view.gif" width="17" height="13" border="0" alt="<?php 
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/prolog.php";
CModule::IncludeModule('support');
IncludeModuleLangFile(__FILE__);
$bDemo = CTicket::IsDemo();
$bAdmin = CTicket::IsAdmin();
if (!$bAdmin && !$bDemo) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
$EDIT_URL = "/bitrix/admin/ticket_group_edit.php";
$LIST_URL = $APPLICATION->GetCurPage();
$sTableID = 't_ugroups_list';
$oSort = new CAdminSorting($sTableID, 'SORT', 'asc');
$lAdmin = new CAdminList($sTableID, $oSort);
$filter = new CAdminFilter($sTableID . '_filter_id', array('ID', GetMessage('SUP_GL_FLT_IS_TEAM_GROUP')));
$arFilterFields = array('FIND_NAME', 'FIND_NAME_EXACT_MATCH', 'FIND_ID', 'FIND_IS_TEAM_GROUP');
$lAdmin->InitFilter($arFilterFields);
$arFilter = array();
foreach ($arFilterFields as $key) {
    if (strpos($key, '_EXACT_MATCH') !== false) {
        continue;
    }
    if (array_key_exists($key . '_EXACT_MATCH', $_REQUEST) && $_REQUEST[$key . '_EXACT_MATCH'] == 'Y') {
        $op = '=';
    } else {
        $op = '%';
    }
    if (array_key_exists($key, $_REQUEST) && strlen($_REQUEST[$key]) > 0) {
        if (in_array($key . '_EXACT_MATCH', $arFilterFields)) {
예제 #13
0
 public static function SupportDeadlineNotify($arrTicket0)
 {
     //SUPPORT_DEADLINE_NOTIFY
     //SUPPORT_DEADLINE			= EXPIRATION_DATE
     //SUPPORT_DEADLINE_STMP		= EXPIRATION_DATE_STMP
     $err_mess = CAllTicketReminder::err_mess() . "<br>Function: SupportDeadlineNotify<br>Line: ";
     $rs = CTicket::GetByID($arrTicket0["ID"], false, "N");
     if (!($arTicket = $rs->Fetch())) {
         return false;
     }
     $rsMessage = CTicket::GetMessageByID(intval($arTicket["ID_1_USER_M_AFTER_SUP_M"]), "N", "N");
     if (!($arMessage = $rsMessage->Fetch())) {
         return false;
     }
     $arMessage["EXPIRATION_DATE"] = $arrTicket0["SUPPORT_DEADLINE"];
     $arMessage["EXPIRATION_DATE_STMP"] = MakeTimeStamp($arMessage["EXPIRATION_DATE"]);
     //$SUPPORT_DEADLINE_STMP = MakeTimeStamp($arrTicket0["SUPPORT_DEADLINE"]);
     $rsSite = CSite::GetByID($arTicket["SITE_ID"]);
     $arSite = $rsSite->Fetch();
     global $MESS, $DB;
     //$oldMess = $MESS;
     IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/classes/general/messages.php", $arSite["LANGUAGE_ID"]);
     $sourceName = strlen($arTicket["SOURCE_NAME"]) <= 0 ? "" : "[" . $arTicket["SOURCE_NAME"] . "] ";
     if (intval($arTicket["OWNER_USER_ID"]) > 0 || strlen(trim($arTicket["OWNER_LOGIN"])) > 0) {
         $ownerText = "[" . $arTicket["OWNER_USER_ID"] . "] (" . $arTicket["OWNER_LOGIN"] . ") " . $arTicket["OWNER_NAME"];
         //if(strlen(trim($OWNER_SID)) > 0 && $OWNER_SID != "null") $ownerText = " / " . $ownerText;
     }
     if (intval($arTicket["RESPONSIBLE_USER_ID"]) > 0) {
         $responsibleText = "[" . $arTicket["RESPONSIBLE_USER_ID"] . "] (" . $arTicket["RESPONSIBLE_LOGIN"] . ") " . $arTicket["RESPONSIBLE_NAME"];
         if (CTicket::IsSupportTeam($arTicket["RESPONSIBLE_USER_ID"]) || CTicket::IsAdmin($arTicket["RESPONSIBLE_USER_ID"])) {
             $responsibleText .= " " . GetMessage("SUP_TECHSUPPORT_HINT");
         }
     }
     $arAdminEMails = CTicket::GetAdminEmails();
     if (count($arAdminEMails) > 0) {
         $support_admin_email = implode(",", $arAdminEMails);
     }
     // prepare email to author
     $arrOwnerEMail = array($arTicket["OWNER_EMAIL"]);
     $arrEmails = explode(",", $arTicket["OWNER_SID"]);
     if (is_array($arrEmails) && count($arrEmails) > 0) {
         foreach ($arrEmails as $email) {
             $email = trim($email);
             if (strlen($email) > 0) {
                 preg_match_all("#[<\\[\\(](.*?)[>\\]\\)]#i" . BX_UTF_PCRE_MODIFIER, $email, $arr);
                 if (is_array($arr[1]) && count($arr[1]) > 0) {
                     foreach ($arr[1] as $email) {
                         $email = trim($email);
                         if (strlen($email) > 0 && !in_array($email, $arrOwnerEMail) && check_email($email)) {
                             $arrOwnerEMail[] = $email;
                         }
                     }
                 } elseif (!in_array($email, $arrOwnerEMail) && check_email($email)) {
                     $arrOwnerEMail[] = $email;
                 }
             }
         }
     }
     TrimArr($arrOwnerEMail);
     $ownerEmail = implode(", ", $arrOwnerEMail);
     // prepare email to support
     $support_email = $arTicket["RESPONSIBLE_EMAIL"];
     if (strlen($support_email) <= 0) {
         $support_email = $support_admin_email;
     }
     if (strlen($support_email) <= 0) {
         $support_email = COption::GetOptionString("main", "email_from", "");
     }
     $arr = explode(",", $support_email);
     $arr = array_unique($arr);
     $support_email = implode(",", $arr);
     if (is_array($arr) && count($arr) > 0) {
         foreach ($arr as $email) {
             unset($arAdminEMails[$email]);
         }
     }
     $support_admin_email = implode(",", $arAdminEMails);
     $createdModuleName = "";
     if ($arTicket["CREATED_MODULE_NAME"] == "support" || !strlen($arTicket["CREATED_MODULE_NAME"])) {
         if (intval($arTicket["CREATED_USER_ID"]) > 0) {
             $createdText = "[" . $arTicket["CREATED_USER_ID"] . "] (" . $arTicket["CREATED_LOGIN"] . ") " . $arTicket["CREATED_NAME"];
             if (CTicket::IsSupportTeam($arTicket["CREATED_USER_ID"]) || CTicket::IsAdmin($arTicket["CREATED_USER_ID"])) {
                 $createdText .= " " . GetMessage("SUP_TECHSUPPORT_HINT");
             }
         }
     } else {
         $createdModuleName = "[" . $arTicket["CREATED_MODULE_NAME"] . "]";
     }
     $MESSAGE = PrepareTxtForEmail($arMessage["MESSAGE"], $arSite["LANGUAGE_ID"], false, false);
     $remainedTime = $arMessage["EXPIRATION_DATE_STMP"] - time();
     if ($remainedTime > 0) {
         $strRemainedTime = "";
         $hours = intval($remainedTime / 3600);
         if ($hours > 0) {
             $strRemainedTime .= $hours . " " . GetMessage("SUP_HOUR") . " ";
             $remainedTime = $remainedTime - $hours * 3600;
         }
         $strRemainedTime .= intval($remainedTime / 60) . " " . GetMessage("SUP_MIN") . " ";
         $strRemainedTime .= $remainedTime % 60 . " " . GetMessage("SUP_SEC");
     }
     $arFields_notify = array("ID" => $arTicket["ID"], "LANGUAGE_ID" => $arSite["LANGUAGE_ID"], "DATE_CREATE" => $arTicket["DATE_CREATE"], "TITLE" => $arTicket["TITLE"], "STATUS" => $arTicket["STATUS_NAME"], "CATEGORY" => $arTicket["CATEGORY_NAME"], "CRITICALITY" => $arTicket["CRITICALITY_NAME"], "DIFFICULTY" => $arTicket["DIFFICULTY_NAME"], "RATE" => $arTicket["MARK_NAME"], "SLA" => $arTicket["SLA_NAME"], "SOURCE" => $sourceName, "ADMIN_EDIT_URL" => "/bitrix/admin/ticket_edit.php", "EXPIRATION_DATE" => $arMessage["EXPIRATION_DATE"], "REMAINED_TIME" => $strRemainedTime, "OWNER_EMAIL" => TrimEx($ownerEmail, ","), "OWNER_USER_ID" => $arTicket["OWNER_USER_ID"], "OWNER_USER_NAME" => $arTicket["OWNER_NAME"], "OWNER_USER_LOGIN" => $arTicket["OWNER_LOGIN"], "OWNER_USER_EMAIL" => $arTicket["OWNER_EMAIL"], "OWNER_TEXT" => $ownerText, "OWNER_SID" => $arTicket["OWNER_SID"], "SUPPORT_EMAIL" => TrimEx($support_email, ","), "RESPONSIBLE_USER_ID" => $arTicket["RESPONSIBLE_USER_ID"], "RESPONSIBLE_USER_NAME" => $arTicket["RESPONSIBLE_NAME"], "RESPONSIBLE_USER_LOGIN" => $arTicket["RESPONSIBLE_LOGIN"], "RESPONSIBLE_USER_EMAIL" => $arTicket["RESPONSIBLE_EMAIL"], "RESPONSIBLE_TEXT" => $responsibleText, "SUPPORT_ADMIN_EMAIL" => TrimEx($support_admin_email, ","), "CREATED_USER_ID" => $arTicket["CREATED_USER_ID"], "CREATED_USER_LOGIN" => $arTicket["CREATED_LOGIN"], "CREATED_USER_EMAIL" => $arTicket["CREATED_EMAIL"], "CREATED_USER_NAME" => $arTicket["CREATED_NAME"], "CREATED_MODULE_NAME" => $createdModuleName, "CREATED_TEXT" => $createdText, "MESSAGE_BODY" => $MESSAGE);
     //$MESS = $oldMess;
     $arFields = array("NOTIFY_AGENT_ID" => "null", "IS_NOTIFIED" => "'Y'");
     // execute event
     $rs = GetModuleEvents('support', 'OnBeforeTicketNotify');
     while ($arr = $rs->Fetch()) {
         $arFields = ExecuteModuleEventEx($arr, array($arTicket["ID"], $arFields));
         if (!$arFields) {
             return false;
         }
     }
     // check value again and send notification
     if (isset($arFields['IS_NOTIFIED']) && $arFields['IS_NOTIFIED'] === "'Y'") {
         CEvent::Send("TICKET_OVERDUE_REMINDER", $arTicket["SITE_ID"], $arFields_notify);
     }
     // event for notification
     $DB->Update("b_ticket", $arFields, "WHERE ID='" . $arTicket["ID"] . "'", $err_mess . __LINE__);
     $arFields = array("NOTIFY_AGENT_DONE" => "'Y'");
     $DB->Update("b_ticket_message", $arFields, "WHERE ID='" . $arMessage["ID"] . "'", $err_mess . __LINE__);
 }
예제 #14
0
 function CheckFields(&$arFields, $groupID = 0, $userID = 0)
 {
     global $APPLICATION, $DB, $USER;
     $groupID = intval($groupID);
     $userID = intval($userID);
     if (!is_array($arFields)) {
         $arFields = array();
     }
     //if update
     if ($userID > 0 || $groupID > 0) {
         if ($userID <= 0) {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_USER_ID_EMPTY'));
             return false;
         }
         if ($groupID <= 0) {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_GROUP_ID_EMPTY'));
             return false;
         }
         if (array_key_exists('GROUP_ID', $arFields)) {
             unset($arFields['GROUP_ID']);
         }
         if (array_key_exists('USER_ID', $arFields)) {
             unset($arFields['USER_ID']);
         }
     }
     //if add
     if ($userID <= 0 && $groupID <= 0) {
         $arFields['GROUP_ID'] = array_key_exists('GROUP_ID', $arFields) ? intval($arFields['GROUP_ID']) : 0;
         $arFields['USER_ID'] = array_key_exists('USER_ID', $arFields) ? intval($arFields['USER_ID']) : 0;
         if ($arFields['USER_ID'] <= 0) {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_USER_ID_EMPTY'));
             return false;
         }
         if ($arFields['GROUP_ID'] <= 0) {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_GROUP_ID_EMPTY'));
             return false;
         }
         $rs = $USER->GetByID($arFields['USER_ID']);
         if (!$rs->Fetch()) {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_NO_USER'));
             return false;
         }
         $rs = CSupportUserGroup::GetList(false, array('ID' => $arFields['GROUP_ID']));
         if (!($arGroup = $rs->Fetch())) {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_NO_GROUP'));
             return false;
         }
         if (CTicket::IsAdmin($arFields['USER_ID']) || CTicket::IsSupportTeam($arFields['USER_ID'])) {
             if ($arGroup['IS_TEAM_GROUP'] != 'Y') {
                 $APPLICATION->ThrowException(GetMessage('SUP_ERROR_USER_NO_CLIENT'));
                 return false;
             }
         } elseif (CTicket::IsSupportClient($arFields['USER_ID'])) {
             if ($arGroup['IS_TEAM_GROUP'] == 'Y') {
                 $APPLICATION->ThrowException(GetMessage('SUP_ERROR_USER_NO_TEAM'));
                 return false;
             }
         } else {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_NO_SUPPORT_USER'));
             return false;
         }
         $rs = CSupportUser2UserGroup::GetList(false, array('GROUP_ID' => $arFields['GROUP_ID'], 'USER_ID' => $arFields['USER_ID']));
         if ($rs->Fetch()) {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_USERGROUP_EXISTS'));
             return false;
         }
     }
     if (array_key_exists('CAN_VIEW_GROUP_MESSAGES', $arFields)) {
         $arFields['CAN_VIEW_GROUP_MESSAGES'] = $arFields['CAN_VIEW_GROUP_MESSAGES'] == 'Y' ? 'Y' : 'N';
     } elseif ($userID <= 0 && $groupID <= 0) {
         $arFields['CAN_VIEW_GROUP_MESSAGES'] = 'N';
     }
     if (array_key_exists('CAN_MAIL_GROUP_MESSAGES', $arFields)) {
         $arFields['CAN_MAIL_GROUP_MESSAGES'] = $arFields['CAN_MAIL_GROUP_MESSAGES'] == 'Y' ? 'Y' : 'N';
     } elseif ($userID <= 0 && $groupID <= 0) {
         $arFields['CAN_MAIL_GROUP_MESSAGES'] = 'N';
     }
     return true;
 }