22 const TABLE =
"b_ticket_timetable";
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($arFieldsShedule))
54 $f_s->FromTable($arFieldsShedule);
56 else $f_s = $arFieldsShedule;
59 $table_shedule = self::TABLE_SHEDULE;
62 $isNew = (
$f->ID <= 0);
72 if(
count($arFields_i) > 0)
76 $res =
$DB->Insert($table, $arFields_i);
80 $res =
$DB->Update($table, $arFields_i,
"WHERE ID=" . $id .
"");
94 $DB->Query(
"DELETE FROM $table_shedule WHERE TIMETABLE_ID = $id");
99 $f_s->TIMETABLE_ID = $id;
100 if (isset($noWrite[$f_s->WEEKDAY_NUMBER]) && ($noWrite[$f_s->WEEKDAY_NUMBER] !=
"CUSTOM" || $f_s->OPEN_TIME !=
"CUSTOM") )
104 if($f_s->OPEN_TIME ==
"CUSTOM" && $f_s->MINUTE_FROM <= 0 && $f_s->MINUTE_TILL <= 0)
109 $noWrite[$f_s->WEEKDAY_NUMBER] = $f_s->OPEN_TIME;
111 for(
$i = 0;
$i <= 6;
$i++)
115 "TIMETABLE_ID" => intval($id),
116 "WEEKDAY_NUMBER" => intval(
$i),
117 "OPEN_TIME" =>
"'CLOSED'",
118 "MINUTE_FROM" =>
null,
119 "MINUTE_TILL" =>
null
121 if (!isset($noWrite[
$i]))
123 $DB->Insert($table_shedule,
$a);
128 $affected_sla =
array();
130 $res =
$DB->Query(
"SELECT ID FROM b_ticket_sla WHERE TIMETABLE_ID = $id");
131 while ($row =
$res->Fetch())
133 $affected_sla[] = $row[
'ID'];
136 CSupportTimetableCache::toCache(
array(
'SLA_ID' => $affected_sla));
145 $table = self::TABLE;
146 $arSqlSearch = Array();
176 $arSort = is_array($arSort) ? $arSort :
array();
177 if(isset($arSort[
"DESCRIPTION"]))
179 unset($arSort[
"DESCRIPTION"]);
181 if(
count($arSort) > 0)
183 $ar1 = array_merge(
$DB->GetTableFieldsList($table),
array());
184 $ar2 = array_keys($arSort);
185 $arDiff = array_diff($ar2, $ar1);
186 if(is_array($arDiff) &&
count($arDiff) > 0)
foreach($arDiff as $value) unset($arSort[$value]);
188 if(
count($arSort) <= 0)
190 $arSort =
array(
"ID" =>
"asc");
192 foreach($arSort as $by =>
$order)
194 if(mb_strtoupper(
$order) !=
"DESC")
198 $arSqlOrder[] = $by .
" " .
$order;
200 if(is_array($arSqlOrder) &&
count($arSqlOrder) > 0)
202 $strSqlOrder =
" ORDER BY " . implode(
",", $arSqlOrder);
214 $rs =
$DB->Query($strSql);
221 $tableShedule = self::TABLE_SHEDULE;
238 $f_s->RemoveExistingRows();
239 while ($resR =
$res->Fetch())
242 $f_s->FromArray($resR);
248 public static function Delete($id, $checkRights=
true)
252 $table = self::TABLE;
253 $tableShedule = self::TABLE_SHEDULE;
261 $isSupportClient =
null;
262 $isSupportTeam =
null;
266 CTicket::GetRoles($isDemo, $isSupportClient, $isSupportTeam, $isAdmin, $isAccess, $userID, $checkRights);
271 $arMsg[] =
array(
"id"=>
"PERMISSION",
"text"=>
GetMessage(
"SUP_ERROR_ACCESS_DENIED"));
278 $strSql =
"SELECT DISTINCT 'x' FROM b_ticket_sla WHERE TIMETABLE_ID = $id";
279 $rs =
$DB->Query($strSql);
282 $DB->Query(
"DELETE FROM $table WHERE ID = $id");
283 $DB->Query(
"DELETE FROM $tableShedule WHERE TIMETABLE_ID = $id");
static GetRoles(&$isDemo, &$isSupportClient, &$isSupportTeam, &$isAdmin, &$isAccess, &$userID, $checkRights=true)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
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."%"