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


PHP Support::associate方法代码示例

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


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

示例1: createFromPost

 /**
  * Method used to add a new issue using the normal report form.
  *
  * @return  integer The new issue ID
  */
 public static function createFromPost()
 {
     $keys = array('add_primary_contact', 'attached_emails', 'category', 'contact', 'contact_email', 'contact_extra_emails', 'contact_person_fname', 'contact_person_lname', 'contact_phone', 'contact_timezone', 'contract', 'customer', 'custom_fields', 'description', 'estimated_dev_time', 'group', 'notify_customer', 'notify_senders', 'priority', 'private', 'release', 'severity', 'summary', 'users', 'product', 'product_version', 'expected_resolution_date', 'associated_issues');
     $data = array();
     foreach ($keys as $key) {
         if (isset($_POST[$key])) {
             $data[$key] = $_POST[$key];
         }
     }
     $prj_id = Auth::getCurrentProject();
     $current_usr_id = Auth::getUserID();
     $usr_id = $current_usr_id;
     // if we are creating an issue for a customer, put the
     // main customer contact as the reporter for it
     if (CRM::hasCustomerIntegration($prj_id)) {
         $crm = CRM::getInstance($prj_id);
         $contact_usr_id = User::getUserIDByContactID($data['contact']);
         if (empty($contact_usr_id)) {
             $contact_usr_id = $usr_id;
         }
         $data['reporter'] = $contact_usr_id;
     } else {
         $data['reporter'] = $usr_id;
     }
     $data['msg_id'] = Mail_Helper::generateMessageID();
     $issue_id = self::insertIssue($prj_id, $data);
     if ($issue_id == -1) {
         return -1;
     }
     $has_RR = false;
     $info = User::getNameEmail($usr_id);
     // log the creation of the issue
     History::add($issue_id, $current_usr_id, 'issue_opened', 'Issue opened by {user}', array('user' => User::getFullName($current_usr_id)));
     $clone_iss_id = isset($_POST['clone_iss_id']) ? (int) $_POST['clone_iss_id'] : null;
     if ($clone_iss_id && Access::canCloneIssue($clone_iss_id, $current_usr_id)) {
         History::add($issue_id, $current_usr_id, 'issue_cloned_from', 'Issue cloned from #{issue_id}', array('issue_id' => $clone_iss_id));
         History::add($clone_iss_id, $current_usr_id, 'issue_cloned_to', 'Issue cloned to #{issue_id}', array('issue_id' => $issue_id));
         self::addAssociation($issue_id, $clone_iss_id, $usr_id, true);
     }
     $emails = array();
     if (CRM::hasCustomerIntegration($prj_id)) {
         $customer = $crm->getCustomer($data['customer']);
         $contract = $crm->getContract($data['contract']);
         if (!empty($data['contact_extra_emails']) && count($data['contact_extra_emails']) > 0) {
             $emails = $data['contact_extra_emails'];
         }
         // add the primary contact to the notification list
         if (isset($data['add_primary_contact']) && $data['add_primary_contact'] == 'yes') {
             $contact_email = User::getEmailByContactID($data['contact']);
             if (!empty($contact_email)) {
                 $emails[] = $contact_email;
             }
         }
         // if there are any technical account managers associated with this customer, add these users to the notification list
         $managers = $customer->getEventumAccountManagers();
         foreach ($managers as $manager) {
             $emails[] = $manager['usr_email'];
         }
     }
     // add the reporter to the notification list
     $emails[] = $info['usr_email'];
     $emails = array_unique($emails);
     foreach ($emails as $address) {
         Notification::subscribeEmail($usr_id, $issue_id, $address, Notification::getDefaultActions($issue_id, $address, 'new_issue'));
     }
     // only assign the issue to an user if the associated customer has any technical account managers
     $users = array();
     $has_TAM = false;
     if (CRM::hasCustomerIntegration($prj_id) && count($managers) > 0) {
         foreach ($managers as $manager) {
             if ($manager['cam_type'] == 'intpart') {
                 continue;
             }
             $users[] = $manager['cam_usr_id'];
             self::addUserAssociation($usr_id, $issue_id, $manager['cam_usr_id'], false);
             History::add($issue_id, $usr_id, 'issue_auto_assigned', 'Issue auto-assigned to {assignee} (TAM)', array('assignee' => User::getFullName($manager['cam_usr_id'])));
         }
         $has_TAM = true;
     }
     // now add the user/issue association (aka assignments)
     if (!empty($data['users']) && count($data['users']) > 0) {
         foreach ($data['users'] as $user) {
             $actions = Notification::getDefaultActions($issue_id, User::getEmail($user), 'new_issue');
             Notification::subscribeUser($usr_id, $issue_id, $user, $actions);
             self::addUserAssociation($usr_id, $issue_id, $user);
             if ($user != $usr_id) {
                 $users[] = $user;
             }
         }
     } else {
         // only use the round-robin feature if this new issue was not
         // already assigned to a customer account manager
         if (@count($managers) < 1) {
             $assignee = Round_Robin::getNextAssignee($prj_id);
             // assign the issue to the round robin person
//.........这里部分代码省略.........
开发者ID:dabielkabuto,项目名称:eventum,代码行数:101,代码来源:class.issue.php

示例2: Template_API

// @(#) $Id$
//
include_once "config.inc.php";
include_once APP_INC_PATH . "db_access.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.issue.php";
include_once APP_INC_PATH . "class.note.php";
include_once APP_INC_PATH . "class.support.php";
include_once APP_INC_PATH . "class.mail.php";
$tpl = new Template_API();
$tpl->setTemplate("associate.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
if (@$HTTP_POST_VARS['cat'] == 'associate') {
    if ($HTTP_POST_VARS['target'] == 'email') {
        $res = Support::associate(Auth::getUserID(), $HTTP_POST_VARS['issue'], $HTTP_POST_VARS['item']);
        if ($res == 1) {
            Workflow::handleManualEmailAssociation(Issue::getProjectID($HTTP_POST_VARS['issue']), $HTTP_POST_VARS['issue']);
        }
        $tpl->assign("associate_result", $res);
    } elseif ($HTTP_POST_VARS['target'] == 'reference') {
        $res = Support::associateEmail(Auth::getUserID(), $HTTP_POST_VARS['issue'], $HTTP_POST_VARS['item']);
        if ($res == 1) {
            Workflow::handleManualEmailAssociation(Issue::getProjectID($HTTP_POST_VARS['issue']), $HTTP_POST_VARS['issue']);
        }
        $tpl->assign("associate_result", $res);
    } else {
        for ($i = 0; $i < count($HTTP_POST_VARS['item']); $i++) {
            $email = Support::getEmailDetails(Email_Account::getAccountByEmail($HTTP_POST_VARS['item'][$i]), $HTTP_POST_VARS['item'][$i]);
            // add the message body as a note
            $HTTP_POST_VARS['blocked_msg'] = $email['seb_full_email'];
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:associate.php

示例3: createIssueFromEmail

 /**
  * Creates a new issue from an email if appropriate. Also returns if this message is related
  * to a previous message.
  *
  * @access  private
  * @param   array   $info An array of info about the email account.
  * @param   string  $headers The headers of the email.
  * @param   string  $message_body The body of the message.
  * @param   string  $date The date this message was sent
  * @param   string  $from The name and email address of the sender.
  * @param   string  $subject The subject of this message.
  * @return  array   An array of information about the message
  */
 function createIssueFromEmail($info, $headers, $message_body, $date, $from, $subject)
 {
     $should_create_issue = false;
     $issue_id = '';
     $associate_email = '';
     $type = 'email';
     $parent_id = '';
     // we can't trust the in-reply-to from the imap c-client, so let's
     // try to manually parse that value from the full headers
     $references = Mail_API::getAllReferences($headers);
     $message_id = Mail_API::getMessageID($headers, $message_body);
     $setup = Setup::load();
     if (@$setup['subject_based_routing']['status'] == 'enabled' && preg_match("/\\[#(\\d+)\\]( Note| BLOCKED)*/", $subject, $matches)) {
         $should_create_issue = false;
         $issue_id = $matches[1];
         if (!Issue::exists($issue_id, false)) {
             $issue_id = '';
         } elseif (!empty($matches[2])) {
             $type = 'note';
         }
     } else {
         // - if this email is a reply:
         if (count($references) > 0) {
             foreach ($references as $reference_msg_id) {
                 //  -> check if the replied email exists in the database:
                 if (Note::exists($reference_msg_id)) {
                     // note exists
                     // get what issue it belongs too.
                     $issue_id = Note::getIssueByMessageID($reference_msg_id);
                     $should_create_issue = false;
                     $type = 'note';
                     $parent_id = Note::getIDByMessageID($reference_msg_id);
                     break;
                 } elseif (Support::exists($reference_msg_id) || Issue::getIssueByRootMessageID($reference_msg_id) != false) {
                     // email or issue exists
                     $issue_id = Support::getIssueByMessageID($reference_msg_id);
                     if (empty($issue_id)) {
                         $issue_id = Issue::getIssueByRootMessageID($reference_msg_id);
                     }
                     if (empty($issue_id)) {
                         // parent email isn't associated with issue.
                         //      --> create new issue, associate current email and replied email to this issue
                         $should_create_issue = true;
                         $associate_email = $reference_msg_id;
                     } else {
                         // parent email is associated with issue:
                         //      --> associate current email with existing issue
                         $should_create_issue = false;
                     }
                     break;
                 } else {
                     //  no matching note, email or issue:
                     //    => create new issue and associate current email with it
                     $should_create_issue = true;
                 }
             }
         } else {
             // - if this email is not a reply:
             //  -> create new issue and associate current email with it
             $should_create_issue = true;
         }
         if (empty($issue_id)) {
             $issue_id = Issue::getIssueBy($subject, 'iss_summary');
             if (!empty($issue_id)) {
                 $should_create_issue = false;
             }
         }
     }
     $sender_email = Mail_API::getEmailAddress($from);
     // only create a new issue if this email is coming from a known customer
     if ($should_create_issue && $info['ema_issue_auto_creation_options']['only_known_customers'] == 'yes' && Customer::hasCustomerIntegration($info['ema_prj_id'])) {
         list($customer_id, ) = Customer::getCustomerIDByEmails($info['ema_prj_id'], array($sender_email));
         if (empty($customer_id)) {
             $should_create_issue = false;
         }
     }
     // check whether we need to create a new issue or not
     if ($info['ema_issue_auto_creation'] == 'enabled' && $should_create_issue) {
         $options = Email_Account::getIssueAutoCreationOptions($info['ema_id']);
         Auth::createFakeCookie(APP_SYSTEM_USER_ID, $info['ema_prj_id']);
         $issue_id = Issue::createFromEmail($info['ema_prj_id'], APP_SYSTEM_USER_ID, $from, Mime_Helper::fixEncoding($subject), $message_body, @$options['category'], $options['priority'], @$options['users'], $date, $message_id);
         // associate any existing replied-to email with this new issue
         if (!empty($associate_email) && !empty($reference_issue_id)) {
             $reference_sup_id = Support::getIDByMessageID($associate_email);
             Support::associate(APP_SYSTEM_USER_ID, $issue_id, array($reference_sup_id));
         }
     }
//.........这里部分代码省略.........
开发者ID:juliogallardo1326,项目名称:proc,代码行数:101,代码来源:class.support.php

示例4: dirname

// | You should have received a copy of the GNU General Public License    |
// | along with this program; if not, write to:                           |
// |                                                                      |
// | Free Software Foundation, Inc.                                       |
// | 51 Franklin Street, Suite 330                                          |
// | Boston, MA 02110-1301, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com>                             |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('associate.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
if (@$_POST['cat'] == 'associate') {
    if ($_POST['target'] == 'email') {
        $res = Support::associate(Auth::getUserID(), $_POST['issue_id'], $_POST['item']);
        if ($res == 1) {
            Workflow::handleManualEmailAssociation(Issue::getProjectID($_POST['issue_id']), $_POST['issue_id']);
        }
        $tpl->assign('associate_result', $res);
    } elseif ($_POST['target'] == 'reference') {
        $res = Support::associateEmail(Auth::getUserID(), $_POST['issue_id'], $_POST['item']);
        if ($res == 1) {
            Workflow::handleManualEmailAssociation(Issue::getProjectID($_POST['issue_id']), $_POST['issue_id']);
        }
        $tpl->assign('associate_result', $res);
    } else {
        foreach ($_POST['item'] as $item) {
            $email = Support::getEmailDetails(Email_Account::getAccountByEmail($item), $item);
            // add the message body as a note
            $_POST['full_message'] = $email['seb_full_email'];
开发者ID:korusdipl,项目名称:eventum,代码行数:31,代码来源:associate.php

示例5: insert


//.........这里部分代码省略.........
         $actions = Notification::getDefaultActions();
         foreach ($emails as $address) {
             Notification::subscribeEmail($usr_id, $new_issue_id, $address, $actions);
         }
         // only assign the issue to an user if the associated customer has any technical account managers
         $users = array();
         $has_TAM = false;
         if (Customer::hasCustomerIntegration($prj_id) && count($manager_usr_ids) > 0) {
             foreach ($manager_usr_ids as $manager_usr_id) {
                 $users[] = $manager_usr_id;
                 Issue::addUserAssociation($usr_id, $new_issue_id, $manager_usr_id, false);
                 History::add($new_issue_id, $usr_id, History::getTypeID('issue_auto_assigned'), 'Issue auto-assigned to ' . User::getFullName($manager_usr_id) . ' (TAM)');
             }
             $has_TAM = true;
         }
         // now add the user/issue association (aka assignments)
         if (@count($HTTP_POST_VARS["users"]) > 0) {
             for ($i = 0; $i < count($HTTP_POST_VARS["users"]); $i++) {
                 Notification::subscribeUser($usr_id, $new_issue_id, $HTTP_POST_VARS["users"][$i], $actions);
                 Issue::addUserAssociation($usr_id, $new_issue_id, $HTTP_POST_VARS["users"][$i]);
                 if ($HTTP_POST_VARS["users"][$i] != $usr_id) {
                     $users[] = $HTTP_POST_VARS["users"][$i];
                 }
             }
         } else {
             // only use the round-robin feature if this new issue was not
             // already assigned to a customer account manager
             if (@count($manager_usr_ids) < 1) {
                 $assignee = Round_Robin::getNextAssignee($prj_id);
                 // assign the issue to the round robin person
                 if (!empty($assignee)) {
                     $users[] = $assignee;
                     Issue::addUserAssociation($usr_id, $new_issue_id, $assignee, false);
                     History::add($new_issue_id, APP_SYSTEM_USER_ID, History::getTypeID('rr_issue_assigned'), 'Issue auto-assigned to ' . User::getFullName($assignee) . ' (RR)');
                     $has_RR = true;
                 }
             }
         }
         // now process any files being uploaded
         $found = 0;
         for ($i = 0; $i < count(@$HTTP_POST_FILES["file"]["name"]); $i++) {
             if (!@empty($HTTP_POST_FILES["file"]["name"][$i])) {
                 $found = 1;
                 break;
             }
         }
         if ($found) {
             $files = array();
             for ($i = 0; $i < count($HTTP_POST_FILES["file"]["name"]); $i++) {
                 $filename = @$HTTP_POST_FILES["file"]["name"][$i];
                 if (empty($filename)) {
                     continue;
                 }
                 $blob = Misc::getFileContents($HTTP_POST_FILES["file"]["tmp_name"][$i]);
                 if (empty($blob)) {
                     // error reading a file
                     $insert_errors["file[{$i}]"] = "There was an error uploading the file '{$filename}'.";
                     continue;
                 }
                 $files[] = array("filename" => $filename, "type" => $HTTP_POST_FILES['file']['type'][$i], "blob" => $blob);
             }
             if (count($files) > 0) {
                 $attachment_id = Attachment::add($new_issue_id, $usr_id, 'Files uploaded at issue creation time');
                 foreach ($files as $file) {
                     Attachment::addFile($attachment_id, $new_issue_id, $file["filename"], $file["type"], $file["blob"]);
                 }
             }
         }
         // need to associate any emails ?
         if (!empty($HTTP_POST_VARS["attached_emails"])) {
             $items = explode(",", $HTTP_POST_VARS["attached_emails"]);
             Support::associate($usr_id, $new_issue_id, $items, true);
         }
         // need to notify any emails being converted into issues ?
         if (@count($HTTP_POST_VARS["notify_senders"]) > 0) {
             $recipients = Notification::notifyEmailConvertedIntoIssue($prj_id, $new_issue_id, $HTTP_POST_VARS["notify_senders"], $customer_id);
         } else {
             $recipients = array();
         }
         // need to process any custom fields ?
         if (@count($HTTP_POST_VARS["custom_fields"]) > 0) {
             foreach ($HTTP_POST_VARS["custom_fields"] as $fld_id => $value) {
                 Custom_Field::associateIssue($new_issue_id, $fld_id, $value);
             }
         }
         // also send a special confirmation email to the customer contact
         if (@$HTTP_POST_VARS['notify_customer'] == 'yes' && !empty($HTTP_POST_VARS['contact'])) {
             // also need to pass the list of sender emails already notified,
             // so we can avoid notifying the same person again
             $contact_email = User::getEmailByContactID($HTTP_POST_VARS['contact']);
             if (@(!in_array($contact_email, $recipients))) {
                 Customer::notifyCustomerIssue($prj_id, $new_issue_id, $HTTP_POST_VARS['contact']);
             }
         }
         Workflow::handleNewIssue($prj_id, $new_issue_id, $has_TAM, $has_RR);
         // also notify any users that want to receive emails anytime a new issue is created
         Notification::notifyNewIssue($prj_id, $new_issue_id);
         return $new_issue_id;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:101,代码来源:class.issue.php


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