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"];
	}
}
function Tab1($adminForm)
{
    $adminForm->BeginCustomField("NAME", GetMessage("SUP_NAME"), false);
    ?>
	<tr class="adm-detail-required-field"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%"><input type="text" maxlength="255" name="NAME" size="50" value="<?php 
    echo CSupportPage::$holidaysFields->getFieldForOutput("NAME", CSupportTableFields::ATTRIBUTE);
    ?>
"></td>
	</tr>
	<?php 
    $adminForm->EndCustomField("NAME");
    $adminForm->BeginCustomField("OPEN_TIME", GetMessage("SUP_OPEN_TIME"), false);
    ?>
	<tr class="adm-detail-required-field"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%">
			<select id="OPEN_TIME" size="1" name="OPEN_TIME">
			<?php 
    $arr = CSupportHolidays::GetOpenTimeArray();
    foreach ($arr as $v => $n) {
        $ss = substr($v, 0, 3);
        if ($ss == "GB_") {
            echo '<optgroup label="' . GetMessage($n) . '">';
        } elseif ($ss == "GE_") {
            echo '</optgroup>';
        } else {
            echo '<option ' . ($v == CSupportPage::$holidaysFields->OPEN_TIME ? 'selected ' : '') . 'value="' . $v . '">' . GetMessage($n) . '</option>';
        }
    }
    ?>
			</select>
		</td>
	</tr>
	<?php 
    $adminForm->EndCustomField("OPEN_TIME");
    $adminForm->BeginCustomField("DATE_FROM", GetMessage("SUP_DATE_FROM"), false);
    ?>
	<tr class="adm-detail-required-field"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%"><?php 
    echo CalendarDate("DATE_FROM", GetTime(CSupportPage::$holidaysFields->DATE_FROM, "FULL"), "supTabControl", "20");
    ?>
</td>
	</tr>
	<?php 
    $adminForm->EndCustomField("DATE_FROM");
    $adminForm->BeginCustomField("DATE_TILL", GetMessage("SUP_DATE_TILL"), false);
    ?>
	<tr class="adm-detail-required-field"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%"><?php 
    echo CalendarDate("DATE_TILL", GetTime(CSupportPage::$holidaysFields->DATE_TILL, "FULL"), "supTabControl", "20");
    ?>
</td>
	</tr>
	<?php 
    $adminForm->EndCustomField("DATE_TILL");
    $adminForm->BeginCustomField("SLA_ID", GetMessage("SUP_SLA_ID"), false);
    ?>
	<tr valign="top"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%">
			<?php 
    $arrSLA_ID = CSupportPage::$holidaysSlaFields->getColumn("SLA_ID");
    $arSort = array();
    $ar = CTicketSLA::GetList($arSort, array(), $is_filtered);
    $idR = 0;
    while ($arR = $ar->Fetch()) {
        $idR++;
        echo InputType("checkbox", "SLA_ID[]", $arR["ID"], $arrSLA_ID, false, "", "", $idR) . '<label for="' . $idR . '"> ' . htmlspecialcharsbx($arR["NAME"]) . "</label><br>";
    }
    ?>
		</td>
	</tr>
		
	<?php 
    $adminForm->EndCustomField("SLA_ID");
    $adminForm->BeginCustomField("DESCRIPTION", GetMessage("SUP_DESCRIPTION"), false);
    ?>
	<tr class="heading">
		<td colspan="2"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
	</tr>
	<tr>
		<td colspan="2" align="center"><textarea style="width:60%; height:150px;" name="DESCRIPTION" wrap="VIRTUAL"><?php 
    echo CSupportPage::$holidaysFields->getFieldForOutput("DESCRIPTION", CSupportTableFields::ATTRIBUTE);
    ?>
</textarea></td>
	</tr>
	<?php 
    $adminForm->EndCustomField("DESCRIPTION");
}
Exemplo n.º 3
0
<?php

