11 "OPEN_TIME" =>
array(
"TYPE" =>
CSupportTableFields::VT_STRING,
"DEF_VAL" =>
"HOLIDAY",
"LIST" =>
array(
"HOLIDAY_H",
"HOLIDAY",
"WORKDAY_H",
"WORKDAY_0",
"WORKDAY_1",
"WORKDAY_2",
"WORKDAY_3",
"WORKDAY_4",
"WORKDAY_5",
"WORKDAY_6")),
21 const table =
"b_ticket_holidays";
30 $isSupportClient =
null;
31 $isSupportTeam =
null;
35 CTicket::GetRoles($isDemo, $isSupportClient, $isSupportTeam, $isAdmin, $isAccess, $userID);
39 $arMsg[] =
array(
"id"=>
"PERMISSION",
"text"=>
GetMessage(
"SUP_ERROR_ACCESS_DENIED"));
51 if(is_array($arFieldsSLA))
54 $f_s->FromTable($arFieldsSLA);
56 else $f_s = $arFieldsSLA;
60 $table_s2h = self::table_s2h;
62 $isNew = (
$f->ID <= 0);
67 $objError->AddMessage(
array(
"text" =>
GetMessage(
'SUP_ERROR_EMPTY_NAME')));
69 if(
$f->OPEN_TIME ==
'')
71 $objError->AddMessage(
array(
"text" =>
GetMessage(
'SUP_ERROR_EMPTY_OPEN_TIME')));
73 $zd = mktime(0, 0, 0, 1, 1, 2010);
74 if(
$f->DATE_FROM < $zd ||
$f->DATE_FROM ===
null ||
$f->DATE_TILL < $zd ||
$f->DATE_TILL ===
null ||
$f->DATE_FROM >
$f->DATE_TILL)
76 if(
$f->DATE_FROM < $zd ||
$f->DATE_FROM ===
null)
78 $f->DATE_FROM = time() + CTimeZone::GetOffset();
81 if(
$f->DATE_TILL < $zd ||
$f->DATE_TILL ===
null)
83 $f->DATE_TILL = time() + CTimeZone::GetOffset();
85 $objError->AddMessage(
array(
"text" =>
GetMessage(
'SUP_ERROR_EMPTY_DATE')));
88 if(
count($objError->GetMessages())>0)
96 if(
count($arFields_i) > 0)
100 $res =
$DB->Insert($table, $arFields_i);
105 $res =
$DB->Update($table, $arFields_i,
"WHERE ID=" .
$f->ID .
"");
109 if(intval(
$res) <= 0)
115 $DB->Query(
"DELETE FROM $table_s2h WHERE HOLIDAYS_ID = " .
$f->ID);
119 $f_s->HOLIDAYS_ID =
$f->ID;
122 $strSql =
"INSERT INTO " . $table_s2h .
"(SLA_ID, HOLIDAYS_ID) VALUES (" . $f_s->SLA_ID .
", " . $f_s->HOLIDAYS_ID .
")";
127 CSupportTimetableCache::toCache(
array(
"SLA_ID"=> $f_s->getColumn(
"SLA_ID")));
138 $table = self::table;
139 $table_s2h = self::table_s2h;
140 $arSqlSearch = Array();
159 $arSqlSearch[] =
"H.ID IN (
168 if(is_array(
$val) && isset(
$val[
"FROM"]) && intval(
$val[
"FROM"]) > 0 && isset(
$val[
"TILL"]) && intval(
$val[
"TILL"]) > 0)
170 $arSqlSearch[] =
"H.DATE_FROM <= " .
$DB->CharToDateFunction(
GetTime(
$val[
"TILL"],
"FULL")) .
" AND H.DATE_TILL >= " .
$DB->CharToDateFunction(
GetTime(
$val[
"FROM"],
"FULL"));
179 $arSort = is_array($arSort) ? $arSort :
array();
180 if(
count($arSort) > 0)
182 $ar1 = array_merge(
$DB->GetTableFieldsList($table),
array());
183 $ar2 = array_keys($arSort);
184 $arDiff = array_diff($ar2, $ar1);
185 if(is_array($arDiff) &&
count($arDiff) > 0)
foreach($arDiff as $value) unset($arSort[$value]);
187 if(
count($arSort) <= 0) $arSort =
array(
"ID" =>
"ASC");
189 foreach($arSort as $by =>
$order)
192 if($by ===
"DATE_TILL" || $by ===
"DATE_FROM")
195 " . $by .
" " . $by .
"_SORT";
196 $arSqlOrder[] = $by .
"_SORT " .
$order;
200 $arSqlOrder[] = $by .
" " .
$order;
204 if(is_array($arSqlOrder) &&
count($arSqlOrder) > 0) $strSqlOrder =
" ORDER BY " . implode(
",", $arSqlOrder);
212 " .
$DB->DateToCharFunction(
"H.DATE_FROM",
"FULL") .
" DATE_FROM,
213 " .
$DB->DateToCharFunction(
"H.DATE_TILL",
"FULL") .
" DATE_TILL" . $fs .
"
220 $rs =
$DB->Query($strSql);
229 $table_s2h = self::table_s2h;
230 $table_sla = self::table_sla;
240 INNER JOIN $table_sla SLA
241 ON S2H.SLA_ID = SLA.ID
242 AND S2H.HOLIDAYS_ID = $id
247 if(!$needObj)
return $res;
249 $f_s->RemoveExistingRows();
250 while ($resR =
$res->Fetch())
253 $f_s->FromArray($resR);
261 "GB_1" =>
"SUP_OPEN_TIME_HOLIDAY_G",
262 "HOLIDAY_H" =>
"SUP_OPEN_TIME_HOLIDAY_H",
263 "HOLIDAY" =>
"SUP_OPEN_TIME_HOLIDAY",
265 "GB_2" =>
"SUP_OPEN_TIME_WORKDAY_G",
266 "WORKDAY_H" =>
"SUP_OPEN_TIME_WORKDAY_H",
267 "WORKDAY_0" =>
"SUP_OPEN_TIME_WORKDAY_0",
268 "WORKDAY_1" =>
"SUP_OPEN_TIME_WORKDAY_1",
269 "WORKDAY_2" =>
"SUP_OPEN_TIME_WORKDAY_2",
270 "WORKDAY_3" =>
"SUP_OPEN_TIME_WORKDAY_3",
271 "WORKDAY_4" =>
"SUP_OPEN_TIME_WORKDAY_4",
272 "WORKDAY_5" =>
"SUP_OPEN_TIME_WORKDAY_5",
273 "WORKDAY_6" =>
"SUP_OPEN_TIME_WORKDAY_6",
282 return (isset(
$arr[$v]) ?
$arr[$v] :
"");
286 public static function Delete($id, $checkRights=
true)
290 $table = self::table;
291 $table_s2h = self::table_s2h;
293 if ($id <= 0)
return false;
296 $isSupportClient =
null;
297 $isSupportTeam =
null;
302 CTicket::GetRoles($isDemo, $isSupportClient, $isSupportTeam, $isAdmin, $isAccess, $userID, $checkRights);
307 $arMsg[] =
array(
"id"=>
"PERMISSION",
"text"=>
GetMessage(
"SUP_ERROR_ACCESS_DENIED"));
314 $affected_sla =
array();
316 $res =
$DB->Query(
"SELECT SLA_ID FROM b_ticket_sla_2_holidays WHERE HOLIDAYS_ID = $id");
317 while ($row =
$res->Fetch())
319 $affected_sla[] = $row[
'SLA_ID'];
323 $DB->Query(
"DELETE FROM $table WHERE ID = $id");
324 $DB->Query(
"DELETE FROM $table_s2h WHERE HOLIDAYS_ID = $id");
327 CSupportTimetableCache::toCache(
array(
"SLA_ID" => $affected_sla));
static GetRoles(&$isDemo, &$isSupportClient, &$isSupportTeam, &$isAdmin, &$isAccess, &$userID, $checkRights=true)
static Delete($id, $checkRights=true)
static GetOpenTimeArray()
static GetSLAByID($id, $needObj=false)
static Set($arFields, $arFieldsSLA)
static GetList($arSort, $arFilter)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
GetTime($timestamp, $type="SHORT", $site=false, $bSearchInSitesOnly=false)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if(empty($signedUserToken)) $key
</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."%"