[ Index ] |
PHP Cross Reference of Eventum |
[Summary view] [Print] [Text view]
1 <?php 2 /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */ 3 // +----------------------------------------------------------------------+ 4 // | Eventum - Issue Tracking System | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB | 7 // | | 8 // | This program is free software; you can redistribute it and/or modify | 9 // | it under the terms of the GNU General Public License as published by | 10 // | the Free Software Foundation; either version 2 of the License, or | 11 // | (at your option) any later version. | 12 // | | 13 // | This program is distributed in the hope that it will be useful, | 14 // | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 // | GNU General Public License for more details. | 17 // | | 18 // | You should have received a copy of the GNU General Public License | 19 // | along with this program; if not, write to: | 20 // | | 21 // | Free Software Foundation, Inc. | 22 // | 59 Temple Place - Suite 330 | 23 // | Boston, MA 02111-1307, USA. | 24 // +----------------------------------------------------------------------+ 25 // | Authors: João Prado Maia <jpm@mysql.com> | 26 // +----------------------------------------------------------------------+ 27 // 28 // @(#) $Id: new.php 3363 2007-08-27 09:54:11Z balsdorf $ 29 30 require_once(dirname(__FILE__) . "/init.php"); 31 require_once (APP_INC_PATH . "class.template.php"); 32 require_once (APP_INC_PATH . "class.auth.php"); 33 require_once (APP_INC_PATH . "class.category.php"); 34 require_once (APP_INC_PATH . "class.priority.php"); 35 require_once (APP_INC_PATH . "class.release.php"); 36 require_once (APP_INC_PATH . "class.issue.php"); 37 require_once (APP_INC_PATH . "class.misc.php"); 38 require_once (APP_INC_PATH . "class.group.php"); 39 require_once (APP_INC_PATH . "class.support.php"); 40 require_once (APP_INC_PATH . "class.custom_field.php"); 41 require_once (APP_INC_PATH . "class.setup.php"); 42 require_once (APP_INC_PATH . "db_access.php"); 43 44 $tpl = new Template_API(); 45 $tpl->setTemplate("new.tpl.html"); 46 47 Auth::checkAuthentication(APP_COOKIE); 48 if (Auth::getCurrentRole() < User::getRoleID("Reporter")) { 49 Auth::redirect("main.php"); 50 } 51 $usr_id = Auth::getUserID(); 52 $prj_id = Auth::getCurrentProject(); 53 54 if (Customer::hasCustomerIntegration($prj_id)) { 55 if (Auth::getCurrentRole() == User::getRoleID('Customer')) { 56 $customer_id = User::getCustomerID($usr_id); 57 // check if the current customer has already redeemed all available per-incident tickets 58 if ((empty($_POST['cat'])) && (Customer::hasPerIncidentContract($prj_id, $customer_id)) && 59 (!Customer::hasIncidentsLeft($prj_id, $customer_id))) { 60 // show warning about per-incident limitation 61 $tpl->setTemplate("customer/" . Customer::getBackendImplementationName($prj_id) . "/incident_limit_reached.tpl.html"); 62 $tpl->assign('customer', Customer::getDetails($prj_id, $customer_id)); 63 $tpl->displayTemplate(); 64 exit; 65 } 66 $tpl->assign("message", Customer::getNewIssueMessage($prj_id, $customer_id)); 67 } 68 } 69 70 if (@$_POST["cat"] == "report") { 71 $res = Issue::insert(); 72 if ($res != -1) { 73 // show direct links to the issue page, issue listing page and 74 // email listing page 75 $tpl->assign("new_issue_id", $res); 76 $tpl->assign("quarantine", Issue::getQuarantineInfo($res)); 77 $tpl->assign("errors", $insert_errors); 78 $tpl->assign("ticket", Issue::getDetails($res)); 79 } else { 80 // need to show everything again 81 $tpl->assign("error_msg", "1"); 82 } 83 } 84 85 if (@$_GET["cat"] == "associate") { 86 if (@count($_GET["item"]) > 0) { 87 $res = Support::getListDetails($_GET["item"]); 88 $tpl->assign("emails", $res); 89 $tpl->assign("attached_emails", @implode(",", $_GET["item"])); 90 if (Customer::hasCustomerIntegration($prj_id)) { 91 // also need to guess the contact_id from any attached emails 92 $info = Customer::getCustomerInfoFromEmails($prj_id, $_GET["item"]); 93 $tpl->assign(array( 94 "customer_id" => $info['customer_id'], 95 'customer_name' => $info['customer_name'], 96 "contact_id" => $info['contact_id'], 97 'contact_name' => $info['contact_name'], 98 'contacts' => $info['contacts'] 99 )); 100 } 101 // if we are dealing with just one message, use the subject line as the 102 // summary for the issue, and the body as the description 103 if (count($_GET["item"]) == 1) { 104 $email_details = Support::getEmailDetails(Email_Account::getAccountByEmail($_GET["item"][0]), $_GET["item"][0]); 105 $tpl->assign(array( 106 'issue_summary' => $email_details['sup_subject'], 107 'issue_description' => $email_details['seb_body'] 108 )); 109 // also auto pre-fill the customer contact text fields 110 if (Customer::hasCustomerIntegration($prj_id)) { 111 $sender_email = Mail_API::getEmailAddress($email_details['sup_from']); 112 list(,$contact_id) = Customer::getCustomerIDByEmails($prj_id, array($sender_email)); 113 if (!empty($contact_id)) { 114 $tpl->assign("contact_details", Customer::getContactDetails($prj_id, $contact_id)); 115 } 116 } 117 } 118 } 119 } 120 121 $tpl->assign(array( 122 "cats" => Category::getAssocList($prj_id), 123 "priorities" => Priority::getAssocList($prj_id), 124 "users" => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 125 "releases" => Release::getAssocList($prj_id), 126 "custom_fields" => Custom_Field::getListByProject($prj_id, 'report_form'), 127 "max_attachment_size" => Attachment::getMaxAttachmentSize(), 128 "field_display_settings" => Project::getFieldDisplaySettings($prj_id), 129 "groups" => Group::getAssocList($prj_id) 130 )); 131 132 $setup = Setup::load(); 133 $tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]); 134 135 $prefs = Prefs::get($usr_id); 136 $tpl->assign("user_prefs", $prefs); 137 $tpl->assign("zones", Date_API::getTimezoneList()); 138 if (Auth::getCurrentRole() == User::getRoleID('Customer')) { 139 $customer_contact_id = User::getCustomerContactID($usr_id); 140 $tpl->assign("contact_details", Customer::getContactDetails($prj_id, $customer_contact_id)); 141 $customer_id = User::getCustomerID($usr_id); 142 $tpl->assign("contacts", Customer::getContactEmailAssocList($prj_id, $customer_id)); 143 $tpl->assign(array( 144 "customer_id" => User::getCustomerID($usr_id), 145 "contact_id" => User::getCustomerContactID($usr_id) 146 )); 147 } 148 149 $tpl->displayTemplate();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 19 21:21:33 2007 | Cross-referenced by PHPXref 0.7 |