function Update() { if (CSupportUpdate::CurrentVersionLowerThanUpdateVersion()) { $dbType = CSupportUpdate::GetBD(); $res = self::AlterTables($dbType); if (!$res) { return false; } $res = self::SeparateSLAandTimeTable($dbType); if (!$res) { return false; } CSupportTimetableCache::toCache(); CTicketReminder::RecalculateSupportDeadline(); CTicketReminder::StartAgent(); CSupportUpdate::ChangeCurrentVersion(); self::SetHotKeys(); } }
function AgentFunction() { //IS_OVERDUE //IS_NOTIFIED //SUPPORT_DEADLINE //SUPPORT_DEADLINE_NOTIFY global $DB; $err_mess = CAllTicketReminder::err_mess() . "<br>Function: AgentFunction<br>Line: "; if (CSupportUpdate::CurrentVersionLowerThanUpdateVersion()) { return "CTicketReminder::AgentFunction();"; } CTimeZone::Disable(); $cyrrDateTime = $DB->CharToDateFunction(GetTime(time(), "FULL")); CTimeZone::Enable(); $strSql = "\n\t\t\tSELECT\n\t\t\t\tT.ID ID,\n\t\t\t\tT.SITE_ID,\n\t\t\t\t" . $DB->DateToCharFunction("T.SUPPORT_DEADLINE_NOTIFY", "FULL") . " SUPPORT_DEADLINE_NOTIFY,\n\t\t\t\t" . $DB->DateToCharFunction("T.SUPPORT_DEADLINE", "FULL") . " SUPPORT_DEADLINE,\n\t\t\t\tT.ID_1_USER_M_AFTER_SUP_M\t\n\t\t\tFROM\n\t\t\t\tb_ticket T\t\t\t\t\t\n\t\t\tWHERE\n\t\t\t\tT.LAST_MESSAGE_BY_SUPPORT_TEAM = 'N'\n\t\t\t\tAND T.SUPPORT_DEADLINE_NOTIFY <= {$cyrrDateTime}\n\t\t\t\tAND T.SUPPORT_DEADLINE_NOTIFY IS NOT NULL\n\t\t\t\tAND T.ID_1_USER_M_AFTER_SUP_M > 0\n\t\t\t\tAND T.IS_OVERDUE = 'N'\n\t\t\t\tAND T.IS_NOTIFIED = 'N'\n\t\t\t\tAND T.DATE_CLOSE IS NULL\n\t\t"; $rsTicket = $DB->Query($strSql, false, $err_mess . __LINE__); while ($arrTicket = $rsTicket->Fetch()) { self::SupportDeadlineNotify($arrTicket); } $strSql = "\n\t\t\tSELECT\n\t\t\t\tT.*,\n\t\t\t\tTM.ID TM_ID,\n\t\t\t\tTM.C_NUMBER TM_C_NUMBER\n\t\t\tFROM\n\t\t\t\tb_ticket T\n\t\t\t\tLEFT JOIN b_ticket_message TM\n\t\t\t\t\tON T.ID_1_USER_M_AFTER_SUP_M\t= TM.ID\t\n\t\t\tWHERE\n\t\t\t\tT.LAST_MESSAGE_BY_SUPPORT_TEAM = 'N'\n\t\t\t\tAND T.SUPPORT_DEADLINE <= {$cyrrDateTime}\n\t\t\t\tAND T.IS_OVERDUE = 'N'\n\t\t\t\tAND T.DATE_CLOSE IS NULL\n\t\t"; $rsTicket = $DB->Query($strSql, false, $err_mess . __LINE__); while ($arrTicket = $rsTicket->Fetch()) { self::SupportDeadline($arrTicket); } return "CTicketReminder::AgentFunction();"; }
<?php global $DB, $APPLICATION; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/admin_tools.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/filter_tools.php"; IncludeModuleLangFile(__FILE__); IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/errors.php"); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/support_tools.php"; $db_type = strtolower($DB->type); CModule::AddAutoloadClasses("support", array("CTicket" => "classes/" . $db_type . "/support.php", "CTicketDictionary" => "classes/" . $db_type . "/dictionary.php", "CTicketSLA" => "classes/" . $db_type . "/sla.php", "CTicketReminder" => "classes/" . $db_type . "/reminder.php", "CSupportSuperCoupon" => "classes/general/coupons.php", "CSupportEMail" => "classes/general/email.php", "CSupportUserGroup" => "classes/general/usergroup.php", "CSupportUser2UserGroup" => "classes/general/usertousergroup.php", "CSupportTableFields" => "classes/general/tablefields.php", "CSupportTimetable" => "classes/general/timetable.php", "CSupportTools" => "classes/general/tools.php", "CSupportHolidays" => "classes/general/holidays.php", "CSupportTimetableCache" => "classes/general/timetablecache.php", "CSupportSearch" => "classes/general/search.php", "CSupportUpdate" => "classes/" . $db_type . "/update.php")); CSupportUpdate::Update();