本文整理汇总了PHP中Notification::notifyAutoCreatedIssue方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::notifyAutoCreatedIssue方法的具体用法?PHP Notification::notifyAutoCreatedIssue怎么用?PHP Notification::notifyAutoCreatedIssue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::notifyAutoCreatedIssue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addExtraRecipientsToNotificationList
public function addExtraRecipientsToNotificationList($prj_id, $email, $is_auto_created = false)
{
if (empty($email['to']) && !empty($email['sup_to'])) {
$email['to'] = $email['sup_to'];
}
if (empty($email['cc']) && !empty($email['sup_cc'])) {
$email['cc'] = $email['sup_cc'];
}
$project_details = Project::getDetails($prj_id);
$addresses_not_too_add = explode(',', strtolower($project_details['prj_mail_aliases']));
array_push($addresses_not_too_add, $project_details['prj_outgoing_sender_email']);
$addresses = array();
$to_addresses = Mail_Helper::getEmailAddresses(@$email['to']);
if (count($to_addresses)) {
$addresses = $to_addresses;
}
$cc_addresses = Mail_Helper::getEmailAddresses(@$email['cc']);
if (count($cc_addresses)) {
$addresses = array_merge($addresses, $cc_addresses);
}
$subscribers = Notification::getSubscribedEmails($email['issue_id']);
foreach ($addresses as $address) {
$address = strtolower($address);
if (!in_array($address, $subscribers) && !in_array($address, $addresses_not_too_add)) {
Notification::subscribeEmail(Auth::getUserID(), $email['issue_id'], $address, Notification::getDefaultActions($email['issue_id'], $address, 'add_extra_recipients'));
if ($is_auto_created) {
Notification::notifyAutoCreatedIssue($prj_id, $email['issue_id'], $email['from'], $email['date'], $email['subject'], $address);
}
}
}
}
示例2: createFromEmail
//.........这里部分代码省略.........
$data['contact_person_fname'] = $contact['first_name'];
$data['contact_email'] = $sender_email;
$data['contact_phone'] = $contact['phone'];
$data['contact_timezone'] = Date_Helper::getPreferredTimezone($reporter);
} catch (ContactNotFoundException $e) {
}
try {
if ($contract_id != false) {
$contract = $crm->getContract($contract_id);
$data['contract'] = $contract->getContractID();
} elseif (isset($contact)) {
// Just use first contract / customer for now.
$contracts = $contact->getContracts(array('active' => true));
$contract = $contracts[0];
$data['contract'] = $contract->getContractID();
}
} catch (ContractNotFoundException $e) {
}
try {
if ($customer_id != false) {
$customer = $crm->getCustomer($customer_id);
$data['customer'] = $customer->getCustomerID();
} elseif (isset($contract)) {
$customer = $contract->getCustomer();
$data['customer'] = $customer->getCustomerID();
}
} catch (CustomerNotFoundException $e) {
}
} else {
}
if (empty($reporter)) {
$reporter = APP_SYSTEM_USER_ID;
}
$data['reporter'] = $reporter;
$issue_id = self::insertIssue($prj_id, $data);
if ($issue_id == -1) {
return -1;
}
$has_RR = false;
// log the creation of the issue
History::add($issue_id, $usr_id, 'issue_opened', 'Issue opened by {sender}', array('sender' => $sender));
$emails = array();
// if there are any technical account managers associated with this customer, add these users to the notification list
if ($data['customer']) {
$managers = CRM::getAccountManagers($prj_id, $data['customer']);
foreach ($managers as $manager) {
$emails[] = $manager['usr_email'];
}
}
// add the reporter to the notification list
$emails[] = $sender;
$emails = array_unique($emails);
$actions = Notification::getDefaultActions($issue_id, false, 'issue_from_email');
foreach ($emails as $address) {
Notification::subscribeEmail($reporter, $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 (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
if (@count($assignment) > 0) {
foreach ($assignment as $ass_usr_id) {
Notification::subscribeUser($reporter, $issue_id, $ass_usr_id, $actions);
self::addUserAssociation(APP_SYSTEM_USER_ID, $issue_id, $ass_usr_id);
if ($ass_usr_id != $usr_id) {
$users[] = $ass_usr_id;
}
}
} 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
if (!empty($assignee)) {
self::addUserAssociation(APP_SYSTEM_USER_ID, $issue_id, $assignee, false);
History::add($issue_id, APP_SYSTEM_USER_ID, 'rr_issue_assigned', 'Issue auto-assigned to {assignee} (RR)', array('assignee' => User::getFullName($assignee)));
$users[] = $assignee;
$has_RR = true;
}
}
}
Workflow::handleNewIssue($prj_id, $issue_id, $has_TAM, $has_RR);
// send special 'an issue was auto-created for you' notification back to the sender
Notification::notifyAutoCreatedIssue($prj_id, $issue_id, $sender, $date, $summary);
// also notify any users that want to receive emails anytime a new issue is created
Notification::notifyNewIssue($prj_id, $issue_id, $exclude_list);
return $issue_id;
}
示例3: createFromEmail
//.........这里部分代码省略.........
}
} else {
$customer_id = FALSE;
}
$initial_status = Project::getInitialStatus($prj_id);
// add new issue
$stmt = "INSERT INTO\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n (\n iss_prj_id,\n";
if (!empty($category)) {
$stmt .= "iss_prc_id,\n";
}
$stmt .= "iss_pri_id,\n iss_usr_id,";
if (!empty($initial_status)) {
$stmt .= "iss_sta_id,";
}
if (!empty($customer_id)) {
$stmt .= "\n iss_customer_id,\n iss_customer_contact_id,\n iss_contact_person_lname,\n iss_contact_person_fname,\n iss_contact_email,\n iss_contact_phone,\n iss_contact_timezone,";
}
$stmt .= "\n iss_created_date,\n iss_last_public_action_date,\n iss_last_public_action_type,\n iss_summary,\n iss_description,\n iss_root_message_id\n ) VALUES (\n " . $prj_id . ",\n";
if (!empty($category)) {
$stmt .= Misc::escapeInteger($category) . ",\n";
}
$stmt .= Misc::escapeInteger($priority) . ",\n " . Misc::escapeInteger($reporter) . ",";
if (!empty($initial_status)) {
$stmt .= Misc::escapeInteger($initial_status) . ",";
}
if (!empty($customer_id)) {
$stmt .= "\n " . Misc::escapeInteger($customer_id) . ",\n " . Misc::escapeInteger($customer_contact_id) . ",\n '" . Misc::escapeString($contact['last_name']) . "',\n '" . Misc::escapeString($contact['first_name']) . "',\n '" . Misc::escapeString($sender_email) . "',\n '" . Misc::escapeString($contact['phone']) . "',\n '" . Misc::escapeString($contact_timezone) . "',";
}
$stmt .= "\n '" . Date_API::getCurrentDateGMT() . "',\n '" . Date_API::getCurrentDateGMT() . "',\n 'created',\n '" . Misc::escapeString($summary) . "',\n '" . Misc::escapeString($description) . "',\n '" . Misc::escapeString($msg_id) . "'\n )";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
$new_issue_id = $GLOBALS["db_api"]->get_last_insert_id();
$has_TAM = false;
$has_RR = false;
// log the creation of the issue
History::add($new_issue_id, $usr_id, History::getTypeID('issue_opened'), 'Issue opened by ' . $sender);
$emails = array();
$manager_usr_ids = array();
if (Customer::hasCustomerIntegration($prj_id) && !empty($customer_id)) {
// if there are any technical account managers associated with this customer, add these users to the notification list
$managers = Customer::getAccountManagers($prj_id, $customer_id);
$manager_usr_ids = array_keys($managers);
$manager_emails = array_values($managers);
$emails = array_merge($emails, $manager_emails);
}
// add the reporter to the notification list
$emails[] = $sender;
$emails = array_unique($emails);
// COMPAT: version >= 4.0.1
$actions = Notification::getDefaultActions();
foreach ($emails as $address) {
Notification::subscribeEmail($reporter, $new_issue_id, $address, $actions);
}
// only assign the issue to an user if the associated customer has any technical account managers
$users = array();
if (Customer::hasCustomerIntegration($prj_id) && count($manager_usr_ids) > 0) {
foreach ($manager_usr_ids as $manager_usr_id) {
$users[] = $manager_usr_id;
Issue::addUserAssociation(APP_SYSTEM_USER_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
if (@count($assignment) > 0) {
for ($i = 0; $i < count($assignment); $i++) {
Notification::subscribeUser($reporter, $new_issue_id, $assignment[$i], $actions);
Issue::addUserAssociation(APP_SYSTEM_USER_ID, $new_issue_id, $assignment[$i]);
if ($assignment[$i] != $usr_id) {
$users[] = $assignment[$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)) {
Issue::addUserAssociation(APP_SYSTEM_USER_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)');
$users[] = $assignee;
$has_RR = true;
}
}
}
if (count($users) > 0) {
$has_assignee = true;
}
// send special 'an issue was auto-created for you' notification back to the sender
Notification::notifyAutoCreatedIssue($prj_id, $new_issue_id, $sender, $date, $summary);
// also notify any users that want to receive emails anytime a new issue is created
Notification::notifyNewIssue($prj_id, $new_issue_id, $exclude_list);
Workflow::handleNewIssue($prj_id, $new_issue_id, $has_TAM, $has_RR);
return $new_issue_id;
}
}