* please see the COPYING and AUTHORS files * that were distributed with this source code. */ require_once __DIR__ . '/../../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('manage/severities.tpl.html'); Auth::checkAuthentication(); $role_id = Auth::getCurrentRole(); if ($role_id < User::ROLE_MANAGER) { Misc::setMessage('Sorry, you are not allowed to access this page.', Misc::MSG_ERROR); $tpl->displayTemplate(); exit; } @($prj_id = $_POST['prj_id'] ? $_POST['prj_id'] : $_GET['prj_id']); $tpl->assign('project', Project::getDetails($prj_id)); if (@$_POST['cat'] == 'new') { $res = Severity::insert($prj_id, $_POST['title'], $_POST['description'], $_POST['rank']); Misc::mapMessages($res, array(1 => array('Thank you, the severity was added successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to add the severity.', Misc::MSG_ERROR), -2 => array('Please enter the title for this new severity.', Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = Severity::update($_POST['id'], $_POST['title'], $_POST['description'], $_POST['rank']); Misc::mapMessages($res, array(1 => array('Thank you, the severity was added successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to add the severity.', Misc::MSG_ERROR), -2 => array('Please enter the title for this new severity.', Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { Severity::remove($_POST['items']); } if (@$_GET['cat'] == 'edit') { $tpl->assign('info', Severity::getDetails($_GET['id'])); } elseif (@$_GET['cat'] == 'change_rank') { Severity::changeRank($prj_id, $_GET['id'], $_GET['rank']); } $tpl->assign('list', Severity::getList($prj_id)); $tpl->displayTemplate();
// generate options for assign list. If there are groups and user is above a customer, include groups $groups = Group::getAssocList($prj_id); $users = Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')); $assign_options = array('' => ev_gettext('Any'), '-1' => ev_gettext('un-assigned'), '-2' => ev_gettext('myself and un-assigned')); if (Auth::isAnonUser()) { unset($assign_options['-2']); } elseif (User::getGroupID(Auth::getUserID()) != '') { $assign_options['-3'] = ev_gettext('myself and my group'); $assign_options['-4'] = ev_gettext('myself, un-assigned and my group'); } if (count($groups) > 0 && $role_id > User::getRoleID('Customer')) { foreach ($groups as $grp_id => $grp_name) { $assign_options["grp:{$grp_id}"] = 'Group: ' . $grp_name; } } $assign_options += $users; $tpl->assign(array('cats' => Category::getAssocList($prj_id), 'priorities' => Priority::getList($prj_id), 'severities' => Severity::getList($prj_id), 'status' => Status::getAssocStatusList($prj_id), 'users' => $assign_options, 'releases' => Release::getAssocList($prj_id, true), 'custom' => Filter::getListing($prj_id), 'custom_fields' => Custom_Field::getListByProject($prj_id, ''), 'reporters' => Project::getReporters($prj_id), 'products' => Product::getAssocList(false))); if (!empty($_GET['custom_id'])) { $check_perm = true; if (Filter::isGlobal($_GET['custom_id'])) { if ($role_id >= User::getRoleID('Manager')) { $check_perm = false; } } $options = Filter::getDetails($_GET['custom_id'], $check_perm); } else { $options = array(); $options['cst_rows'] = APP_DEFAULT_PAGER_SIZE; } $tpl->assign('options', $options); $tpl->displayTemplate();
if (count($item) == 1) { $email_details = Support::getEmailDetails(Email_Account::getAccountByEmail($item[0]), $item[0]); $tpl->assign(array('issue_summary' => $email_details['sup_subject'], 'issue_description' => $email_details['seb_body'])); // also auto pre-fill the customer contact text fields if (CRM::hasCustomerIntegration($prj_id)) { $sender_email = Mail_Helper::getEmailAddress($email_details['sup_from']); try { $contact = $crm->getContactByEmail($sender_email); $tpl->assign('contact_details', $contact->getDetails()); } catch (CRMException $e) { } } } } } $tpl->assign(array('cats' => Category::getAssocList($prj_id), 'priorities' => Priority::getAssocList($prj_id), 'severities' => Severity::getList($prj_id), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'releases' => Release::getAssocList($prj_id), 'custom_fields' => Custom_Field::getListByProject($prj_id, 'report_form'), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true), 'field_display_settings' => Project::getFieldDisplaySettings($prj_id), 'groups' => Group::getAssocList($prj_id), 'products' => Product::getList(false))); $prefs = Prefs::get($usr_id); $tpl->assign('user_prefs', $prefs); $tpl->assign('zones', Date_Helper::getTimezoneList()); if (Auth::getCurrentRole() == User::getRoleID('Customer')) { $crm = CRM::getInstance(Auth::getCurrentProject()); $customer_contact_id = User::getCustomerContactID($usr_id); $contact = $crm->getContact($customer_contact_id); $customer_id = Auth::getCurrentCustomerID(); $customer = $crm->getCustomer($customer_id); // TODOCRM: Pull contacts via ajax when user selects contract $tpl->assign(array('customer_id' => $customer_id, 'contact_id' => $customer_contact_id, 'customer' => $customer, 'contact' => $contact)); } $clone_iss_id = isset($_GET['clone_iss_id']) ? (int) $_GET['clone_iss_id'] : null; if ($clone_iss_id && Access::canCloneIssue($clone_iss_id, $usr_id)) { $tpl->assign(Issue::getCloneIssueTemplateVariables($clone_iss_id));
if (!empty($auto_switched_from)) { $tpl->assign(array('project_auto_switched' => 1, 'old_project' => Project::getName($auto_switched_from))); } $issue_fields_display = Issue_Field::getFieldsToDisplay($issue_id, 'view_issue'); // figure out what data to show in each column $columns = array(0 => array(), 1 => array()); if (CRM::hasCustomerIntegration($prj_id) and !empty($details['iss_customer_id'])) { $columns[0][] = array('title' => 'Customer', 'field' => 'customer_0'); $columns[1][] = array('title' => 'Customer Contract', 'field' => 'customer_1'); } $cats = Category::getList($prj_id); if (count($cats) > 0) { $columns[0][] = array('title' => ev_gettext('Category'), 'data' => $details['prc_title'], 'field' => 'category'); } $columns[0][] = array('title' => ev_gettext('Status'), 'data' => $details['sta_title'], 'data_bgcolor' => $details['status_color'], 'field' => 'status'); $severities = Severity::getList($prj_id); if (count($severities) > 0) { $columns[0][] = array('title' => ev_gettext('Severity'), 'data' => $details['sev_title'], 'field' => 'severity'); } if (!isset($issue_fields_display['priority']) || $issue_fields_display['priority'] != false) { if (isset($issue_fields_display['priority']['min_role']) && $issue_fields_display['priority']['min_role'] > User::getRoleID('Customer')) { $bgcolor = APP_INTERNAL_COLOR; } else { $bgcolor = ''; } $columns[0][] = array('title' => ev_gettext('Priority'), 'data' => $details['pri_title'], 'title_bgcolor' => $bgcolor, 'field' => 'priority'); } $releases = Release::getAssocList($prj_id); if (count($releases) > 0 && $role_id != User::getRoleID('Customer')) { $columns[0][] = array('title' => ev_gettext('Scheduled Release'), 'data' => $details['pre_title'], 'title_bgcolor' => APP_INTERNAL_COLOR); }