Пример #1
0
include_once APP_INC_PATH . "class.attachment.php";
include_once APP_INC_PATH . "class.scm.php";
include_once APP_INC_PATH . "class.notification.php";
include_once APP_INC_PATH . "class.phone_support.php";
include_once APP_INC_PATH . "class.status.php";
include_once APP_INC_PATH . "class.history.php";
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "class.authorized_replier.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("popup.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
if (@$HTTP_GET_VARS["cat"] == "delete_note") {
    $res = Note::remove($HTTP_GET_VARS["id"]);
    $tpl->assign("note_delete_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "delete_time") {
    $res = Time_Tracking::removeEntry($HTTP_GET_VARS["id"], $usr_id);
    $tpl->assign("time_delete_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "bulk_update") {
    $res = Issue::bulkUpdate();
    $tpl->assign("bulk_update_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "set_initial_impact") {
    $res = Issue::setImpactAnalysis($HTTP_POST_VARS["issue_id"]);
    $tpl->assign("set_initial_impact_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "add_requirement") {
    $res = Impact_Analysis::insert($HTTP_POST_VARS["issue_id"]);
    $tpl->assign("add_requirement_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "set_impact_requirement") {
    $res = Impact_Analysis::update($HTTP_POST_VARS["isr_id"]);
Пример #2
0
// | Authors: Elan Ruusamäe <*****@*****.**>                               |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('popup.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$iss_id = isset($_GET['iss_id']) ? (int) $_GET['iss_id'] : (isset($_POST['issue_id']) ? (int) $_POST['issue_id'] : null);
$cat = isset($_GET['cat']) ? (string) $_GET['cat'] : (isset($_POST['cat']) ? (string) $_POST['cat'] : null);
$id = isset($_GET['id']) ? (int) $_GET['id'] : null;
$status_id = isset($_GET['new_sta_id']) ? (int) $_GET['new_sta_id'] : null;
$isr_id = isset($_POST['isr_id']) ? (int) $_POST['isr_id'] : null;
$items = isset($_POST['item']) ? (array) $_POST['item'] : null;
if ($cat == 'delete_note') {
    $res = Note::remove($id);
    $tpl->assign('note_delete_result', $res);
} elseif ($cat == 'delete_time') {
    $res = Time_Tracking::removeTimeEntry($id, $usr_id);
    $tpl->assign('time_delete_result', $res);
} elseif ($cat == 'bulk_update') {
    $res = Issue::bulkUpdate();
    $tpl->assign('bulk_update_result', $res);
} elseif ($cat == 'set_initial_impact') {
    $res = Issue::setImpactAnalysis($iss_id);
    $tpl->assign('set_initial_impact_result', $res);
} elseif ($cat == 'add_requirement') {
    $res = Impact_Analysis::insert($iss_id);
    $tpl->assign('add_requirement_result', $res);
} elseif ($cat == 'set_impact_requirement') {
    $res = Impact_Analysis::update($isr_id);
Пример #3
0
 /**
  * Converts a note to a draft or an email
  *
  * @access  public
  * @param   $note_id The id of the note
  * @param   $target What the not should be converted too
  * @param   $authorize_sender If the sender should be added to authorized senders list.
  */
 function convertNote($note_id, $target, $authorize_sender = false)
 {
     $note_id = Misc::escapeInteger($note_id);
     $issue_id = Note::getIssueID($note_id);
     $email_account_id = Email_Account::getEmailAccount();
     $blocked_message = Note::getBlockedMessage($note_id);
     $unknown_user = Note::getUnknownUser($note_id);
     $structure = Mime_Helper::decode($blocked_message, true, true);
     $body = Mime_Helper::getMessageBody($structure);
     $sender_email = strtolower(Mail_API::getEmailAddress($structure->headers['from']));
     if ($target == 'email') {
         if (Mime_Helper::hasAttachments($blocked_message)) {
             $has_attachments = 1;
         } else {
             $has_attachments = 0;
         }
         list($blocked_message, $headers) = Mail_API::rewriteThreadingHeaders($issue_id, $blocked_message, @$structure->headers);
         $t = array('issue_id' => $issue_id, 'ema_id' => $email_account_id, 'message_id' => @$structure->headers['message-id'], 'date' => Date_API::getCurrentDateGMT(), 'from' => @$structure->headers['from'], 'to' => @$structure->headers['to'], 'cc' => @$structure->headers['cc'], 'subject' => @$structure->headers['subject'], 'body' => @$body, 'full_email' => @$blocked_message, 'has_attachment' => $has_attachments, 'headers' => $headers);
         // need to check for a possible customer association
         if (!empty($structure->headers['from'])) {
             $details = Email_Account::getDetails($email_account_id);
             // check from the associated project if we need to lookup any customers by this email address
             if (Customer::hasCustomerIntegration($details['ema_prj_id'])) {
                 // check for any customer contact association
                 list($customer_id, ) = Customer::getCustomerIDByEmails($details['ema_prj_id'], array($sender_email));
                 if (!empty($customer_id)) {
                     $t['customer_id'] = $customer_id;
                 }
             }
         }
         if (empty($t['customer_id'])) {
             $update_type = 'staff response';
             $t['customer_id'] = "NULL";
         } else {
             $update_type = 'customer action';
         }
         $res = Support::insertEmail($t, $structure, $sup_id);
         if ($res != -1) {
             Support::extractAttachments($issue_id, $blocked_message);
             // notifications about new emails are always external
             $internal_only = false;
             // special case when emails are bounced back, so we don't want to notify the customer about those
             if (Notification::isBounceMessage($sender_email)) {
                 $internal_only = true;
             }
             Notification::notifyNewEmail(Auth::getUserID(), $issue_id, $t, $internal_only, false, '', $sup_id);
             Issue::markAsUpdated($issue_id, $update_type);
             Note::remove($note_id, false);
             History::add($issue_id, Auth::getUserID(), History::getTypeID('note_converted_email'), "Note converted to e-mail (from: " . @$structure->headers['from'] . ") by " . User::getFullName(Auth::getUserID()));
             // now add sender as an authorized replier
             if ($authorize_sender) {
                 Authorized_Replier::manualInsert($issue_id, @$structure->headers['from']);
             }
         }
         return $res;
     } else {
         // save message as a draft
         $res = Draft::saveEmail($issue_id, $structure->headers['to'], $structure->headers['cc'], $structure->headers['subject'], $body, false, $unknown_user);
         // remove the note, if the draft was created successfully
         if ($res) {
             Note::remove($note_id, false);
             History::add($issue_id, Auth::getUserID(), History::getTypeID('note_converted_draft'), "Note converted to draft (from: " . @$structure->headers['from'] . ") by " . User::getFullName(Auth::getUserID()));
         }
         return $res;
     }
 }