Пример #1
0
    }
}
// special handling when someone tries to 'reply' to an issue
if ($cat == 'reply') {
    $details = Issue::getReplyDetails($_GET['issue_id']);
    if ($details != '') {
        $header = Misc::formatReplyPreamble($details['created_date_ts'], $details['reporter']);
        $details['seb_body'] = $header . Misc::formatReply($details['description']);
        $details['sup_from'] = Mail_Helper::getFormattedName($details['reporter'], $details['reporter_email']);
        $tpl->assign(array('email' => $details, 'parent_email_id' => 0, 'extra_title' => 'Issue #' . $_GET['issue_id'] . ': Reply'));
    }
}
if (!empty($issue_id)) {
    // list the available statuses
    $tpl->assign('statuses', Status::getAssocStatusList($prj_id, false));
    $tpl->assign('current_issue_status', Issue::getStatusID($issue_id));
    // set if the current user is allowed to send emails on this issue or not
    $sender_details = User::getDetails($usr_id);
    $tpl->assign('can_send_email', Support::isAllowedToEmail($issue_id, $sender_details['usr_email']));
    $tpl->assign('subscribers', Notification::getSubscribers($issue_id, 'emails'));
}
if (!empty($_GET['ema_id']) || !empty($_POST['ema_id'])) {
    $ema_id = isset($_GET['ema_id']) ? (int) $_GET['ema_id'] : (isset($_POST['ema_id']) ? (int) $_POST['ema_id'] : null);
    $tpl->assign('ema_id', $ema_id);
}
$user_prefs = Prefs::get($usr_id);
// list of users to display in the lookup field in the To: and Cc: fields
$t = Project::getAddressBook($prj_id, $issue_id);
$tpl->assign(array('from' => User::getFromHeader($usr_id), 'assoc_users' => $t, 'assoc_emails' => array_keys($t), 'canned_responses' => Email_Response::getAssocList($prj_id), 'js_canned_responses' => Email_Response::getAssocListBodies($prj_id), 'current_user_prefs' => $user_prefs, 'issue_access' => Access::getIssueAccessArray($issue_id, $usr_id), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true)));
// don't add signature if it already exists. Note: This won't handle multiple user duplicate sigs.
if (@(!empty($draft['emd_body'])) && $user_prefs['auto_append_email_sig'] == 1 && strpos($draft['emd_body'], $user_prefs['email_signature']) !== false) {
Пример #2
0
    if (!@empty($HTTP_POST_VARS['new_status'])) {
        $res = Issue::setStatus($issue_id, $HTTP_POST_VARS['new_status']);
        if ($res != -1) {
            $new_status = Status::getStatusTitle($HTTP_POST_VARS['new_status']);
            History::add($issue_id, $usr_id, History::getTypeID('status_changed'), "Status changed to '{$new_status}' by " . User::getFullName($usr_id));
        }
    }
    $res = Note::insert($usr_id, $issue_id);
    $tpl->assign("post_result", $res);
    // enter the time tracking entry about this phone support entry
    if (!empty($HTTP_POST_VARS['time_spent'])) {
        $HTTP_POST_VARS['issue_id'] = $issue_id;
        $HTTP_POST_VARS['category'] = $HTTP_POST_VARS['time_category'];
        $HTTP_POST_VARS['summary'] = 'Time entry inserted when sending an internal note.';
        Time_Tracking::insertEntry();
    }
} elseif (@$HTTP_GET_VARS["cat"] == "reply") {
    if (!@empty($HTTP_GET_VARS["id"])) {
        $note = Note::getDetails($HTTP_GET_VARS["id"]);
        $date = Misc::formatReplyDate($note["timestamp"]);
        $header = "\n\n\nOn {$date}, " . $note["not_from"] . " wrote:\n>\n";
        $note["not_body"] = $header . Misc::formatReply($note["not_note"]);
        $tpl->bulkAssign(array("note" => $note, "parent_note_id" => $HTTP_GET_VARS["id"]));
        $reply_subject = Mail_API::removeExcessRe($note['not_title']);
    }
}
if (empty($reply_subject)) {
    $reply_subject = 'Re: ' . $details['iss_summary'];
}
$tpl->assign(array('from' => User::getFromHeader($usr_id), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'current_user_prefs' => Prefs::get($usr_id), 'subscribers' => Notification::getSubscribers($issue_id, false, User::getRoleID("Standard User")), 'statuses' => Status::getAssocStatusList($prj_id, false), 'current_issue_status' => Issue::getStatusID($issue_id), 'time_categories' => Time_Tracking::getAssocCategories(), 'note_category_id' => Time_Tracking::getCategoryID('Note Discussion'), 'reply_subject' => $reply_subject));
$tpl->displayTemplate();
Пример #3
0
 /**
  * Method used to bulk update a list of issues
  *
  * @access  public
  * @return  boolean
  */
 function bulkUpdate()
 {
     global $HTTP_POST_VARS;
     // check if user performing this chance has the proper role
     if (Auth::getCurrentRole() < User::getRoleID('Manager')) {
         return -1;
     }
     $items = Misc::escapeInteger($HTTP_POST_VARS['item']);
     $new_status_id = Misc::escapeInteger($_POST['status']);
     $new_release_id = Misc::escapeInteger($_POST['release']);
     $new_priority_id = Misc::escapeInteger($_POST['priority']);
     $new_category_id = Misc::escapeInteger($_POST['category']);
     $new_project_id = Misc::escapeInteger($_POST['project']);
     for ($i = 0; $i < count($items); $i++) {
         if (!Issue::canAccess($items[$i], Auth::getUserID())) {
             continue;
         } elseif (Issue::getProjectID($HTTP_POST_VARS['item'][$i]) != Auth::getCurrentProject()) {
             // make sure issue is not in another project
             continue;
         }
         $updated_fields = array();
         // update assignment
         if (count(@$HTTP_POST_VARS['users']) > 0) {
             $users = Misc::escapeInteger($HTTP_POST_VARS['users']);
             // get who this issue is currently assigned too
             $stmt = "SELECT\n                            isu_usr_id,\n                            CONCAT(en_firstname,' ', en_lastname) as usr_full_name\n                         FROM\n                            " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user,\n                            " . ETEL_USER_TABLE_NOSUB . "\n                         WHERE\n                            isu_usr_id = en_ID AND\n                            isu_iss_id = " . $items[$i];
             $current_assignees = $GLOBALS["db_api"]->dbh->getAssoc($stmt);
             if (PEAR::isError($current_assignees)) {
                 Error_Handler::logError(array($current_assignees->getMessage(), $current_assignees->getDebugInfo()), __FILE__, __LINE__);
                 return -1;
             }
             foreach ($current_assignees as $usr_id => $usr_name) {
                 if (!in_array($usr_id, $users)) {
                     Issue::deleteUserAssociation($items[$i], $usr_id, false);
                 }
             }
             $new_user_names = array();
             $new_assignees = array();
             foreach ($users as $usr_id) {
                 $new_user_names[$usr_id] = User::getFullName($usr_id);
                 // check if the issue is already assigned to this person
                 $stmt = "SELECT\n                                COUNT(*) AS total\n                             FROM\n                                " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user\n                             WHERE\n                                isu_iss_id=" . $items[$i] . " AND\n                                isu_usr_id=" . $usr_id;
                 $total = $GLOBALS["db_api"]->dbh->getOne($stmt);
                 if ($total > 0) {
                     continue;
                 } else {
                     $new_assignees[] = $usr_id;
                     // add the assignment
                     Issue::addUserAssociation(Auth::getUserID(), $items[$i], $usr_id, false);
                     Notification::subscribeUser(Auth::getUserID(), $items[$i], $usr_id, Notification::getAllActions());
                     Workflow::handleAssignment(Auth::getCurrentProject(), $items[$i], Auth::getUserID());
                 }
             }
             Notification::notifyNewAssignment($new_assignees, $items[$i]);
             $updated_fields['Assignment'] = History::formatChanges(join(', ', $current_assignees), join(', ', $new_user_names));
         }
         // update status
         if (!empty($new_status_id)) {
             $old_status_id = Issue::getStatusID($items[$i]);
             $res = Issue::setStatus($items[$i], $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 (!empty($new_release_id)) {
             $old_release_id = Issue::getRelease($items[$i]);
             $res = Issue::setRelease($items[$i], $new_release_id);
             if ($res == 1) {
                 $updated_fields['Release'] = History::formatChanges(Release::getTitle($old_release_id), Release::getTitle($new_release_id));
             }
         }
         // update priority
         if (!empty($new_priority_id)) {
             $old_priority_id = Issue::getPriority($items[$i]);
             $res = Issue::setPriority($items[$i], $new_priority_id);
             if ($res == 1) {
                 $updated_fields['Priority'] = History::formatChanges(Priority::getTitle($old_priority_id), Priority::getTitle($new_priority_id));
             }
         }
         // update category
         if (!empty($new_category_id)) {
             $old_category_id = Issue::getCategory($items[$i]);
             $res = Issue::setCategory($items[$i], $new_category_id);
             if ($res == 1) {
                 $updated_fields['Category'] = History::formatChanges(Category::getTitle($old_category_id), Category::getTitle($new_category_id));
             }
         }
         // update project
         if (!empty($new_project_id)) {
             $old_project_id = Issue::getProjectID($items[$i]);
             $res = Issue::setProject($items[$i], $new_project_id);
             if ($res == 1) {
                 $updated_fields['Project'] = History::formatChanges(Category::getTitle($old_project_id), Category::getTitle($new_project_id));
             }
         }
         if (count($updated_fields) > 0) {
             // log the changes
             $changes = '';
             $k = 0;
             foreach ($updated_fields as $key => $value) {
                 if ($k > 0) {
                     $changes .= "; ";
                 }
                 $changes .= "{$key}: {$value}";
                 $k++;
             }
             History::add($items[$i], Auth::getUserID(), History::getTypeID('issue_bulk_updated'), "Issue updated ({$changes}) by " . User::getFullName(Auth::getUserID()));
         }
     }
     return true;
 }