if (!CModule::IncludeModule('support')) {
    return;
}
$rsSites = CSite::GetList($v1, $v2, array('ACTIVE' => 'Y'));
while ($arSite = $rsSites->Fetch()) {
    IncludeModuleLangFile(__FILE__, $arSite['LANGUAGE_ID']);
    $SLA_ID = CTicketSLA::Set(array('NAME' => GetMessage('SUP_DEF_SLA_NAME'), 'PRIORITY' => 0, 'RESPONSE_TIME_UNIT' => 'hour', 'NOTICE_TIME_UNIT' => 'hour', 'CREATED_GUEST_ID' => 0, 'MODIFIED_GUEST_ID' => 0, 'arGROUPS' => array(2), 'arSITES' => array($arSite['ID']), 'arCATEGORIES' => array(0), 'arCRITICALITIES' => array(0), 'arMARKS' => array(0), 'arSHEDULE' => array(0 => array('OPEN_TIME' => '24H'), 1 => array('OPEN_TIME' => '24H'), 2 => array('OPEN_TIME' => '24H'), 3 => array('OPEN_TIME' => '24H'), 4 => array('OPEN_TIME' => '24H'), 5 => array('OPEN_TIME' => '24H'), 6 => array('OPEN_TIME' => '24H'))), 0, false);
    if (!$SLA_ID) {
        $DD_ERROR = true;
        return;
    }
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_BUGS'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'C', 'C_SORT' => 100, 'EVENT1' => 'ticket', 'EVENT2' => 'bugs'));
    if (!$e) {
        $DD_ERROR = true;
        return;
    }
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_ORDER_PAYMENT'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'C', 'C_SORT' => 200, 'EVENT1' => 'ticket', 'EVENT2' => 'pay'));
    if (!$e) {
        $DD_ERROR = true;
        return;
    }
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_ORDER_SHIPPING'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'C', 'C_SORT' => 300, 'EVENT1' => 'ticket', 'EVENT2' => 'delivery'));
    if (!$e) {
        $DD_ERROR = true;
        return;
    }
    $e = CTicketDictionary::Add(array('NAME' => GetMessage('SUP_DEF_LOW'), 'arrSITE' => array($arSite['ID']), 'C_TYPE' => 'K', 'C_SORT' => 100));
    if (!$e) {
        $DD_ERROR = true;
Exemplo n.º 4
0
 function Set_getCOUPONandSLA($v, $f, $arFields)
 {
     global $APPLICATION;
     $slaID = 0;
     if (isset($arFields['SLA_ID']) && intval($arFields['SLA_ID']) > 0) {
         $slaID = $arFields['SLA_ID'];
     }
     // получение купона
     if (array_key_exists('COUPON', $arFields) && strlen($arFields['COUPON']) > 0) {
         $v->bActiveCoupon = CSupportSuperCoupon::UseCoupon($arFields['COUPON']);
         if ($v->bActiveCoupon) {
             $v->V_COUPON = $arFields['COUPON'];
             $rsCoupon = CSupportSuperCoupon::GetList(false, array('COUPON' => $arFields['COUPON']));
             //if($arCoupon = $rsCoupon->Fetch() && intval($arCoupon['SLA_ID']) > 0) $arFields['SLA_ID'] = intval($arCoupon['SLA_ID']);
             if ($arCoupon = $rsCoupon->Fetch()) {
                 if (intval($arCoupon['SLA_ID']) > 0) {
                     $slaID = intval($arCoupon['SLA_ID']);
                 }
             }
         } else {
             $APPLICATION->ThrowException(GetMessage('SUP_ERROR_INVALID_COUPON'));
             return false;
         }
     }
     // получаем SLA
     if ($slaID > 0) {
         //$f->FromArray($arFields, "SLA_ID", array(CSupportTableFields::MORE0));
         $f->SLA_ID = $slaID;
     } else {
         $f->SLA_ID = CTicketSLA::GetSLA($f->SITE_ID, $f->OWNER_USER_ID, $f->CATEGORY_ID, $v->bActiveCoupon ? $v->V_COUPON : "");
     }
     //elseif(intval($arFields["SLA_ID"]) <= 0) $f->SLA_ID = CTicketSLA::GetForUser($f->SITE_ID, $f->OWNER_USER_ID);
     return true;
 }
Exemplo n.º 5
0
            $arFiles["FILES"] = array();
        }
        $arMessage["MESSAGE"] = TxtToHTML($arMessage["~MESSAGE"], $bMakeUrls = true, $iMaxStringLen = $arParams["MESSAGE_MAX_LENGTH"], $QUOTE_ENABLED = "Y", $NOT_CONVERT_AMPERSAND = "N", $CODE_ENABLED = "Y", $BIU_ENABLED = "Y", $quote_table_class = "support-quote-table", $quote_head_class = "support-quote-head", $quote_body_class = "support-quote-body", $code_table_class = "support-code-table", $code_head_class = "support-code-head", $code_body_class = "support-code-body", $code_textarea_class = "support-code-textarea", $link_class = "");
        $arResult["MESSAGES"][] = $arMessage + $arFiles + _GetUserInfo($arMessage["OWNER_USER_ID"], "OWNER") + _GetUserInfo($arMessage["CREATED_USER_ID"], "CREATED") + _GetUserInfo($arMessage["MODIFIED_USER_ID"], "MODIFIED_BY");
    }
    //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") {
