当前位置: 首页>>代码示例>>PHP>>正文


PHP CTicket::UpdateMessages方法代码示例

本文整理汇总了PHP中CTicket::UpdateMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP CTicket::UpdateMessages方法的具体用法?PHP CTicket::UpdateMessages怎么用?PHP CTicket::UpdateMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTicket的用法示例。


在下文中一共展示了CTicket::UpdateMessages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: AddMessage


//.........这里部分代码省略.........
         if (is_set($arFields, "HIDDEN")) {
             $hidden = $arFields["HIDDEN"] == "Y" ? "Y" : "N";
         } elseif (is_set($arFields, "IS_HIDDEN")) {
             $hidden = $arFields["IS_HIDDEN"] == "Y" ? "Y" : "N";
         }
         $hidden = $hidden == "Y" ? "Y" : "N";
         $notChangeStatus = is_set($arFields, "NOT_CHANGE_STATUS") && $arFields["NOT_CHANGE_STATUS"] == "Y" ? "Y" : "N";
         $changeLastMessageDate = true;
         if ($arTicket["LAST_MESSAGE_USER_ID"] == $uid && $arTicket["REOPEN"] != "Y") {
             $changeLastMessageDate = false;
         }
         $TASK_TIME = intval($arFields["TASK_TIME"]) > 0 ? intval($arFields["TASK_TIME"]) : "null";
         if (is_set($arFields, "LOG")) {
             $log = $arFields["LOG"] == "Y" ? "Y" : "N";
         } elseif (is_set($arFields, "IS_LOG")) {
             $log = $arFields["IS_LOG"] == "Y" ? "Y" : "N";
         }
         $log = $log == "Y" ? "Y" : "N";
         if (is_set($arFields, "OVERDUE")) {
             $overdue = $arFields["OVERDUE"] == "Y" ? "Y" : "N";
         } elseif (is_set($arFields, "IS_OVERDUE")) {
             $overdue = $arFields["IS_OVERDUE"] == "Y" ? "Y" : "N";
         }
         $overdue = $overdue == "Y" ? "Y" : "N";
         $arFieldsI = array("TIMESTAMP_X" => $DB->GetNowFunction(), "DAY_CREATE" => $DB->CurrentDateFunction(), "C_NUMBER" => $maxNumber + 1, "TICKET_ID" => $ticketID, "IS_HIDDEN" => "'" . $hidden . "'", "IS_LOG" => "'" . $log . "'", "IS_OVERDUE" => "'" . $overdue . "'", "MESSAGE" => "'" . $DB->ForSql($arFields["MESSAGE"]) . "'", "MESSAGE_SEARCH" => "'" . $DB->ForSql(ToUpper($arFields["MESSAGE"])) . "'", "EXTERNAL_ID" => $externalID, "EXTERNAL_FIELD_1" => strlen($externalField1) > 0 ? "'" . $DB->ForSql($externalField1) . "'" : "null", "OWNER_USER_ID" => $ownerUserID, "OWNER_GUEST_ID" => $ownerGuestID, "OWNER_SID" => $ownerSid, "SOURCE_ID" => intval($arFields["MESSAGE_SOURCE_ID"]), "CREATED_USER_ID" => $createdUserID, "CREATED_GUEST_ID" => $createdGuestID, "CREATED_MODULE_NAME" => $createdModuleName, "MODIFIED_USER_ID" => $createdUserID, "MODIFIED_GUEST_ID" => $createdGuestID, "MESSAGE_BY_SUPPORT_TEAM" => $MessageBySupportTeam, "TASK_TIME" => $TASK_TIME, "NOT_CHANGE_STATUS" => "'" . $notChangeStatus . "'");
         CTimeZone::Disable();
         $arFieldsI["DATE_CREATE"] = $DB->CharToDateFunction(GetTime(time(), "FULL"));
         CTimeZone::Enable();
         if ($hidden != "Y" && $log != "Y" && $changeLastMessageDate == false) {
             if ($MessageBySupportTeam == "'Y'" || $maxNumber <= 0 && array_key_exists('SOURCE_SID', $arFields) && $arFields['SOURCE_SID'] === 'email') {
                 $arFieldsI["NOT_CHANGE_STATUS"] = "'N'";
             } else {
                 $arFieldsI["NOT_CHANGE_STATUS"] = "'Y'";
             }
         }
         if (intval($currentResponsibleUserID) > 0) {
             $arFieldsI["CURRENT_RESPONSIBLE_USER_ID"] = $currentResponsibleUserID;
         }
         $mid = $DB->Insert("b_ticket_message", $arFieldsI, $err_mess . __LINE__);
         if (intval($mid) > 0) {
             $not_image_extension_suffix = COption::GetOptionString("support", "NOT_IMAGE_EXTENSION_SUFFIX");
             $not_image_upload_dir = COption::GetOptionString("support", "NOT_IMAGE_UPLOAD_DIR");
             $max_size = COption::GetOptionString("support", "SUPPORT_MAX_FILESIZE");
             // сохраняем приаттаченные файлы
             $arFILES = $arFields["FILES"];
             if (is_array($arFILES) && count($arFILES) > 0) {
                 while (list($key, $arFILE) = each($arFILES)) {
                     if (strlen($arFILE["name"]) > 0) {
                         if ($bSupportTeam != "Y" && $bAdmin != "Y") {
                             $max_file_size = intval($max_size) * 1024;
                         }
                         $fes = "";
                         $upload_dir = "support";
                         if (!CFile::IsImage($arFILE["name"], $arFILE["type"])) {
                             $fes = $not_image_extension_suffix;
                             $arFILE["name"] .= $fes;
                             $upload_dir = $not_image_upload_dir;
                         }
                         if (!array_key_exists("MODULE_ID", $arFILE) || strlen($arFILE["MODULE_ID"]) <= 0) {
                             $arFILE["MODULE_ID"] = "support";
                         }
                         $fid = intval(CFile::SaveFile($arFILE, $upload_dir, $max_file_size));
                         if ($fid > 0) {
                             $md5 = md5(uniqid(mt_rand(), true) . time());
                             $arFILE["HASH"] = $md5;
                             $arFILE["FILE_ID"] = $fid;
                             $arFILE["MESSAGE_ID"] = $mid;
                             $arFILE["TICKET_ID"] = $ticketID;
                             $arFILE["EXTENSION_SUFFIX"] = $fes;
                             $arFields_fi = array("HASH" => "'" . $DB->ForSql($md5, 255) . "'", "MESSAGE_ID" => $mid, "FILE_ID" => $fid, "TICKET_ID" => $ticketID, "EXTENSION_SUFFIX" => strlen($fes) > 0 ? "'" . $DB->ForSql($fes, 255) . "'" : "null");
                             $link_id = $DB->Insert("b_ticket_message_2_file", $arFields_fi, $err_mess . __LINE__);
                             if (intval($link_id) > 0) {
                                 $arFILE["LINK_ID"] = $link_id;
                                 $arrFILES[] = $arFILE;
                             }
                         }
                     }
                 }
             }
             // если это не было скрытым сообщением или сообщение лога, то
             if ($notChangeStatus != "Y" && $hidden != "Y" && $log != "Y") {
                 // обновим ряд параметров обращения
                 if (!isset($arFields["AUTO_CLOSE_DAYS"])) {
                     $RESET_AUTO_CLOSE = "Y";
                 }
                 CTicket::UpdateLastParams($ticketID, $RESET_AUTO_CLOSE, $changeLastMessageDate, true);
                 // при необходимости создадим или удалим агенты-напоминальщики
                 //CTicketReminder::Update($ticketID);
             }
             if ($log != "Y") {
                 CSupportSearch::writeWordsInTable($mid, $siteID, $tTitle . " " . $arFields["MESSAGE"]);
             }
             //если была установлена галочка "не изменять статус обращени" - пересчитаем количество собщений
             if ($notChangeStatus == "Y" || $hidden == "Y") {
                 CTicket::UpdateMessages($ticketID);
             }
         }
     }
     return $mid;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:support.php


注:本文中的CTicket::UpdateMessages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。