本文整理汇总了PHP中Issue::getAssignedUserIDs方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::getAssignedUserIDs方法的具体用法?PHP Issue::getAssignedUserIDs怎么用?PHP Issue::getAssignedUserIDs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Issue
的用法示例。
在下文中一共展示了Issue::getAssignedUserIDs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$tpl->assign('delete_filter_result', $res);
} elseif ($cat == 'remove_support_email') {
$res = Support::removeAssociation();
$tpl->assign('remove_association_result', $res);
} elseif ($cat == 'delete_attachment') {
$res = Attachment::remove($id);
$tpl->assign('remove_attachment_result', $res);
} elseif ($cat == 'delete_file') {
$res = Attachment::removeIndividualFile($id);
$tpl->assign('remove_file_result', $res);
} elseif ($cat == 'remove_checkin') {
$res = SCM::remove($items);
$tpl->assign('remove_checkin_result', $res);
} elseif ($cat == 'unassign') {
$res = Issue::deleteUserAssociation($iss_id, $usr_id);
Workflow::handleAssignmentChange($prj_id, $iss_id, Auth::getUserID(), Issue::getDetails($iss_id), Issue::getAssignedUserIDs($iss_id));
$tpl->assign('unassign_result', $res);
} elseif ($cat == 'remove_email') {
$res = Support::removeEmails();
$tpl->assign('remove_email_result', $res);
} elseif ($cat == 'clear_duplicate') {
$res = Issue::clearDuplicateStatus($iss_id);
$tpl->assign('clear_duplicate_result', $res);
} elseif ($cat == 'delete_phone') {
$res = Phone_Support::remove($id);
$tpl->assign('delete_phone_result', $res);
} elseif ($cat == 'new_status') {
$res = Issue::setStatus($iss_id, $status_id, true);
if ($res == 1) {
History::add($iss_id, $usr_id, 'status_changed', "Issue manually set to status '{status}' by {user}", array('status' => Status::getStatusTitle($status_id), 'user' => User::getFullName($usr_id)));
}
示例2: dirname
// | 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('self_assign.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$issue_id = $_REQUEST['iss_id'];
$tpl->assign('issue_id', $issue_id);
// check if issue is assigned to someone else and if so, confirm change.
$assigned_user_ids = Issue::getAssignedUserIDs($issue_id);
if (count($assigned_user_ids) > 0 && empty($_REQUEST['target'])) {
$tpl->assign(array('prompt_override' => 1, 'assigned_users' => Issue::getAssignedUsers($issue_id)));
} else {
$issue_details = Issue::getDetails($issue_id);
// force assignment change
if (@$_REQUEST['target'] == 'replace') {
// remove current user(s) first
Issue::deleteUserAssociations($issue_id, $usr_id);
}
$res = Issue::addUserAssociation($usr_id, $issue_id, $usr_id);
$tpl->assign('self_assign_result', $res);
Notification::subscribeUser($usr_id, $issue_id, $usr_id, Notification::getDefaultActions($issue_id, User::getEmail($usr_id), 'self_assign'));
Workflow::handleAssignmentChange($prj_id, $issue_id, $usr_id, $issue_details, Issue::getAssignedUserIDs($issue_id), false);
}
$tpl->assign('current_user_prefs', Prefs::get($usr_id));
$tpl->displayTemplate();
示例3: mayChangeIssue
function mayChangeIssue($p)
{
$email = XML_RPC_decode($p->getParam(0));
$password = XML_RPC_decode($p->getParam(1));
$auth = authenticate($email, $password);
if (is_object($auth)) {
return $auth;
}
$issue_id = XML_RPC_decode($p->getParam(2));
$usr_id = User::getUserIDByEmail($email);
$assignees = Issue::getAssignedUserIDs($issue_id);
if (count($assignees) > 0) {
if (in_array($usr_id, $assignees)) {
return new XML_RPC_Response(XML_RPC_Encode("yes"));
} else {
return new XML_RPC_Response(XML_RPC_Encode("no"));
}
} else {
return new XML_RPC_Response(XML_RPC_Encode("yes"));
}
}
示例4: mayChangeIssue
/**
* TODO: use boolean return
*
* @param int $issue_id
* @return string
* @access protected
*/
public function mayChangeIssue($issue_id)
{
$usr_id = Auth::getUserID();
$assignees = Issue::getAssignedUserIDs($issue_id);
if (count($assignees) > 0) {
if (in_array($usr_id, $assignees)) {
return 'yes';
} else {
return 'no';
}
} else {
return 'yes';
}
}
示例5: perform
/**
* Method used to perform a specific action to an issue.
*
* @access public
* @param integer $issue_id The issue ID
* @param array $reminder The reminder details
* @param array $action The action details
* @return boolean
*/
function perform($issue_id, $reminder, $action)
{
$type = '';
// - see which action type we're talking about here...
$action_type = Reminder_Action::getActionType($action['rma_rmt_id']);
// - do we also need to alert the group leader about this?
$group_leader_usr_id = 0;
if ($action['rma_alert_group_leader']) {
if (Reminder::isDebug()) {
echo " - Processing Group Leader notification\n";
}
$group_id = Issue::getGroupID($issue_id);
// check if there's even a group associated with this issue
if (empty($group_id)) {
if (Reminder::isDebug()) {
echo " - No group associated with issue {$issue_id}\n";
}
} else {
$group_details = Group::getDetails($group_id);
if (!empty($group_details['grp_manager_usr_id'])) {
$group_leader_usr_id = $group_details['grp_manager_usr_id'];
}
}
}
if (Reminder::isDebug()) {
echo " - Performing action '{$action_type}' for issue #{$issue_id}\n";
}
switch ($action_type) {
case 'email_assignee':
$type = 'email';
$assignees = Issue::getAssignedUserIDs($issue_id);
$to = array();
foreach ($assignees as $assignee) {
$to[] = User::getFromHeader($assignee);
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id)) {
$leader_email = User::getFromHeader($group_leader_usr_id);
if (!empty($leader_email) && !in_array($leader_email, $to)) {
$to[] = $leader_email;
}
}
break;
case 'email_list':
$type = 'email';
$list = Reminder_Action::getUserList($action['rma_id']);
$to = array();
foreach ($list as $key => $value) {
// add the recipient to the list if it's a simple email address
if (Validation::isEmail($key)) {
$to[] = $key;
} else {
$to[] = User::getFromHeader($key);
}
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id)) {
$leader_email = User::getFromHeader($group_leader_usr_id);
if (!empty($leader_email) && !in_array($leader_email, $to)) {
$to[] = $leader_email;
}
}
break;
case 'sms_assignee':
$type = 'sms';
$assignees = Issue::getAssignedUserIDs($issue_id);
$to = array();
foreach ($assignees as $assignee) {
if (User::isClockedIn($assignee)) {
$sms_email = User::getSMS($assignee);
if (!empty($sms_email)) {
$to[] = $sms_email;
}
}
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id) && User::isClockedIn($group_leader_usr_id)) {
$leader_sms_email = User::getSMS($group_leader_usr_id);
if (!empty($leader_sms_email) && !in_array($leader_sms_email, $to)) {
$to[] = $leader_sms_email;
}
}
break;
case 'sms_list':
$type = 'sms';
$list = Reminder_Action::getUserList($action['rma_id']);
$to = array();
foreach ($list as $key => $value) {
// add the recipient to the list if it's a simple email address
if (Validation::isEmail($key)) {
$to[] = $key;
//.........这里部分代码省略.........
示例6: elseif
$tpl->assign("delete_filter_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "remove_support_email") {
$res = Support::removeAssociation();
$tpl->assign("remove_association_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "delete_attachment") {
$res = Attachment::remove($HTTP_GET_VARS["id"]);
$tpl->assign("remove_attachment_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "delete_file") {
$res = Attachment::removeIndividualFile($HTTP_GET_VARS["id"]);
$tpl->assign("remove_file_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "remove_checkin") {
$res = SCM::remove();
$tpl->assign("remove_checkin_result", $res);
} elseif (@$HTTP_GET_VARS['cat'] == 'unassign') {
$res = Issue::deleteUserAssociation($HTTP_GET_VARS["iss_id"], $usr_id);
Workflow::handleAssignmentChange($prj_id, $HTTP_GET_VARS["iss_id"], Auth::getUserID(), Issue::getDetails($HTTP_GET_VARS["iss_id"]), Issue::getAssignedUserIDs($HTTP_GET_VARS["iss_id"]));
$tpl->assign('unassign_result', $res);
} elseif (@$HTTP_POST_VARS["cat"] == "remove_email") {
$res = Support::removeEmails();
$tpl->assign("remove_email_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "clear_duplicate") {
$res = Issue::clearDuplicateStatus($HTTP_GET_VARS["iss_id"]);
$tpl->assign("clear_duplicate_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "delete_phone") {
$res = Phone_Support::remove($HTTP_GET_VARS["id"]);
$tpl->assign("delete_phone_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "new_status") {
// XXX: need to call the workflow api in the following function?
$res = Issue::setStatus($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["new_sta_id"], true);
if ($res == 1) {
History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to status '" . Status::getStatusTitle($HTTP_GET_VARS["new_sta_id"]) . "' by " . User::getFullName($usr_id));
示例7: getSpecializedHeaders
/**
* Generates the specialized headers for an email.
*
* @access public
* @param integer $issue_id The issue ID
* @param string $type The type of message this is
* @param string $headers The existing headers of this message.
* @param integer $sender_usr_id The id of the user sending this email.
* @return array An array of specialized headers
*/
function getSpecializedHeaders($issue_id, $type, $headers, $sender_usr_id)
{
$new_headers = array();
if (!empty($issue_id)) {
$prj_id = Issue::getProjectID($issue_id);
if (count(Group::getAssocList($prj_id)) > 0) {
// group issue is currently assigned too
$new_headers['X-Eventum-Group-Issue'] = Group::getName(Issue::getGroupID($issue_id));
// group of whoever is sending this message.
if (empty($sender_usr_id)) {
$new_headers['X-Eventum-Group-Replier'] = $new_headers['X-Eventum-Group-Issue'];
} else {
$new_headers['X-Eventum-Group-Replier'] = Group::getName(User::getGroupID($sender_usr_id));
}
// group of current assignee
$assignees = Issue::getAssignedUserIDs($issue_id);
if (empty($assignees[0])) {
$new_headers['X-Eventum-Group-Assignee'] = '';
} else {
$new_headers['X-Eventum-Group-Assignee'] = @Group::getName(User::getGroupID($assignees[0]));
}
}
if (Customer::hasCustomerIntegration($prj_id)) {
if (empty($support_levels)) {
$support_levels = Customer::getSupportLevelAssocList($prj_id);
}
$customer_id = Issue::getCustomerID($issue_id);
if (!empty($customer_id)) {
$customer_details = Customer::getDetails($prj_id, $customer_id);
$new_headers['X-Eventum-Customer'] = $customer_details['customer_name'];
}
if (count($support_levels) > 0) {
$new_headers['X-Eventum-Level'] = $support_levels[Customer::getSupportLevelID($prj_id, $customer_id)];
}
}
$new_headers['X-Eventum-Category'] = Category::getTitle(Issue::getCategory($issue_id));
$new_headers['X-Eventum-Project'] = Project::getName($prj_id);
}
$new_headers['X-Eventum-Type'] = $type;
return $new_headers;
}
示例8: getOptions
/**
* Returns the options associated with a specific field
*
* @param string $field_name The name of the field
* @param integer $issue_id The ID of the issue
* @return array An array of options for the specified field
*/
private static function getOptions($field_name, $issue_id)
{
$prj_id = Issue::getProjectID($issue_id);
switch ($field_name) {
case 'assignee':
$users = Project::getUserAssocList($prj_id, 'active', User::ROLE_CUSTOMER);
$current_assignees = Issue::getAssignedUserIDs($issue_id);
foreach ($current_assignees as $usr_id) {
if (!isset($users[$usr_id])) {
$users[$usr_id] = User::getFullName($usr_id);
}
asort($users);
}
return $users;
case 'priority':
return Priority::getAssocList($prj_id);
case 'severity':
return Severity::getAssocList($prj_id);
}
return array();
}
示例9: getSpecializedHeaders
/**
* Generates the specialized headers for an email.
*
* @param integer $issue_id The issue ID
* @param string $type The type of message this is
* @param string $headers The existing headers of this message.
* @param integer $sender_usr_id The id of the user sending this email.
* @return array An array of specialized headers
*/
public static function getSpecializedHeaders($issue_id, $type, $headers, $sender_usr_id)
{
$new_headers = array();
if (!empty($issue_id)) {
$prj_id = Issue::getProjectID($issue_id);
if (count(Group::getAssocList($prj_id)) > 0) {
// group issue is currently assigned too
$new_headers['X-Eventum-Group-Issue'] = Group::getName(Issue::getGroupID($issue_id));
// group of whoever is sending this message.
if (empty($sender_usr_id)) {
$new_headers['X-Eventum-Group-Replier'] = $new_headers['X-Eventum-Group-Issue'];
} else {
$new_headers['X-Eventum-Group-Replier'] = Group::getName(User::getGroupID($sender_usr_id));
}
// group of current assignee
$assignees = Issue::getAssignedUserIDs($issue_id);
if (empty($assignees[0])) {
$new_headers['X-Eventum-Group-Assignee'] = '';
} else {
$new_headers['X-Eventum-Group-Assignee'] = @Group::getName(User::getGroupID($assignees[0]));
}
}
if (CRM::hasCustomerIntegration($prj_id)) {
$crm = CRM::getInstance($prj_id);
try {
$customer = $crm->getCustomer(Issue::getCustomerID($issue_id));
$new_headers['X-Eventum-Customer'] = $customer->getName();
} catch (CustomerNotFoundException $e) {
}
try {
$contract = $crm->getContract(Issue::getContractID($issue_id));
$support_level = $contract->getSupportLevel();
if (is_object($support_level)) {
$new_headers['X-Eventum-Level'] = $support_level->getName();
}
} catch (ContractNotFoundException $e) {
}
}
// add assignee header
$new_headers['X-Eventum-Assignee'] = implode(',', User::getEmail(Issue::getAssignedUserIDs($issue_id)));
$new_headers['X-Eventum-Category'] = Category::getTitle(Issue::getCategory($issue_id));
$new_headers['X-Eventum-Project'] = Project::getName($prj_id);
$new_headers['X-Eventum-Priority'] = Priority::getTitle(Issue::getPriority($issue_id));
// handle custom fields
$cf_values = Custom_Field::getValuesByIssue($prj_id, $issue_id);
$cf_titles = Custom_Field::getFieldsToBeListed($prj_id);
foreach ($cf_values as $fld_id => $values) {
// skip empty titles
// TODO: why they are empty?
if (!isset($cf_titles[$fld_id])) {
continue;
}
// skip empty values
if (empty($values)) {
continue;
}
$cf_value = implode(', ', (array) $values);
// value could be empty after multivalued field join
if (empty($cf_value)) {
continue;
}
// convert spaces for header fields
$cf_title = str_replace(' ', '_', $cf_titles[$fld_id]);
$new_headers['X-Eventum-CustomField-' . $cf_title] = $cf_value;
}
}
$new_headers['X-Eventum-Type'] = $type;
return $new_headers;
}
示例10: perform
/**
* Method used to perform a specific action to an issue.
*
* @param integer $issue_id The issue ID
* @param array $reminder The reminder details
* @param array $action The action details
* @return boolean
*/
public static function perform($issue_id, $reminder, $action)
{
$type = '';
// - see which action type we're talking about here...
$action_type = self::getActionType($action['rma_rmt_id']);
// - do we also need to alert the group leader about this?
$group_leader_usr_id = 0;
if ($action['rma_alert_group_leader']) {
if (Reminder::isDebug()) {
echo ' - ' . ev_gettext('Processing Group Leader notification') . "\n";
}
$group_id = Issue::getGroupID($issue_id);
// check if there's even a group associated with this issue
if (empty($group_id)) {
if (Reminder::isDebug()) {
echo ' - ' . ev_gettext('No group associated with issue %1$s', $issue_id) . "\n";
}
} else {
$group_details = Group::getDetails($group_id);
if (!empty($group_details['grp_manager_usr_id'])) {
$group_leader_usr_id = $group_details['grp_manager_usr_id'];
}
}
}
if (Reminder::isDebug()) {
echo ' - ' . ev_gettext('Performing action %1$s for issue # %2$s', $action_type, $issue_id) . "\n";
}
switch ($action_type) {
case 'email_assignee':
$type = 'email';
$assignees = Issue::getAssignedUserIDs($issue_id);
$to = array();
foreach ($assignees as $assignee) {
$to[] = User::getFromHeader($assignee);
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id)) {
$leader_email = User::getFromHeader($group_leader_usr_id);
if (!empty($leader_email) && !in_array($leader_email, $to)) {
$to[] = $leader_email;
}
}
break;
case 'email_list':
$type = 'email';
$list = self::getUserList($action['rma_id']);
$to = array();
foreach ($list as $key => $value) {
// add the recipient to the list if it's a simple email address
if (Validation::isEmail($key)) {
$to[] = $key;
} else {
$to[] = User::getFromHeader($key);
}
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id)) {
$leader_email = User::getFromHeader($group_leader_usr_id);
if (!empty($leader_email) && !in_array($leader_email, $to)) {
$to[] = $leader_email;
}
}
break;
case 'sms_assignee':
$type = 'sms';
$assignees = Issue::getAssignedUserIDs($issue_id);
$to = array();
foreach ($assignees as $assignee) {
if (User::isClockedIn($assignee)) {
$sms_email = User::getSMS($assignee);
if (!empty($sms_email)) {
$to[] = $sms_email;
}
}
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id) && User::isClockedIn($group_leader_usr_id)) {
$leader_sms_email = User::getSMS($group_leader_usr_id);
if (!empty($leader_sms_email) && !in_array($leader_sms_email, $to)) {
$to[] = $leader_sms_email;
}
}
break;
case 'sms_list':
$type = 'sms';
$list = self::getUserList($action['rma_id']);
$to = array();
foreach ($list as $key => $value) {
// add the recipient to the list if it's a simple email address
if (Validation::isEmail($key)) {
$to[] = $key;
} else {
//.........这里部分代码省略.........
示例11: isAssignedToUser
/**
* Method used to see if a user is assigned to an issue.
*
* @access public
* @param integer $issue_id The issue ID
* @param integer $usr_id An integer containg the ID of the user.
* @return boolean true if the user(s) are assigned to the issue.
*/
function isAssignedToUser($issue_id, $usr_id)
{
$assigned_users = Issue::getAssignedUserIDs($issue_id);
if (in_array($usr_id, $assigned_users)) {
return true;
} else {
return false;
}
}
示例12: notifyAssignees
/**
* Send an email to all issue assignees
*
* @param integer $issue_id The ID of the issue
* @param string $type The type of notification to send
* @param array $data Any extra data to pass to the template
*/
public function notifyAssignees($issue_id, $type, $data, $title = '')
{
$prj_id = Issue::getProjectID($issue_id);
$assignees = Issue::getAssignedUserIDs($issue_id);
if (count($assignees) > 0) {
// get issue details
$issue = Issue::getDetails($issue_id);
// open text template
$tpl = new Template_Helper();
$tpl->setTemplate('notifications/' . $type . '.tpl.text');
$tpl->assign(array('app_title' => Misc::getToolCaption(), 'issue' => $issue, 'data' => $data));
foreach ($assignees as $usr_id) {
$usr_email = User::getFromHeader($usr_id);
if (!Workflow::shouldEmailAddress($prj_id, Mail_Helper::getEmailAddress($usr_email))) {
continue;
}
// change the current locale
Language::set(User::getLang($usr_id));
$text_message = $tpl->getTemplateContents();
$from = self::getFixedFromHeader($issue_id, '', 'issue');
$subject = "[#{$issue_id}] {$title}: " . $issue['iss_summary'];
// send email (use PEAR's classes)
$mail = new Mail_Helper();
$mail->setTextBody($text_message);
$mail->setHeaders(Mail_Helper::getBaseThreadingHeaders($issue_id));
$mail->send($from, $usr_email, $subject, true, $issue_id, $type);
}
Language::restore();
}
}
示例13: bulkUpdate
/**
* Method used to bulk update a list of issues
*
* @return boolean
*/
public static function bulkUpdate()
{
// check if user performing this chance has the proper role
if (Auth::getCurrentRole() < User::getRoleID('Manager')) {
return -1;
}
$items = (array) $_POST['item'];
$new_status_id = (int) $_POST['status'];
$new_release_id = (int) $_POST['release'];
$new_priority_id = (int) $_POST['priority'];
$new_category_id = (int) $_POST['category'];
foreach ($items as $issue_id) {
$issue_id = (int) $issue_id;
if (!self::canAccess($issue_id, Auth::getUserID())) {
continue;
}
if (self::getProjectID($issue_id) != Auth::getCurrentProject()) {
// make sure issue is not in another project
continue;
}
$issue_details = Issue::getDetails($issue_id);
$updated_fields = array();
// update assignment
if (count(@$_POST['users']) > 0) {
$users = (array) $_POST['users'];
// get who this issue is currently assigned too
$stmt = 'SELECT
isu_usr_id,
usr_full_name
FROM
{{%issue_user}},
{{%user}}
WHERE
isu_usr_id = usr_id AND
isu_iss_id = ?';
try {
$current_assignees = DB_Helper::getInstance()->getPair($stmt, array($issue_id));
} catch (DbException $e) {
return -1;
}
foreach ($current_assignees as $usr_id => $usr_name) {
if (!in_array($usr_id, $users)) {
self::deleteUserAssociation($issue_id, $usr_id, false);
}
}
$new_user_names = array();
$new_assignees = array();
foreach ($users as $usr_id) {
$usr_id = (int) $usr_id;
$new_user_names[$usr_id] = User::getFullName($usr_id);
// check if the issue is already assigned to this person
$stmt = 'SELECT
COUNT(*) AS total
FROM
{{%issue_user}}
WHERE
isu_iss_id=? AND
isu_usr_id=?';
$total = DB_Helper::getInstance()->getOne($stmt, array($issue_id, $usr_id));
if ($total > 0) {
continue;
} else {
$new_assignees[] = $usr_id;
// add the assignment
self::addUserAssociation(Auth::getUserID(), $issue_id, $usr_id, false);
Notification::subscribeUser(Auth::getUserID(), $issue_id, $usr_id, Notification::getAllActions());
}
}
$prj_id = Auth::getCurrentProject();
$usr_ids = Issue::getAssignedUserIDs($issue_id);
Workflow::handleAssignmentChange($prj_id, $issue_id, Auth::getUserID(), $issue_details, $usr_ids, false);
Notification::notifyNewAssignment($new_assignees, $issue_id);
$updated_fields['Assignment'] = History::formatChanges(implode(', ', $current_assignees), implode(', ', $new_user_names));
}
// update status
if ($new_status_id) {
$old_status_id = self::getStatusID($issue_id);
$res = self::setStatus($issue_id, $new_status_id, false);
if ($res == 1) {
$updated_fields['Status'] = History::formatChanges(Status::getStatusTitle($old_status_id), Status::getStatusTitle($new_status_id));
}
}
// update release
if ($new_release_id) {
$old_release_id = self::getRelease($issue_id);
$res = self::setRelease($issue_id, $new_release_id);
if ($res == 1) {
$updated_fields['Release'] = History::formatChanges(Release::getTitle($old_release_id), Release::getTitle($new_release_id));
}
}
// update priority
if ($new_priority_id) {
$old_priority_id = self::getPriority($issue_id);
$res = self::setPriority($issue_id, $new_priority_id);
if ($res == 1) {
//.........这里部分代码省略.........
示例14:
}
if ($ref_id) {
$stmt = "SELECT\n\t\t\t\ten_ID\n\t\t\t FROM\n\t\t\t\t" . ETEL_USER_TRANS_TABLE_NOSUB . "\n\t\t\t WHERE\n\t\t\t\treference_number='" . Misc::escapeString($ref_id) . "'";
$info = $GLOBALS["db_api"]->dbh->getOne($stmt);
if (PEAR::isError($info)) {
Error_Handler::logError(array($info->getMessage(), $info->getDebugInfo()), __FILE__, __LINE__);
return false;
} else {
$target_usr_id = $info;
$newstatus = 8;
$_REQUEST["target"] = "replace";
}
}
}
// check if issue is assigned to someone else and if so, confirm change.
$assigned_user_ids = Issue::getAssignedUserIDs($issue_id);
if (count($assigned_user_ids) > 0 && empty($_REQUEST["target"]) && !$_REQUEST['assigntomerc']) {
$tpl->assign(array("prompt_override" => 1, "assigned_users" => Issue::getAssignedUsers($issue_id)));
} else {
// force assignment change
if (@$_REQUEST["target"] == "replace") {
// remove current user(s) first
Issue::deleteUserAssociations($issue_id, $usr_id);
}
$res = Issue::addUserAssociation($usr_id, $issue_id, $target_usr_id);
$tpl->assign("self_assign_result", $res);
if ($newstatus) {
$res = Issue::setStatus($issue_id, $newstatus, true);
}
Notification::subscribeUser($usr_id, $issue_id, $target_usr_id, Notification::getDefaultActions());
Workflow::handleAssignment($prj_id, $issue_id, $target_usr_id);
示例15: notifyAssignees
/**
* Send an email to all issue assignees
*
* @access public
* @param integer $issue_id The ID of the issue
* @param string $type The type of notification to send
* @param array $data Any extra data to pass to the template
*/
function notifyAssignees($issue_id, $type, $data, $title = '')
{
$prj_id = Issue::getProjectID($issue_id);
$assignees = Issue::getAssignedUserIDs($issue_id);
if (count($assignees) > 0) {
// get issue details
$issue = Notification::getIssueDetails($issue_id);
// open text template
$tpl = new Template_API();
$tpl->setTemplate('notifications/' . $type . '.tpl.text');
$tpl->bulkAssign(array("app_title" => Misc::getToolCaption(), "issue" => $issue, "data" => $data));
$text_message = $tpl->getTemplateContents();
for ($i = 0; $i < count($assignees); $i++) {
if (!Workflow::shouldEmailAddress($prj_id, Mail_API::getEmailAddress(User::getFromHeader($assignees[$i])))) {
continue;
}
// send email (use PEAR's classes)
$mail = new Mail_API();
$mail->setTextBody($text_message);
$mail->setHeaders(Mail_API::getBaseThreadingHeaders($issue_id));
$mail->send(Notification::getFixedFromHeader($issue_id, '', 'issue'), User::getFromHeader($assignees[$i]), "[#{$issue_id}] {$title}: " . $issue['iss_summary'], TRUE, $issue_id, $type);
}
}
}