Exemplo n.º 6
0
 public static function GetDropDown($siteID = "")
 {
     if (strlen($siteID) > 0 && strtoupper($siteID) != "ALL") {
         $arFilter = array("SITE" => $siteID);
     }
     $arSort = array("FIRST_SITE_ID" => "ASC", "PRIORITY" => "ASC");
     $is_filtered = null;
     $rs = CTicketSLA::GetList($arSort, $arFilter, $is_filtered);
     return $rs;
 }
Exemplo n.º 7
0
         case "hour":
             $str .= __PrintRussian($f_RESPONSE_TIME, array(GetMessage("SUP_HOUR_1"), GetMessage("SUP_HOUR_3"), GetMessage("SUP_HOUR_5")));
             break;
         case "minute":
             $str .= __PrintRussian($f_RESPONSE_TIME, array(GetMessage("SUP_MINUTE_1"), GetMessage("SUP_MINUTE_3"), GetMessage("SUP_MINUTE_5")));
             break;
         case "day":
             $str .= __PrintRussian($f_RESPONSE_TIME, array(GetMessage("SUP_DAY_1"), GetMessage("SUP_DAY_3"), GetMessage("SUP_DAY_5")));
             break;
     }
 } else {
     $str .= "<nobr>" . GetMessage("SUP_NO_LIMITS") . "</nobr>";
 }
 $row->AddViewField("RESPONSE_TIME", $str);
 $str = "";
 $arG = CTicketSLA::GetGroupArray($f_ID);
 foreach ($arG as $gid) {
     if (!is_array($arGROUPS) || !in_array($gid, array_keys($arGROUPS))) {
         $rs = CGroup::GetByID($gid);
         if ($ar = $rs->Fetch()) {
             $arGROUPS[$gid] = $ar["NAME"];
         }
     }
     $str .= '[<a title="' . GetMessage("MAIN_ADMIN_MENU_EDIT") . '" href="/bitrix/admin/group_edit.php?ID=' . $gid . '&lang=' . LANG . '">' . $gid . '</a>] ' . htmlspecialcharsbx($arGROUPS[$gid]) . '<br>';
 }
 $row->AddViewField("GROUP_ID", $str);
 $str = "&nbsp;";
 if (intval($f_RESPONSIBLE_USER_ID) > 0) {
     Support_GetUserInfo($f_RESPONSIBLE_USER_ID, $f_RESPONSIBLE_LOGIN, $f_RESPONSIBLE_NAME);
     $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;
 }
Exemplo n.º 8
0
    }
}
?>
		</select>
		</td>
	</tr>
	
	<tr>
		<td><?php 
echo GetMessage("SUP_FILTER_SLA");
?>
:</td>
		<td>
		<?php 
$arSort = array();
$ar = CTicketSLA::GetList($arSort, array(), $is_filtered);
$slaI = 0;
while ($arR = $ar->Fetch()) {
    $slaI++;
    $slaC = in_array($arR["ID"], $filter_sla_id) ? 'checked=""' : '';
    echo '<input id="filter_sla_id' . $slaI . '" name="filter_sla_id[]" type="checkbox" value="' . $arR["ID"] . '" ' . $slaC . '>';
    echo '<label class="adm-designed-checkbox-label" for="filter_sla_id' . $slaI . '" title="">' . htmlspecialcharsbx($arR["NAME"]) . '</label><br>';
}
?>
		</td>
	</tr>
	
<?php 
$USER_FIELD_MANAGER->AdminListShowFilter("SUPPORT");
$oFilter->Buttons(array("table_id" => $sTableID, "url" => $APPLICATION->GetCurPage(), "form" => "find_form"));
$oFilter->End();
Exemplo n.º 9
0
function Support_GetSLAInfo($ID, &$name, &$description, $safe_for_html=true)
{
	static $arrSLA;
	$name = "";
	$description = "";
	if (intval($ID)>0)
	{
		if (is_array($arrSLA) && in_array($ID, array_keys($arrSLA)))
		{
			$name = $arrSLA[$ID]["NAME"];
			$description = $arrSLA[$ID]["DESCRIPTION"];
		}
		else
		{
			$rs = CTicketSLA::GetByID($ID);
			$ar = $rs->Fetch();
			$name = $ar["NAME"];
			$description = $ar["DESCRIPTION"];
			$arrSLA[$ar["ID"]] = array("NAME" => $ar["NAME"], "DESCRIPTION" => $ar["DESCRIPTION"]);
		}
		if ($safe_for_html)
		{
			$name = htmlspecialcharsbx($name);
			$description = htmlspecialcharsbx($description);
		}
	}
}
Exemplo n.º 10
0
</tr>



