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


PHP comment::get_person_and_client方法代码示例

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


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

示例1: add_comment_from_email

 function add_comment_from_email($email_receive, $entity)
 {
     $current_user =& singleton("current_user");
     $commentID = comment::add_comment($entity->classname, $entity->get_id(), $email_receive->get_converted_encoding());
     $commentID or alloc_error("Unable to create an alloc comment (" . $entity->classname . ":" . $entity->get_id() . ") from email.");
     $comment = new comment();
     $comment->set_id($commentID);
     $comment->select();
     $comment->set_value("commentEmailUID", $email_receive->msg_uid);
     $comment->set_value("commentEmailMessageID", $email_receive->mail_headers["message-id"]);
     $comment->rename_email_attachment_dir($email_receive->dir);
     // Try figure out and populate the commentCreatedUser/commentCreatedUserClientContactID fields
     list($from_address, $from_name) = parse_email_address($email_receive->mail_headers["from"]);
     list($personID, $clientContactID, $from_name) = comment::get_person_and_client($from_address, $from_name, $entity->get_project_id());
     $personID and $comment->set_value('commentCreatedUser', $personID);
     $clientContactID and $comment->set_value('commentCreatedUserClientContactID', $clientContactID);
     $comment->set_value("commentCreatedUserText", $email_receive->mail_headers["from"]);
     $comment->set_value("commentEmailMessageID", $email_receive->mail_headers["message-id"]);
     $comment->updateSearchIndexLater = true;
     $comment->skip_modified_fields = true;
     $comment->save();
     if ($email_receive->mimebits) {
         comment::update_mime_parts($comment->get_id(), $email_receive->mimebits);
     }
     // CYBER-ONLY: Re-open task, if comment has been made by an external party.
     if (config::for_cyber() && !$comment->get_value('commentCreatedUser')) {
         $e = $entity->get_parent_object();
         if ($e->classname == "task" && substr($e->get_value("taskStatus"), 0, 4) != "open") {
             $tmp = $current_user;
             $current_user = new person();
             $personID = $e->get_value("managerID") or $personID = $e->get_value("personID") or $personID = $e->get_value("creatorID");
             $current_user->load_current_user($personID);
             // fake identity
             singleton("current_user", $current_user);
             $e->set_value("taskStatus", "open_inprogress");
             $e->save();
             $current_user = $tmp;
         }
     }
     return $comment;
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:41,代码来源:comment.inc.php

示例2: adjust_by_email_subject

 function adjust_by_email_subject($email_receive, $e)
 {
     $current_user =& singleton("current_user");
     $entity = $e->classname;
     $entityID = $e->get_id();
     $subject = trim($email_receive->mail_headers["subject"]);
     $body = $email_receive->get_converted_encoding();
     $msg_uid = $email_receive->msg_uid;
     list($emailAddress, $fullName) = parse_email_address($email_receive->mail_headers["from"]);
     list($personID, $clientContactID, $fullName) = comment::get_person_and_client($emailAddress, $fullName, $e->get_project_id());
     // Load up the parent object that this comment refers to, be it task or timeSheet etc
     if ($entity == "comment" && $entityID) {
         $c = new comment();
         $c->set_id($entityID);
         $c->select();
         $object = $c->get_parent_object();
     } else {
         if (class_exists($entity) && $entityID) {
             $object = new $entity();
             $object->set_id($entityID);
             $object->select();
         }
     }
     // If we're doing subject line magic, then we're only going to do it with
     // subject lines that have a {Key:fdsFFeSD} in them.
     preg_match("/\\{Key:[A-Za-z0-9]{8}\\}(.*)\\s*\$/i", $subject, $m);
     $commands = explode(" ", trim($m[1]));
     foreach ((array) $commands as $command) {
         $command = strtolower($command);
         list($command, $command2) = explode(":", $command);
         // for eg: duplicate:1234
         // If "quiet" in the subject line, then the email/comment won't be re-emailed out again
         if ($command == "quiet") {
             $quiet = true;
             // To unsubscribe from this conversation
         } else {
             if ($command == "unsub" || $command == "unsubscribe") {
                 if (interestedParty::active($entity, $entityID, $emailAddress)) {
                     interestedParty::delete_interested_party($entity, $entityID, $emailAddress);
                 }
                 // To subscribe to this conversation
             } else {
                 if ($command == "sub" || $command == "subscribe") {
                     $ip = interestedParty::exists($entity, $entityID, $emailAddress);
                     if (!$ip) {
                         $data = array("entity" => $entity, "entityID" => $entityID, "fullName" => $fullName, "emailAddress" => $emailAddress, "personID" => $personID, "clientContactID" => $clientContactID);
                         interestedParty::add_interested_party($data);
                         // Else reactivate existing IP
                     } else {
                         if (!interestedParty::active($entity, $entityID, $emailAddress)) {
                             $interestedParty = new interestedParty();
                             $interestedParty->set_id($ip["interestedPartyID"]);
                             $interestedParty->select();
                             $interestedParty->set_value("interestedPartyActive", 1);
                             $interestedParty->save();
                         }
                     }
                     // If there's a number/duration then add some time to a time sheet
                 } else {
                     if (is_object($current_user) && $current_user->get_id() && preg_match("/([\\.\\d]+)/i", $command, $m)) {
                         $duration = $m[1];
                         if (is_numeric($duration)) {
                             if (is_object($object) && $object->classname == "task" && $object->get_id() && $current_user->get_id()) {
                                 $timeSheet = new timeSheet();
                                 $tsi_row = $timeSheet->add_timeSheetItem(array("taskID" => $object->get_id(), "duration" => $duration, "comment" => $body, "msg_uid" => $msg_uid, "msg_id" => $email_receive->mail_headers["message-id"], "multiplier" => 1));
                                 $timeUnit = new timeUnit();
                                 $units = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelA");
                                 $unitLabel = $units[$tsi_row["timeSheetItemDurationUnitID"]];
                             }
                         }
                         // Otherwise assume it's a status change
                     } else {
                         if (is_object($current_user) && $current_user->get_id() && $command) {
                             if (is_object($object) && $object->get_id()) {
                                 $object->set_value("taskStatus", $command);
                                 if ($command2 && preg_match("/dup/i", $command)) {
                                     $object->set_value("duplicateTaskID", $command2);
                                 } else {
                                     if ($command2 && preg_match("/tasks/i", $command)) {
                                         $object->add_pending_tasks($command2);
                                     }
                                 }
                                 $object->save();
                             }
                         }
                     }
                 }
             }
         }
     }
     return $quiet;
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:92,代码来源:interestedParty.inc.php


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