if ($cat == 'report') { $res = Issue::createFromPost(); if ($res != -1) { // redirect to view issue page Misc::setMessage(ev_gettext('Your issue was created successfully.')); Auth::redirect(APP_BASE_URL . 'view.php?id=' . $res); } else { // need to show everything again Misc::setMessage(ev_gettext('There was an error creating your issue.'), Misc::MSG_ERROR); $tpl->assign('error_msg', '1'); } } if ($cat == 'associate') { $item = isset($_GET['item']) ? (array) $_GET['item'] : null; if (count($item) > 0) { $res = Support::getListDetails($item); $tpl->assign('emails', $res); $tpl->assign('attached_emails', @implode(',', $item)); if (CRM::hasCustomerIntegration($prj_id)) { $crm = CRM::getInstance($prj_id); // also need to guess the contact_id from any attached emails try { $info = $crm->getCustomerInfoFromEmails($prj_id, $item); $tpl->assign(array('customer_id' => $info['customer_id'], 'customer_name' => $info['customer_name'], 'contact_id' => $info['contact_id'], 'contact_name' => $info['contact_name'], 'contacts' => $info['contacts'])); } catch (CRMException $e) { } } // if we are dealing with just one message, use the subject line as the // summary for the issue, and the body as the description if (count($item) == 1) { $email_details = Support::getEmailDetails(Email_Account::getAccountByEmail($item[0]), $item[0]);
$res = Issue::insert(); if ($res != -1) { // show direct links to the issue page, issue listing page and // email listing page $tpl->assign("new_issue_id", $res); $tpl->assign("quarantine", Issue::getQuarantineInfo($res)); $tpl->assign("errors", $insert_errors); $tpl->assign("ticket", Issue::getDetails($res)); } else { // need to show everything again $tpl->assign("error_msg", "1"); } } if (@$HTTP_GET_VARS["cat"] == "associate") { if (@count($HTTP_GET_VARS["item"]) > 0) { $res = Support::getListDetails($HTTP_GET_VARS["item"]); $tpl->assign("emails", $res); $tpl->assign("attached_emails", @implode(",", $HTTP_GET_VARS["item"])); if (Customer::hasCustomerIntegration($prj_id)) { // also need to guess the contact_id from any attached emails $info = Customer::getCustomerInfoFromEmails($prj_id, $HTTP_GET_VARS["item"]); $tpl->assign(array("customer_id" => $info['customer_id'], 'customer_name' => $info['customer_name'], "contact_id" => $info['contact_id'], 'contact_name' => $info['contact_name'], 'contacts' => $info['contacts'])); } // if we are dealing with just one message, use the subject line as the // summary for the issue, and the body as the description if (count($HTTP_GET_VARS["item"]) == 1) { $email_details = Support::getEmailDetails(Email_Account::getAccountByEmail($HTTP_GET_VARS["item"][0]), $HTTP_GET_VARS["item"][0]); $tpl->assign(array('issue_summary' => $email_details['sup_subject'], 'issue_description' => $email_details['message'])); // also auto pre-fill the customer contact text fields if (Customer::hasCustomerIntegration($prj_id)) { $sender_email = Mail_API::getEmailAddress($email_details['sup_from']);