<tr> 
	<td nowrap>
		<?php 
echo GetMessage("SUP_F_SLA");
?>
:</td>
	<td><?php 
$ref = array();
$ref_id = array();
$ref[] = GetMessage("SUP_NO");
$ref_id[] = "0";
$z = CTicketSLA::GetDropDown();
while ($zr = $z->Fetch()) {
    $ref[] = $zr["REFERENCE"];
    $ref_id[] = $zr["REFERENCE_ID"];
}
$arr = array("REFERENCE" => $ref, "REFERENCE_ID" => $ref_id);
echo SelectBoxFromArray("find_sla_id", $arr, $find_sla_id, GetMessage("SUP_ALL"));
?>
</td>
</tr>
<tr> 
	<td nowrap>
		<?php 
echo GetMessage("SUP_F_CATEGORY");
?>
:</td>
Exemplo n.º 11
0
 function GetList(&$arSort, $arFilter = array(), &$isFiltered)
 {
     $err_mess = CTicketSLA::err_mess() . "<br>Function: GetList<br>Line: ";
     global $DB, $USER, $APPLICATION;
     $isFiltered = false;
     // filter params correct
     if (CTicket::CheckFilter($arFilter)) {
         $arSqlSearch = array();
         if (is_array($arFilter) && count($arFilter) > 0) {
             $filterKeys = array_keys($arFilter);
             $filterKeysCount = count($filterKeys);
             for ($i = 0; $i < $filterKeysCount; $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);
                 if (is_array($val)) {
                     $val = implode(" | ", $val);
                 }
                 switch ($key) {
                     case "ID":
                     case "SLA_ID":
                         $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $matchValueSet ? "Y" : "N";
                         $arSqlSearch[] = GetFilterQuery("S." . $key, $val, $match);
                         break;
                     case "NAME":
                     case "DESCRIPTION":
                     case "DEADLINE_SOURCE":
                         $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $matchValueSet ? "N" : "Y";
                         $arSqlSearch[] = GetFilterQuery("S." . $key, $val, $match);
                         break;
                     case "SITE":
                         $val .= " | ALL";
                         $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $matchValueSet ? "Y" : "N";
                         $arSqlSearch[] = GetFilterQuery("SS.SITE_ID", $val, $match);
                         $left_join_site = "LEFT JOIN b_ticket_sla_2_site SS ON (S.ID = SS.SLA_ID)";
                         break;
                 }
             }
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $arSort = is_array($arSort) ? $arSort : array();
     if (count($arSort) > 0) {
         $ar1 = array_merge($DB->GetTableFieldsList("b_ticket_sla"), array());
         $ar2 = array_keys($arSort);
         $arDiff = array_diff($ar2, $ar1);
         if (is_array($arDiff) && count($arDiff) > 0) {
             foreach ($arDiff as $value) {
                 unset($arSort[$value]);
             }
         }
     }
     if (count($arSort) <= 0) {
         $arSort = array("PRIORITY" => "DESC");
     }
     while (list($by, $order) = each($arSort)) {
         if (strtoupper($order) != "DESC") {
             $order = "ASC";
         }
         if ($by == "RESPONSE_TIME") {
             $arSqlOrder[] = "case RESPONSE_TIME_UNIT when 'day' then 3 when 'hour' then 2 when 'minute' then 1 end {$order}";
             $arSqlOrder[] = $by . " " . $order;
         } else {
             $arSqlOrder[] = $by . " " . $order;
         }
     }
     if (is_array($arSqlOrder) && count($arSqlOrder) > 0) {
         $strSqlOrder = " ORDER BY " . implode(",", $arSqlOrder);
     }
     $strSql = "\n\t\t\tSELECT DISTINCT\n\t\t\t\tS.*,\n\t\t\t\tcase S.RESPONSE_TIME_UNIT\n\t\t\t\t\twhen 'day' then S.RESPONSE_TIME*1440\n\t\t\t\t\twhen 'hour' then S.RESPONSE_TIME*60\n\t\t\t\t\twhen 'minute' then S.RESPONSE_TIME\n\t\t\t\t\tend\t\t\t\t\t\t\t\t\t\t\tM_RESPONSE_TIME,\n\t\t\t\tcase S.NOTICE_TIME_UNIT\n\t\t\t\t\twhen 'day' then S.NOTICE_TIME*1440\n\t\t\t\t\twhen 'hour' then S.NOTICE_TIME*60\n\t\t\t\t\twhen 'minute' then S.NOTICE_TIME\n\t\t\t\t\tend\t\t\t\t\t\t\t\t\t\t\tM_NOTICE_TIME,\n\t\t\t\tS.ID\t\t\t\t\t\t\t\t\t\t\tREFERENCE_ID,\n\t\t\t\tS.NAME\t\t\t\t\t\t\t\t\t\t\tREFERENCE,\n\t\t\t\t" . $DB->DateToCharFunction("S.DATE_MODIFY") . "\tDATE_MODIFY_F,\n\t\t\t\t" . $DB->DateToCharFunction("S.DATE_CREATE") . "\tDATE_CREATE_F\n\t\t\tFROM\n\t\t\t\tb_ticket_sla S\n\t\t\t{$left_join_site}\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\t{$strSqlOrder}\n\t\t\t";
     $rs = $DB->Query($strSql, false, $err_mess . __LINE__);
     $isFiltered = IsFiltered($strSqlSearch);
     return $rs;
 }
Exemplo n.º 12
0
    $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);
    $arCRITICALITIES = CTicketSLA::GetCriticalityArray($ID);
    $arMARKS = CTicketSLA::GetMarkArray($ID);
}
if ($message) {
    $DB->InitTableVarsForEdit($TABLE_NAME, "", "str_");
}
$APPLICATION->SetTitle($ID > 0 ? GetMessage("SUP_PAGE_TITLE_EDIT_RECORD", array("#ID#" => $ID)) : GetMessage("SUP_PAGE_TITLE_NEW_RECORD"));
/***************************************************************************
								HTML форма
****************************************************************************/
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$aMenu = array(array("ICON" => "btn_list", "TEXT" => GetMessage("SUP_RECORD_LIST"), "LINK" => $LIST_URL . "?lang=" . LANGUAGE_ID));
if (intval($ID) > 0) {
    $aMenu[] = array("SEPARATOR" => "Y");
    $aMenu[] = array("ICON" => "btn_new", "TEXT" => GetMessage("SUP_NEW_RECORD"), "LINK" => $EDIT_URL . "?lang=" . LANGUAGE_ID);
    if ($ID > 1 && $bAdmin == "Y") {
        $aMenu[] = array("ICON" => "btn_delete", "TEXT" => GetMessage("SUP_DELETE_RECORD"), "LINK" => "javascript:if(confirm('" . GetMessage("SUP_DELETE_RECORD_CONFIRM") . "'))window.location='" . $LIST_URL . "?action=delete&ID=" . $ID . "&lang=" . LANGUAGE_ID . "&" . bitrix_sessid_get() . "';");
Exemplo n.º 13
0
 public static function RecalculateSupportDeadlineForOneTicket($arTicket, $arFields = array(), $dateType = array("EVENT" => array(CTicket::IGNORE)))
 {
     global $DB;
     $err_mess = CAllTicketReminder::err_mess() . "<br>Function: RecalculateSupportDeadlineForOneTicket<br>Line: ";
     $currDateTS = time() + CTimeZone::GetOffset();
     $ts2010 = mktime(0, 0, 0, 1, 1, 2010);
     $supportDeadlineNotify = 0;
     $ticketID = intval($arTicket["ID"]);
     $slaID = intval($arTicket["SLA_ID"]);
     $periodMin = self::ConvertResponseTimeUnit($arTicket["RESPONSE_TIME"], $arTicket["RESPONSE_TIME_UNIT"]);
     $periodNMin = 0;
     if ($ticketID <= 0 || $slaID <= 0 || $periodMin <= 0 || intval($arTicket["D_1_USER_M_AFTER_SUP_M"]) <= 0) {
         if ($ticketID > 0 && count($arFields) > 0) {
             $DB->Update("b_ticket", $arFields, "WHERE ID='" . $ticketID . "'", $err_mess . __LINE__);
         }
         return;
     }
     $periodNMinMinus = self::ConvertResponseTimeUnit($arTicket["NOTICE_TIME"], $arTicket["NOTICE_TIME_UNIT"]);
     if ($periodNMinMinus > 0 && $periodNMinMinus < $periodMin) {
         $periodNMin = $periodMin - $periodNMinMinus;
     }
     $newDate1UserMessAfterSupMessTS = MakeTimeStamp($arTicket["D_1_USER_M_AFTER_SUP_M"]);
     $deadlineSourceDate = MakeTimeStamp($arTicket["DEADLINE_SOURCE_DATE"]);
     if ($deadlineSourceDate <= $ts2010) {
         if ($newDate1UserMessAfterSupMessTS <= $ts2010) {
             $deadlineSourceDate = $currDateTS;
         } else {
             $deadlineSourceDate = $newDate1UserMessAfterSupMessTS;
         }
         $arFields["DEADLINE_SOURCE_DATE"] = $DB->CharToDateFunction(GetTime($deadlineSourceDate, "FULL"));
     }
     $oldPeriodMin = null;
     if (isset($dateType["EVENT"]) && in_array(CTicket::UPDATE, $dateType["EVENT"])) {
         if (isset($dateType["OLD_SLA_RESPONSE_TIME"]) && isset($dateType["OLD_SLA_RESPONSE_TIME_UNIT"])) {
             $oldPeriodMin = self::ConvertResponseTimeUnit($dateType["OLD_SLA_RESPONSE_TIME"], $dateType["OLD_SLA_RESPONSE_TIME_UNIT"]);
         }
         if (in_array(CTicket::REOPEN, $dateType["EVENT"]) || in_array(CTicket::NEW_SLA, $dateType["EVENT"]) && $arTicket["IS_OVERDUE"] != "Y" && $oldPeriodMin != null && $oldPeriodMin > $periodMin) {
             $deadlineSourceDate = $currDateTS;
             $arFields["DEADLINE_SOURCE_DATE"] = $DB->CharToDateFunction(GetTime($deadlineSourceDate, "FULL"));
         } elseif ($arTicket["IS_OVERDUE"] != "Y" && $newDate1UserMessAfterSupMessTS > $deadlineSourceDate) {
             $sla = CTicketSLA::getById($slaID)->Fetch();
             if (empty($sla['DEADLINE_SOURCE'])) {
                 // default deadline calculation
                 // date of first client message after support message
                 $deadlineSourceDate = $newDate1UserMessAfterSupMessTS;
                 $arFields["DEADLINE_SOURCE_DATE"] = $arFields["D_1_USER_M_AFTER_SUP_M"];
             }
         }
     }
     $supportDeadlineTS = CSupportTimetableCache::getEndDate($slaID, $periodMin, GetTime($deadlineSourceDate, "FULL"));
     $arFields["SUPPORT_DEADLINE"] = $DB->CharToDateFunction(GetTime($supportDeadlineTS, "FULL"));
     $arFields["IS_OVERDUE"] = $supportDeadlineTS <= $currDateTS ? "'Y'" : "'N'";
     // exec event and confirm if overdue
     if ($arTicket['IS_OVERDUE'] == "N" && $arFields['IS_OVERDUE'] == "'Y'") {
         $rs = GetModuleEvents('support', 'OnBeforeTicketExpire');
         while ($arr = $rs->Fetch()) {
             $arFields = ExecuteModuleEventEx($arr, array($ticketID, $arFields));
             if (!$arFields) {
                 return false;
             }
         }
     }
     if ($periodNMin > 0) {
         $supportDeadlineNotifyTS = CSupportTimetableCache::getEndDate($slaID, $periodNMin, GetTime($deadlineSourceDate, "FULL"));
         $arFields["SUPPORT_DEADLINE_NOTIFY"] = $DB->CharToDateFunction(GetTime($supportDeadlineNotifyTS, "FULL"));
         $arFields["IS_NOTIFIED"] = $supportDeadlineNotifyTS <= $currDateTS ? "'Y'" : "'N'";
         // exec event and confirm if set notified
         if ($arTicket['IS_NOTIFIED'] == "N" && $arFields['IS_NOTIFIED'] == "'Y'") {
             $rs = GetModuleEvents('support', 'OnBeforeTicketNotify');
             while ($arr = $rs->Fetch()) {
                 $arFields = ExecuteModuleEventEx($arr, array($ticketID, $arFields));
                 if (!$arFields) {
                     return false;
                 }
             }
         }
     }
     $DB->Update("b_ticket", $arFields, "WHERE ID='" . $ticketID . "'", $err_mess . __LINE__);
 }
Exemplo n.º 14
0
function Tab1($adminForm)
{
    $adminForm->BeginCustomField("NAME", GetMessage("SUP_NAME"), false);
    ?>
	<tr class="adm-detail-required-field"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%"><input type="text" maxlength="255" name="NAME" size="50" value="<?php 
    echo CSupportPage::$holidaysFields->getFieldForOutput("NAME", CSupportTableFields::ATTRIBUTE);
    ?>
"></td>
	</tr>
	<?php 
    $adminForm->EndCustomField("NAME");
    $adminForm->BeginCustomField("OPEN_TIME", GetMessage("SUP_OPEN_TIME"), false);
    ?>
	<tr class="adm-detail-required-field"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%">
			<select id="OPEN_TIME" name="OPEN_TIME" onchange="changeOpenTimeFormat()">
			<?php 
    $arr = CSupportHolidays::GetOpenTimeArray();
    foreach ($arr as $v => $n) {
        $ss = substr($v, 0, 3);
        if ($ss == "GB_") {
            echo '<optgroup label="' . GetMessage($n) . '">';
        } elseif ($ss == "GE_") {
            echo '</optgroup>';
        } else {
            echo '<option ' . ($v == CSupportPage::$holidaysFields->OPEN_TIME ? 'selected ' : '') . 'value="' . $v . '">' . GetMessage($n) . '</option>';
        }
    }
    ?>
			</select>
		</td>
	</tr>
	<script type="text/javascript">
		function changeOpenTimeFormat()
		{
			var inputFrom = BX.findChild(BX('supTabControl_form'), {attr:{name:'DATE_FROM'}}, true);
			var inputTill = BX.findChild(BX('supTabControl_form'), {attr:{name:'DATE_TILL'}}, true);

			inputFrom.value = BX.calendar.ValueToString(BX.parseDate(inputFrom.value), BX('OPEN_TIME').value.slice(-2) == '_H');
			inputTill.value = BX.calendar.ValueToString(BX.parseDate(inputTill.value), BX('OPEN_TIME').value.slice(-2) == '_H');
		}
	</script>
	<?php 
    $adminForm->EndCustomField("OPEN_TIME");
    $adminForm->BeginCustomField("DATE_FROM", GetMessage("SUP_DATE_FROM"), false);
    if (CSupportPage::$holidaysFields->OPEN_TIME == 'HOLIDAY_H' || CSupportPage::$holidaysFields->OPEN_TIME == 'WORKDAY_H') {
        $time = GetTime(CSupportPage::$holidaysFields->DATE_FROM, "FULL");
    } else {
        $time = GetTime(CSupportPage::$holidaysFields->DATE_FROM, "SHORT");
    }
    $dateControl = str_replace(array('bTime: true', 'bHideTime: false', 'BX.calendar({'), array('bTime: BX(\'OPEN_TIME\').value.slice(-2) == \'_H\'', 'bHideTime: BX(\'OPEN_TIME\').value.slice(-2) != \'_H\'', 'BX.calendar({callback_after: function(param){this.params.field.value = BX.calendar.ValueToString(param, BX(\'OPEN_TIME\').value.slice(-2) == \'_H\')}, '), CalendarDate("DATE_FROM", $time, "supTabControl", "20"));
    ?>
	<tr class="adm-detail-required-field"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%"><?php 
    echo $dateControl;
    ?>
</td>
	</tr>
	<?php 
    $adminForm->EndCustomField("DATE_FROM");
    $adminForm->BeginCustomField("DATE_TILL", GetMessage("SUP_DATE_TILL"), false);
    if (CSupportPage::$holidaysFields->OPEN_TIME == 'HOLIDAY_H' || CSupportPage::$holidaysFields->OPEN_TIME == 'WORKDAY_H') {
        $time = GetTime(CSupportPage::$holidaysFields->DATE_TILL, "FULL");
    } else {
        $time = GetTime(CSupportPage::$holidaysFields->DATE_TILL, "SHORT");
    }
    $dateControl = str_replace(array('bTime: true', 'bHideTime: false', 'BX.calendar({'), array('bTime: BX(\'OPEN_TIME\').value.slice(-2) == \'_H\'', 'bHideTime: BX(\'OPEN_TIME\').value.slice(-2) != \'_H\'', 'BX.calendar({callback_after: function(param){this.params.field.value = BX.calendar.ValueToString(param, BX(\'OPEN_TIME\').value.slice(-2) == \'_H\')}, '), CalendarDate("DATE_TILL", $time, "supTabControl", "20"));
    ?>
	<tr class="adm-detail-required-field"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%"><?php 
    echo $dateControl;
    ?>
</td>
	</tr>
	<?php 
    $adminForm->EndCustomField("DATE_TILL");
    $adminForm->BeginCustomField("SLA_ID", GetMessage("SUP_SLA_ID"), false);
    ?>
	<tr valign="top"> 
		<td width="40%" align="right"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
		<td width="60%">
			<?php 
    $arrSLA_ID = CSupportPage::$holidaysSlaFields->getColumn("SLA_ID");
    $arSort = array();
    $is_filtered = null;
    $ar = CTicketSLA::GetList($arSort, array(), $is_filtered);
    $idR = 0;
    while ($arR = $ar->Fetch()) {
        $idR++;
        echo InputType("checkbox", "SLA_ID[]", $arR["ID"], $arrSLA_ID, false, "", "", $idR) . '<label for="' . $idR . '"> ' . htmlspecialcharsbx($arR["NAME"]) . "</label><br>";
    }
    ?>
		</td>
	</tr>
		
	<?php 
    $adminForm->EndCustomField("SLA_ID");
    $adminForm->BeginCustomField("DESCRIPTION", GetMessage("SUP_DESCRIPTION"), false);
    ?>
	<tr class="heading">
		<td colspan="2"><?php 
    echo $adminForm->GetCustomLabelHTML();
    ?>
:</td>
	</tr>
	<tr>
		<td colspan="2" align="center"><textarea style="width:60%; height:150px;" name="DESCRIPTION" wrap="VIRTUAL"><?php 
    echo CSupportPage::$holidaysFields->getFieldForOutput("DESCRIPTION", CSupportTableFields::ATTRIBUTE);
    ?>
</textarea></td>
	</tr>
	<?php 
    $adminForm->EndCustomField("DESCRIPTION");
}
Exemplo n.º 15
0
$fetchedRows = array();
$slaResponsibles = array();

while($arRes = $rsData->NavNext())
{
	$fetchedRows[] = $arRes;
	$slaResponsibles[] = $arRes['RESPONSIBLE_USER_ID'];
}

// get co-result data

// sites
$slaSiteList = CTicketSLA::GetSiteArrayForAllSLA();

// groups
$slaGroupList = CTicketSLA::GetGroupArrayForAllSLA();

// groups info
$groupIds = array();
foreach ($slaGroupList as $slaId => $groups)
{
	$groupIds = array_merge($groupIds, $groups);
}
$groupIds = array_unique($groupIds);

$slaGroupNames = array();
$res = CGroup::getList($by=null, $order=null, array('ID' => join('|', $groupIds)));
while ($arRes = $res->Fetch())
{
	$slaGroupNames[$arRes['ID']] = $arRes['NAME'];
}
Exemplo n.º 16
0
</td>
		<td valign="top"><input type="text" size="5" value="<?php 
echo intval($MESSAGES_PER_PAGE);
?>
" name="MESSAGES_PER_PAGE"></td>
	</tr>
	<tr>
		<td valign="top"><?php 
echo GetMessage('SUP_SUPERTICKET_COUPON_FORMAT');
?>
</td>
		<td valign="top"><input type="text" size="30" value="<?echo htmlspecialcharsbx($SUPERTICKET_COUPON_FORMAT)?>" name="SUPERTICKET_COUPON_FORMAT"></td>
	</tr>
	<?
	$arr = Array("reference" => array(), "reference_id" => array());
	$rs = CTicketSLA::GetList($a = array('NAME' => 'ASC'), array(), $__is_f);
	while ($arSla = $rs->GetNext())
	{
		$arr['reference'][] = htmlspecialcharsback($arSla['NAME']) . ' ['.$arSla['ID'].']';
		$arr['reference_id'][] = $arSla['ID'];
	}
	$arr2['reference_id'][] = "Y";
	$arr2['reference'][] =GetMessage('SUP_OLD_FUNCTIONALITY_Y');
	$arr2['reference_id'][] = "N";
	$arr2['reference'][] =GetMessage('SUP_OLD_FUNCTIONALITY_N');
	?>
	<tr>
		<td valign="top"><?php 
echo GetMessage('SUP_SUPERTICKET_DEFAULT_SLA');
?>
</td>