Пример #1
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();
Пример #2
0
include_once APP_INC_PATH . "class.note.php";
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("view_note.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$note = Note::getDetails($HTTP_GET_VARS["id"]);
if ($note == '') {
    $tpl->assign("note", '');
    $tpl->displayTemplate();
    exit;
} else {
    $note["message"] = $note["not_note"];
    $issue_id = Note::getIssueID($HTTP_GET_VARS["id"]);
    $usr_id = Auth::getUserID();
}
if (User::getRoleByUser($usr_id, Issue::getProjectID($issue_id)) < User::getRoleID('Standard User') || !Issue::canAccess($issue_id, Auth::getUserID())) {
    $tpl->setTemplate("permission_denied.tpl.html");
    $tpl->displayTemplate();
    exit;
}
$note = Note::getDetails($HTTP_GET_VARS["id"]);
$note["message"] = $note["not_note"];
$issue_id = Note::getIssueID($HTTP_GET_VARS["id"]);
$tpl->bulkAssign(array("note" => $note, "issue_id" => $issue_id, 'extra_title' => "Note #" . $HTTP_GET_VARS['num'] . ": " . $note['not_title']));
if (!empty($issue_id)) {
    $sides = Note::getSideLinks($issue_id, $HTTP_GET_VARS["id"]);
    $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
}
$tpl->displayTemplate();
 /**
  * Method used to send an alert to a set of email addresses when
  * a reminder action was triggered, but no action was really
  * taken because no recipients could be found.
  *
  * @access  private
  * @param   integer $issue_id The issue ID
  * @param   string $type Which reminder are we trying to send, email or sms
  * @param   array $reminder The reminder details
  * @param   array $action The action details
  * @return  void
  */
 function _recordNoRecipientError($issue_id, $type, $reminder, $action)
 {
     $to = Reminder::_getReminderAlertAddresses();
     if (count($to) > 0) {
         $tpl = new Template_API();
         $tpl->setTemplate('reminders/alert_no_recipients.tpl.text');
         $tpl->bulkAssign(array("type" => $type, "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 Not Triggered: " . $action['rma_title'], 0, $issue_id);
         }
     }
 }
Пример #4
0
        $HTTP_POST_VARS['category'] = Time_Tracking::getCategoryID('Email Discussion');
        $HTTP_POST_VARS['summary'] = 'Time entry inserted when saving an email draft.';
        Time_Tracking::insertEntry();
    }
}
if (@$HTTP_GET_VARS['cat'] == 'view_draft') {
    $draft = Draft::getDetails($HTTP_GET_VARS['id']);
    $email = array('sup_subject' => $draft['emd_subject'], 'seb_body' => $draft['emd_body'], 'sup_from' => $draft['to'], 'cc' => implode('; ', $draft['cc']));
    // try to guess the correct email account to be associated with this email
    if (!empty($draft['emd_sup_id'])) {
        $HTTP_GET_VARS['ema_id'] = Email_Account::getAccountByEmail($draft['emd_sup_id']);
    } else {
        // if we are not replying to an existing message, just get the first email account you can find...
        $HTTP_GET_VARS['ema_id'] = Email_Account::getEmailAccount();
    }
    $tpl->bulkAssign(array("draft_id" => $HTTP_GET_VARS['id'], "email" => $email, "parent_email_id" => $draft['emd_sup_id'], "draft_status" => $draft['emd_status']));
    if ($draft['emd_status'] != 'pending') {
        $tpl->assign("read_only", 1);
    }
} elseif (@$HTTP_GET_VARS['cat'] == 'create_draft') {
    $tpl->assign("hide_email_buttons", "yes");
} else {
    if (!@empty($HTTP_GET_VARS["id"])) {
        $email = Support::getEmailDetails($HTTP_GET_VARS["ema_id"], $HTTP_GET_VARS["id"]);
        $date = Misc::formatReplyDate($email["timestamp"]);
        $header = "To " . $email["sup_from"] . ",\n\n\nThank you, \n" . Auth::getCurrentProjectName() . "\n\nOn {$date}, " . $email["sup_from"] . " wrote:\n>\n";
        $email["seb_body"] = $header . Misc::formatReply($email["message"]);
        $tpl->bulkAssign(array("email" => $email, "parent_email_id" => $HTTP_GET_VARS["id"]));
    }
}
// special handling when someone tries to 'reply' to an issue
Пример #5
0
 /**
  * Method used to send the account details of an user.
  *
  * @access  public
  * @param   integer $usr_id The user ID
  * @return  void
  */
 function notifyAccountDetails($usr_id)
 {
     $info = User::getDetails($usr_id);
     $info["projects"] = Project::getAssocList($usr_id, true, true);
     // open text template
     $tpl = new Template_API();
     $tpl->setTemplate('notifications/account_details.tpl.text');
     $tpl->bulkAssign(array("app_title" => Misc::getToolCaption(), "user" => $info));
     $text_message = $tpl->getTemplateContents();
     // send email (use PEAR's classes)
     $mail = new Mail_API();
     $mail->setTextBody($text_message);
     $setup = $mail->getSMTPSettings();
     $mail->send($setup["from"], $mail->getFormattedName($info["usr_full_name"], $info["usr_email"]), APP_SHORT_NAME . ": Your User Account Details");
 }
Пример #6
0
include_once APP_INC_PATH . "class.issue.php";
include_once APP_INC_PATH . "class.misc.php";
include_once APP_INC_PATH . "class.support.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("view_email.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$email = Support::getEmailDetails($HTTP_GET_VARS["ema_id"], $HTTP_GET_VARS["id"]);
$email["message"] = str_replace("&amp;nbsp;", "&nbsp;", $email["message"]);
$issue_id = Support::getIssueFromEmail($HTTP_GET_VARS["id"]);
if (!Issue::canAccess($issue_id, Auth::getUserID())) {
    $tpl->setTemplate("permission_denied.tpl.html");
    $tpl->displayTemplate();
    exit;
}
$tpl->bulkAssign(array("email" => $email, "issue_id" => $issue_id, 'extra_title' => "Email #" . $HTTP_GET_VARS['id'] . ": " . $email['sup_subject'], 'email_accounts' => Email_Account::getAssocList(array_keys(Project::getAssocList(Auth::getUserID())), true)));
if (@$HTTP_GET_VARS['cat'] == 'list_emails') {
    $sides = Support::getListingSides($HTTP_GET_VARS["id"]);
    $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
} elseif (@$HTTP_GET_VARS['cat'] == 'move_email' && Auth::getCurrentRole() >= User::getRoleID("Standard User")) {
    $res = Support::moveEmail(@$HTTP_GET_VARS['id'], @$HTTP_GET_VARS['ema_id'], @$HTTP_GET_VARS['new_ema_id']);
    $tpl->assign("move_email_result", $res);
    $tpl->assign("current_user_prefs", Prefs::get(Auth::getUserID()));
} else {
    $sides = Support::getIssueSides($issue_id, $HTTP_GET_VARS["id"]);
    $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
}
// set the page charset to whatever is set on this email
$charset = Mime_Helper::getCharacterSet($email['seb_full_email']);
if (!empty($charset)) {
    header("Content-Type: text/html; charset=" . $charset);