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


PHP CTicket::ExecuteEvents方法代码示例

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


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

示例1: Set

 function Set($arFields, &$MID, $id = "", $checkRights = "Y", $sendEmailToAuthor = "Y", $sendEmailToTechsupport = "Y")
 {
     global $DB, $APPLICATION, $USER;
     $err_mess = CAllTicket::err_mess() . "<br>Function: Set<br>Line: ";
     $v0 = self::Set_InitVar($arFields, $id, $checkRights, $sendEmailToAuthor, $sendEmailToTechsupport);
     if (!is_array($v0)) {
         return $v0;
     }
     $v = $v0["v"];
     /* isNew, CHECK_RIGHTS, SEND_EMAIL_TO_AUTHOR, SEND_EMAIL_TO_TECHSUPPORT, bAdmin, bSupportTeam, bSupportClient, bDemo, bOwner, uid, bActiveCoupon, IsSpam */
     /** @var CSupportTableFields $f */
     $f = $v0["f"];
     /* ID, SITE_ID, MODIFIED_GUEST_ID, OWNER_USER_ID, OWNER_SID, HOLD_ON, IS_SPAM */
     // если модифицируем обращение то
     if (!$v->isNew) {
         unset($arFields['COUPON']);
         $arFields['ID'] = $f->ID;
         $arFields = CTicket::ExecuteEvents('OnBeforeTicketUpdate', $arFields, false);
         $v->closeDate = isset($arFields["CLOSE"]) && $arFields["CLOSE"] == "Y";
         //$close
         // запоминаем предыдущие важные значения
         $v->arrOldFields = array();
         $arr = array("TITLE" => "T.TITLE", "RESPONSIBLE_USER_ID" => "T.RESPONSIBLE_USER_ID", "SLA_ID" => "T.SLA_ID", "CATEGORY_ID" => "T.CATEGORY_ID", "CRITICALITY_ID" => "T.CRITICALITY_ID", "STATUS_ID" => "T.STATUS_ID", "MARK_ID" => "T.MARK_ID", "DIFFICULTY_ID" => "T.DIFFICULTY_ID", "DATE_CLOSE" => "T.DATE_CLOSE", "HOLD_ON" => "T.HOLD_ON", "RESPONSE_TIME" => "S.RESPONSE_TIME", "RESPONSE_TIME_UNIT" => "S.RESPONSE_TIME_UNIT");
         $str = "T.ID";
         foreach ($arr as $s) {
             $str .= "," . $s;
         }
         $strSql = "SELECT " . $str . ", SITE_ID FROM b_ticket T LEFT JOIN b_ticket_sla S ON T.SLA_ID = S.ID WHERE T.ID='" . $f->ID . "'";
         $z = $DB->Query($strSql, false, $err_mess . __LINE__);
         if ($zr = $z->Fetch()) {
             $f->SITE_ID = $zr["SITE_ID"];
             if (intval($v->uid) == $zr["RESPONSIBLE_USER_ID"]) {
                 $v->bSupportTeam = "Y";
             }
             foreach ($arr as $key => $s) {
                 $v->arrOldFields[$key] = $zr[$key];
             }
         }
         $f->FromArray($arFields, "SITE_ID,MODIFIED_MODULE_NAME,SLA_ID,SOURCE_ID", array(CSupportTableFields::MORE0, CSupportTableFields::NOT_EMTY_STR));
         if (!$f->MODIFIED_MODULE_NAME) {
             $f->MODIFIED_MODULE_NAME = '';
         }
         $f->FromArray($arFields, "CATEGORY_ID,RESPONSIBLE_USER_ID,STATUS_ID,DIFFICULTY_ID,CRITICALITY_ID,SUPPORT_COMMENTS");
         if (isset($arFields['CHANGE_TITLE'])) {
             $f->set('TITLE', $arFields['CHANGE_TITLE']);
         }
         $f->set("MODIFIED_USER_ID", $v->uid, array(CSupportTableFields::MORE0));
         $f->setCurrentTime("TIMESTAMP_X");
         if ($v->closeDate) {
             $f->setCurrentTime("DATE_CLOSE");
         }
         // ?remake? {
         $v->IS_GROUP_USER = 'N';
         if ($v->bAdmin) {
             $IS_GROUP_USER = 'Y';
         } elseif ($v->CHECK_RIGHTS == 'Y' && ($v->bSupportClient || $v->bSupportTeam)) {
             if ($v->bSupportTeam) {
                 $join_query = '(T.RESPONSIBLE_USER_ID IS NOT NULL AND T.RESPONSIBLE_USER_ID=O.USER_ID)';
             } else {
                 $join_query = '(T.OWNER_USER_ID IS NOT NULL AND T.OWNER_USER_ID=O.USER_ID)';
             }
             $strSql = "SELECT 'x'\n\t\t\t\tFROM b_ticket T\n\t\t\t\tINNER JOIN b_ticket_user_ugroup O ON {$join_query}\n\t\t\t\tINNER JOIN b_ticket_user_ugroup C ON (O.GROUP_ID=C.GROUP_ID)\n\t\t\t\tINNER JOIN b_ticket_ugroups G ON (O.GROUP_ID=G.ID)\n\t\t\t\tWHERE T.ID='" . $f->ID . "' AND C.USER_ID='" . $v->uid . "' AND C.CAN_VIEW_GROUP_MESSAGES='Y' AND G.IS_TEAM_GROUP='" . ($v->bSupportTeam ? "Y" : "N") . "'";
             $z = $DB->Query($strSql);
             if ($zr = $z->Fetch()) {
                 $v->IS_GROUP_USER = 'Y';
             }
         }
         // }
         if (isset($arFields["AUTO_CLOSE_DAYS"]) && intval($arFields["AUTO_CLOSE_DAYS"]) >= 0) {
             if (intval($arFields["AUTO_CLOSE_DAYS"]) == 0) {
                 // get from module settings
                 $f->AUTO_CLOSE_DAYS = COption::GetOptionString('support', "DEFAULT_AUTO_CLOSE_DAYS");
             } else {
                 $f->AUTO_CLOSE_DAYS = $arFields["AUTO_CLOSE_DAYS"];
             }
         }
         if (is_array($v->arrOldFields) && is_array($arFields) && $arFields["CLOSE"] == "N" && strlen($v->arrOldFields["DATE_CLOSE"]) > 0) {
             $f->DATE_CLOSE = null;
             $f->REOPEN = "Y";
         }
         // Если есть что и мы Аднины или из группы ТП, запишем в базу
         $v->FirstUpdateRes = false;
         if ($v->bSupportTeam || $v->bAdmin) {
             $arFields_i = $f->ToArray(CSupportTableFields::ALL, array(CSupportTableFields::ONLY_CHANGED), true);
             if ($v->CHECK_RIGHTS == "N" && isset($arFields["MARK_ID"]) && intval($arFields["MARK_ID"]) > 0) {
                 $arFields_i["MARK_ID"] = intval($arFields["MARK_ID"]);
             }
             if (count($arFields_i) > 0) {
                 $v->SupportTeamUpdateRes = $DB->Update("b_ticket", $arFields_i, "WHERE ID='" . $f->ID . "'", $err_mess . __LINE__);
                 //$rows1
                 $GLOBALS["USER_FIELD_MANAGER"]->Update("SUPPORT", $f->ID, $arFields);
                 // если указана отметка о спаме то установим отметку о спаме
                 if (strlen($f->IS_SPAM) > 0) {
                     CTicket::MarkAsSpam($f->ID, $f->IS_SPAM, $v->CHECK_RIGHTS);
                 }
                 $v->newSLA = isset($arFields_i["SLA_ID"]) && $v->arrOldFields["SLA_ID"] != $arFields_i["SLA_ID"];
             }
         } elseif ($v->bOwner || $v->bSupportClient) {
             $arFields_i = $f->ToArray("TIMESTAMP_X,DATE_CLOSE,CRITICALITY_ID,MODIFIED_USER_ID,MODIFIED_GUEST_ID,MODIFIED_MODULE_NAME,REOPEN", array(CSupportTableFields::ONLY_CHANGED), true);
             $arFields_i["MARK_ID"] = intval($arFields["MARK_ID"]);
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:support.php


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