22 $strSql =
"SELECT max(C_SORT) MAX_SORT FROM b_ticket_dictionary WHERE C_TYPE='".$DB->ForSql($typeID,5).
"'";
23 $z =
$DB->Query($strSql);
25 return intval(
$zr[
"MAX_SORT"])+100;
38 $oldFunctionality = COption::GetOptionString(
"support",
"SUPPORT_OLD_FUNCTIONALITY",
"Y" );
39 if( intval($sla_id) <= 0 || $oldFunctionality !=
"Y" || (
$type !=
"C" &&
$type!=
"K" &&
$type!=
"M" ) )
return $rs;
43 case "C": $strSql =
"SELECT CATEGORY_ID as DID FROM b_ticket_sla_2_category WHERE SLA_ID=" . intval($sla_id);
break;
44 case "K": $strSql =
"SELECT CRITICALITY_ID as DID FROM b_ticket_sla_2_criticality WHERE SLA_ID=" . intval($sla_id);
break;
45 case "M": $strSql =
"SELECT MARK_ID as DID FROM b_ticket_sla_2_mark WHERE SLA_ID=" . intval($sla_id);
break;
47 $r =
$DB->Query($strSql);
48 while(
$a = $r->Fetch() ) $arDID[] =
$a[
"DID"];
50 while(
$ar =
$rs->Fetch() )
if( is_array( $arDID ) && ( in_array(
$ar[
"ID"], $arDID ) || in_array( 0,$arDID ) ) ) $arRecords[] =
$ar;
53 $rs->InitFromArray($arRecords);
72 if (in_array(
$ar[
"C_TYPE"], $arUnsetType))
75 $arReturn[
$ar[
"C_TYPE"]][
$ar[
"ID"]] =
$ar;
78 $oldFunctionality = COption::GetOptionString(
"support",
"SUPPORT_OLD_FUNCTIONALITY",
"Y" );
79 if( intval($SLA_ID) > 0 && $oldFunctionality ==
"Y" )
81 $SLA_ID = intval($SLA_ID);
83 $strSql =
"SELECT 'M' as C_TYPE, SLA_ID, MARK_ID as DIC_ID FROM b_ticket_sla_2_mark WHERE SLA_ID = ".$SLA_ID.
"
85 SELECT 'K' as C_TYPE, SLA_ID, CRITICALITY_ID as DIC_ID FROM b_ticket_sla_2_criticality WHERE SLA_ID = ".$SLA_ID.
"
87 SELECT 'C' as C_TYPE, SLA_ID, CATEGORY_ID as DIC_ID FROM b_ticket_sla_2_category WHERE SLA_ID = ".$SLA_ID;
89 $r =
$DB->Query($strSql);
92 while (
$ar = $r->Fetch())
94 if (
$ar[
"DIC_ID"] == 0)
97 $arUnset[
$ar[
"C_TYPE"]][] =
$ar[
"DIC_ID"];
100 if (!empty($arUnset) && !empty($arReturn))
102 foreach ($arReturn as
$type => $arID)
104 if (!array_key_exists(
$type, $arUnset))
107 $arID = array_keys($arID);
108 $arID = array_diff($arID, $arUnset[
$type]);
109 foreach ($arID as
$val)
122 $DICTIONARY_ID = intval($DICTIONARY_ID);
123 if ($DICTIONARY_ID<=0)
return false;
129 b_ticket_dictionary_2_site DS
131 DS.DICTIONARY_ID = $DICTIONARY_ID
134 $rs =
$DB->Query($strSql);
135 while (
$ar =
$rs->Fetch()) $arrRes[] =
$ar[
"SITE_ID"];
141 static $GetSiteArrayForAllDictCache;
142 if(is_array($GetSiteArrayForAllDictCache))
144 return $GetSiteArrayForAllDictCache;
148 $GetSiteArrayForAllDictCache =
array();
154 b_ticket_dictionary_2_site DS
156 $rs =
$DB->Query($strSql);
157 while (
$ar =
$rs->Fetch())
159 $GetSiteArrayForAllDictCache[
$ar[
"DICTIONARY_ID"]][] =
$ar[
"SITE_ID"];
161 return $GetSiteArrayForAllDictCache;
176 "reference_id"=>
array(
191 $KEY = array_search($id,
$arr[
"reference_id"]);
192 return $arr[
"reference"][$KEY];
213 public static function Delete($id, $CHECK_RIGHTS=
"Y")
222 if ($CHECK_RIGHTS==
"Y")
232 $DB->Query(
"DELETE FROM b_ticket_dictionary WHERE ID='$id'");
233 $DB->Query(
'DELETE FROM b_ticket_dictionary_2_site WHERE DICTIONARY_ID=' . $id);
241 if ( $id ===
false && !(array_key_exists(
'NAME',
$arFields) &&
$arFields[
'NAME'] <>
'') )
243 $arMsg[] =
array(
"id"=>
"NAME",
"text"=>
GetMessage(
"SUP_FORGOT_NAME"));
255 if ( array_key_exists(
'SID',
$arFields) && preg_match(
"#[^A-Za-z_0-9]#",
$arFields[
'SID']) )
257 $arMsg[] =
array(
"id"=>
"SID",
"text"=>
GetMessage(
"SUP_INCORRECT_SID"));
275 if (
$zr =
$z->Fetch())
280 'SUP_SID_ALREADY_IN_USE',
283 '#LANG#' =>
$zr[
'LID'] <>
''?
$zr[
'LID']:
$zr[
'SITE_ID'],
284 '#RECORD_ID#' =>
$zr[
'ID'],
291 if (
count($arMsg) > 0)
294 $GLOBALS[
'APPLICATION']->ThrowException($e);
304 $DB->StartTransaction();
313 $id = intval(
$DB->Add(
'b_ticket_dictionary',
$arFields));
329 $DB->StartTransaction();
339 $strUpdate =
$DB->PrepareUpdate(
'b_ticket_dictionary',
$arFields);
340 $rs =
$DB->Query(
'UPDATE b_ticket_dictionary SET ' . $strUpdate .
' WHERE ID=' . $id);
341 if (
$rs->AffectedRowsCount() > 0)
356 array_key_exists(
'SET_AS_DEFAULT',
$arFields) &&
$arFields[
'SET_AS_DEFAULT'] ==
'Y' &&
366 while (
$zr =
$z->Fetch())
368 $DB->Update(
'b_ticket_dictionary',
array(
'SET_AS_DEFAULT' =>
"'N'"),
'WHERE ID=' .
$zr[
'ID'],
'',
false,
false,
false);
380 if (!array_key_exists(
'arrSITE',
$arFields))
385 $DB->Query(
'DELETE FROM b_ticket_dictionary_2_site WHERE DICTIONARY_ID=' . $id);
390 $strSql =
"INSERT INTO b_ticket_dictionary_2_site (DICTIONARY_ID, SITE_ID) VALUES ($id, '".$DB->ForSql($sid, 2).
"')";
static __SetSites($id, $arFields)
static CheckFields($arFields, $id=false)
static Delete($id, $CHECK_RIGHTS="Y")
static GetSiteArrayForAllDictionaries()
static GetDropDown($type="C", $siteID=false, $sla_id=false)
static GetDropDownArray($siteID=false, $SLA_ID=false, $arUnsetType=Array("F"))
static GetTypeNameByID($id)
static GetDefault($type, $siteID=SITE_ID)
static GetBySID($sid, $type, $siteID=SITE_ID)
static GetNextSort($typeID)
static Update($id, $arFields)
static __CleanDefault(&$arFields)
static GetSiteArray($DICTIONARY_ID)
static IsAdmin($userID=false)
static GetList($by='s_c_sort', $order='asc', $arFilter=[])
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
while($group=$gr->Fetch()) $bAdmin
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
$GLOBALS['_____370096793']