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();"; }