// | 51 Franklin Street, Suite 330 | // | Boston, MA 02110-1301, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ 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();
function takeIssue($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)); $project_id = XML_RPC_decode($p->getParam(3)); createFakeCookie($email, Issue::getProjectID($issue_id)); // check if issue currently is un-assigned $current_assignees = Issue::getAssignedUsers($issue_id); if (count($current_assignees) > 0) { return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "Issue is currently assigned to " . join(',', $current_assignees)); } $usr_id = User::getUserIDByEmail($email); // check if the assignee is even allowed to be in the given project $projects = Project::getRemoteAssocListByUser($usr_id); if (!in_array($project_id, array_keys($projects))) { return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "The selected developer is not permitted in the project associated with issue #{$issue_id}"); } $res = Issue::remoteAssign($issue_id, $usr_id, $usr_id); if ($res == -1) { return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "Could not assign issue #{$issue_id} to {$email}"); } else { $res = Issue::setRemoteStatus($issue_id, $usr_id, "Assigned"); if ($res == -1) { return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "Could not set status for issue #{$issue_id}"); } return new XML_RPC_Response(XML_RPC_Encode('OK')); } }
/** * @param int $issue_id * @param int $project_id * @return string * @access protected */ public function takeIssue($issue_id, $project_id) { AuthCookie::setProjectCookie(Issue::getProjectID($issue_id)); // check if issue currently is un-assigned $current_assignees = Issue::getAssignedUsers($issue_id); if (count($current_assignees) > 0) { throw new RemoteApiException('Issue is currently assigned to ' . implode(',', $current_assignees)); } $usr_id = Auth::getUserID(); // check if the assignee is even allowed to be in the given project $projects = Project::getRemoteAssocListByUser($usr_id); if (!in_array($project_id, array_keys($projects))) { throw new RemoteApiException("The selected developer is not permitted in the project associated with issue #{$issue_id}"); } $res = Issue::remoteAssign($issue_id, $usr_id, $usr_id); if ($res == -1) { $email = User::getEmail($usr_id); throw new RemoteApiException("Could not assign issue #{$issue_id} to {$email}"); } $res = Issue::setRemoteStatus($issue_id, $usr_id, 'Assigned'); if ($res == -1) { throw new RemoteApiException("Could not set status for issue #{$issue_id}"); } return 'OK'; }
/** * 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; } else { // otherwise, check for the clocked-in status if (User::isClockedIn($key)) { $sms_email = User::getSMS($key); 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; } $data = Notification::getIssueDetails($issue_id); $conditions = Reminder_Condition::getAdminList($action['rma_id']); // alert IRC if needed if ($action['rma_alert_irc']) { if (Reminder::isDebug()) { echo " - Processing IRC notification\n"; } $irc_notice = "Issue #{$issue_id} (Priority: " . $data['pri_title']; // also add information about the assignee, if any $assignment = Issue::getAssignedUsers($issue_id); if (count($assignment) > 0) { $irc_notice .= "; Assignment: " . implode(', ', $assignment); } if (!empty($data['iss_grp_id'])) { $irc_notice .= "; Group: " . Group::getName($data['iss_grp_id']); } $irc_notice .= "), Reminder action '" . $action['rma_title'] . "' was just triggered"; Notification::notifyIRC(Issue::getProjectID($issue_id), $irc_notice, $issue_id); } $setup = Setup::load(); // if there are no recipients, then just skip to the next action if (count($to) == 0) { if (Reminder::isDebug()) { echo " - No recipients could be found\n"; } // if not even an irc alert was sent, then save // a notice about this on reminder_sent@, if needed if (!$action['rma_alert_irc']) { if (@$setup['email_reminder']['status'] == 'enabled') { Reminder_Action::_recordNoRecipientError($issue_id, $type, $reminder, $action); } return false; } } // - save a history entry about this action Reminder_Action::saveHistory($issue_id, $action['rma_id']); // - save this action as the latest triggered one for the given issue ID Reminder_Action::recordLastTriggered($issue_id, $action['rma_id']); // - perform the action if (count($to) > 0) { // send a copy of this reminder to reminder_sent@, if needed if (@$setup['email_reminder']['status'] == 'enabled' && !empty($setup['email_reminder']['addresses'])) { $addresses = Reminder::_getReminderAlertAddresses(); if (count($addresses) > 0) { $to = array_merge($to, $addresses); } } $tpl = new Template_API(); $tpl->setTemplate('reminders/' . $type . '_alert.tpl.text'); $tpl->bulkAssign(array("data" => $data, "reminder" => $reminder, "action" => $action, "conditions" => $conditions, "has_customer_integration" => Customer::hasCustomerIntegration(Issue::getProjectID($issue_id)))); $text_message = $tpl->getTemplateContents(); foreach ($to as $address) { // send email (use PEAR's classes) $mail = new Mail_API(); $mail->setTextBody($text_message); $setup = $mail->getSMTPSettings(); $mail->send($setup["from"], $address, "[#{$issue_id}] Reminder: " . $action['rma_title'], 0, $issue_id, 'reminder'); } } // - eventum saves the day once again return true; }
/** * 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 { // otherwise, check for the clocked-in status if (User::isClockedIn($key)) { $sms_email = User::getSMS($key); 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; } $data = Issue::getDetails($issue_id); $conditions = Reminder_Condition::getAdminList($action['rma_id']); // alert IRC if needed if ($action['rma_alert_irc']) { if (Reminder::isDebug()) { echo " - Processing IRC notification\n"; } $irc_notice = "Issue #{$issue_id} ("; if (!empty($data['pri_title'])) { $irc_notice .= 'Priority: ' . $data['pri_title']; } if (!empty($data['sev_title'])) { $irc_notice .= 'Severity: ' . $data['sev_title']; } // also add information about the assignee, if any $assignment = Issue::getAssignedUsers($issue_id); if (count($assignment) > 0) { $irc_notice .= '; Assignment: ' . implode(', ', $assignment); } if (!empty($data['iss_grp_id'])) { $irc_notice .= '; Group: ' . Group::getName($data['iss_grp_id']); } $irc_notice .= "), Reminder action '" . $action['rma_title'] . "' was just triggered; " . $action['rma_boilerplate']; Notification::notifyIRC(Issue::getProjectID($issue_id), $irc_notice, $issue_id, false, APP_EVENTUM_IRC_CATEGORY_REMINDER); } $setup = Setup::get(); // if there are no recipients, then just skip to the next action if (count($to) == 0) { if (Reminder::isDebug()) { echo " - No recipients could be found\n"; } // if not even an irc alert was sent, then save // a notice about this on reminder_sent@, if needed if (!$action['rma_alert_irc']) { if ($setup['email_reminder']['status'] == 'enabled') { self::_recordNoRecipientError($issue_id, $type, $reminder, $action, $data, $conditions); } return false; } } // - save a history entry about this action self::saveHistory($issue_id, $action['rma_id']); // - save this action as the latest triggered one for the given issue ID self::recordLastTriggered($issue_id, $action['rma_id']); // - perform the action if (count($to) > 0) { // send a copy of this reminder to reminder_sent@, if needed if ($setup['email_reminder']['status'] == 'enabled' && $setup['email_reminder']['addresses']) { $addresses = Reminder::_getReminderAlertAddresses(); if (count($addresses) > 0) { $to = array_merge($to, $addresses); } } $tpl = new Template_Helper(); $tpl->setTemplate('reminders/' . $type . '_alert.tpl.text'); $tpl->assign(array('data' => $data, 'reminder' => $reminder, 'action' => $action, 'conditions' => $conditions, 'has_customer_integration' => CRM::hasCustomerIntegration(Issue::getProjectID($issue_id)))); $text_message = $tpl->getTemplateContents(); foreach ($to as $address) { // send email (use PEAR's classes) $mail = new Mail_Helper(); $mail->setTextBody($text_message); $setup = $mail->getSMTPSettings(); // TRANSLATORS: %1 - issue_id, %2 - rma_title $subject = ev_gettext('[#%1$s] Reminder: %2$s', $issue_id, $action['rma_title']); $mail->send($setup['from'], $address, $subject, 0, $issue_id, 'reminder'); } } // - eventum saves the day once again return true; }
/** * Method used to get the details for a specific issue. * * @access public * @param integer $issue_id The issue ID * @param boolean $force_refresh If the cache should not be used. * @return array The details for the specified issue */ function getDetails($issue_id, $force_refresh = false) { global $HTTP_SERVER_VARS; static $returns; $issue_id = Misc::escapeInteger($issue_id); if (empty($issue_id)) { return ''; } if (!empty($returns[$issue_id]) && $force_refresh != true) { return $returns[$issue_id]; } $stmt = "SELECT\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue.*,\n prj_title,\n prc_title,\n pre_title,\n pri_title,\n sta_title,\n sta_abbreviation,\n sta_color status_color,\n sta_is_closed,\n\t\t\t\t\tsup_id as last_sup_id,\n\t\t\t\t\tseb_body as last_seb_body,\n\t\t\t\t\tema_id,\n\t\t\t\t\ten_email as reporter_email\n FROM\n (\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project\n )\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_priority\n ON\n iss_pri_id=pri_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status\n ON\n iss_sta_id=sta_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_category\n ON\n iss_prc_id=prc_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_release\n ON\n iss_pre_id=pre_id\n LEFT JOIN\n " . ETEL_USER_TABLE_NOSUB . "\n ON\n iss_usr_id=en_ID\n LEFT JOIN\n (\n\t\t\t\t\t\tSelect sup_id,sup_iss_id,seb_body\n\t\t\t\t\t\tfrom " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email\n\t\t\t\t\t\tleft join " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email_body on seb_sup_id = sup_id \n\t\t\t\t\t\twhere sup_iss_id = {$issue_id} order by sup_date desc\n\t\t\t\t\t) as sup\n ON\n sup_iss_id = iss_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_account\n ON\n ema_prj_id = iss_prj_id\n WHERE\n iss_id={$issue_id} AND\n iss_prj_id=prj_id"; $res = $GLOBALS["db_api"]->dbh->getRow($stmt, DB_FETCHMODE_ASSOC); if (PEAR::isError($res)) { Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); return ""; } else { if (empty($res)) { return ""; } else { $created_date_ts = Date_API::getUnixTimestamp($res['iss_created_date'], Date_API::getDefaultTimezone()); // get customer information, if any if (!empty($res['iss_customer_id']) && Customer::hasCustomerIntegration($res['iss_prj_id'])) { $res['customer_business_hours'] = Customer::getBusinessHours($res['iss_prj_id'], $res['iss_customer_id']); $res['contact_local_time'] = Date_API::getFormattedDate(Date_API::getCurrentDateGMT(), $res['iss_contact_timezone']); $res['customer_info'] = Customer::getDetails($res['iss_prj_id'], $res['iss_customer_id']); $res['redeemed_incidents'] = Customer::getRedeemedIncidentDetails($res['iss_prj_id'], $res['iss_id']); $max_first_response_time = Customer::getMaximumFirstResponseTime($res['iss_prj_id'], $res['iss_customer_id']); $res['max_first_response_time'] = Misc::getFormattedTime($max_first_response_time / 60); if (empty($res['iss_first_response_date'])) { $first_response_deadline = $created_date_ts + $max_first_response_time; if (Date_API::getCurrentUnixTimestampGMT() <= $first_response_deadline) { $res['max_first_response_time_left'] = Date_API::getFormattedDateDiff($first_response_deadline, Date_API::getCurrentUnixTimestampGMT()); } else { $res['overdue_first_response_time'] = Date_API::getFormattedDateDiff(Date_API::getCurrentUnixTimestampGMT(), $first_response_deadline); } } } $res['iss_original_description'] = $res["iss_description"]; if (!strstr($HTTP_SERVER_VARS["PHP_SELF"], 'update.php')) { $res["iss_description"] = nl2br(htmlspecialchars($res["iss_description"])); $res["iss_resolution"] = Resolution::getTitle($res["iss_res_id"]); } $res["iss_impact_analysis"] = nl2br(htmlspecialchars($res["iss_impact_analysis"])); $res["iss_created_date"] = Date_API::getFormattedDate($res["iss_created_date"]); $res['iss_created_date_ts'] = $created_date_ts; $res["assignments"] = @implode(", ", array_values(Issue::getAssignedUsers($res["iss_id"]))); list($res['authorized_names'], $res['authorized_repliers']) = Authorized_Replier::getAuthorizedRepliers($res["iss_id"]); $temp = Issue::getAssignedUsersStatus($res["iss_id"]); $res["has_inactive_users"] = 0; $res["assigned_users"] = array(); $res["assigned_inactive_users"] = array(); foreach ($temp as $usr_id => $usr_status) { if (!User::isActiveStatus($usr_status)) { $res["assigned_inactive_users"][] = $usr_id; $res["has_inactive_users"] = 1; } else { $res["assigned_users"][] = $usr_id; } } if (@in_array(Auth::getUserID(), $res["assigned_users"])) { $res["is_current_user_assigned"] = 1; } else { $res["is_current_user_assigned"] = 0; } $res["associated_issues_details"] = Issue::getAssociatedIssuesDetails($res["iss_id"]); $res["associated_issues"] = Issue::getAssociatedIssues($res["iss_id"]); $res["reporter"] = User::getFullName($res["iss_usr_id"]); $res["email_list_details"] = Support::getFirstEmailer($issue_id); if (!$res["reporter"]) { $first_emailer = Support::getFirstEmailer($issue_id); $res["reporter"] = $first_emailer . " (No Account)"; $res["reporter_email"] = preg_replace('/.*<|>/', '', $first_emailer); } if (empty($res["iss_updated_date"])) { $res["iss_updated_date"] = 'not updated yet'; } else { $res["iss_updated_date"] = Date_API::getFormattedDate($res["iss_updated_date"]); } $res["estimated_formatted_time"] = Misc::getFormattedTime($res["iss_dev_time"]); if (Release::isAssignable($res["iss_pre_id"])) { $release = Release::getDetails($res["iss_pre_id"]); $res["pre_title"] = $release["pre_title"]; $res["pre_status"] = $release["pre_status"]; } // need to return the list of issues that are duplicates of this one $res["duplicates"] = Issue::getDuplicateList($res["iss_id"]); $res["duplicates_details"] = Issue::getDuplicateDetailsList($res["iss_id"]); // also get the issue title of the duplicated issue if (!empty($res['iss_duplicated_iss_id'])) { $res['duplicated_issue'] = Issue::getDuplicatedDetails($res['iss_duplicated_iss_id']); } // get group information if (!empty($res["iss_grp_id"])) { $res["group"] = Group::getDetails($res["iss_grp_id"]); } // get quarantine issue $res["quarantine"] = Issue::getQuarantineInfo($res["iss_id"]); $returns[$issue_id] = $res; return $res; } } }
/** * Method used to send an IRC notification about a blocked email that was * saved into an internal note. * * @api * @param integer $issue_id The issue ID * @param string $from The sender of the blocked email message */ public static function notifyIRCBlockedMessage($issue_id, $from) { $notice = "Issue #{$issue_id} updated ("; // also add information about the assignee, if any $assignment = Issue::getAssignedUsers($issue_id); if (count($assignment) > 0) { $notice .= 'Assignment: ' . implode(', ', $assignment) . '; '; } $notice .= "BLOCKED email from '{$from}')"; self::notifyIRC(Issue::getProjectID($issue_id), $notice, $issue_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); } $tpl->assign("current_user_prefs", Prefs::get($usr_id));