if ($role_id < User::getRoleID('administrator')) { Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR); $tpl->displayTemplate(); exit; } $tpl->assign('project_list', Project::getAll()); if (@$_POST['cat'] == 'new') { $res = Status::insertCustomization($_POST['project'], $_POST['status'], $_POST['date_field'], $_POST['label']); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the customization was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new customization.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new customization'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = Status::updateCustomization($_POST['id'], $_POST['project'], $_POST['status'], $_POST['date_field'], $_POST['label']); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the customization was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the customization information.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this customization.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { $res = Status::removeCustomization(@$_POST['items']); Misc::mapMessages($res, array(true => array(ev_gettext('Thank you, the customization was deleted successfully.'), Misc::MSG_INFO), false => array(ev_gettext('An error occurred while trying to delete the customization information.'), Misc::MSG_ERROR))); } if (@$_GET['cat'] == 'edit') { $details = Status::getCustomizationDetails($_GET['id']); $tpl->assign(array('info' => $details, 'project_id' => $details['psd_prj_id'], 'status_list' => Status::getAssocStatusList($details['psd_prj_id'], true))); } $display_customer_fields = false; @($prj_id = $_POST['prj_id'] ? $_POST['prj_id'] : $_GET['prj_id']); if (!empty($prj_id)) { $tpl->assign('status_list', Status::getAssocStatusList($prj_id, true)); $tpl->assign('project_id', $prj_id); $display_customer_fields = CRM::hasCustomerIntegration($prj_id); } $tpl->assign('date_fields', Issue::getDateFieldsAssocList($display_customer_fields)); $tpl->assign('project_list', Project::getAll()); $tpl->assign('list', Status::getCustomizationList()); $tpl->displayTemplate();
/** * Returns an array of active filters * * @param array $options The options array * @return array */ public static function getActiveFilters($options) { $prj_id = Auth::getCurrentProject(); $filter_info = self::getFiltersInfo(); $return = array(); foreach ($filter_info as $filter_key => $filter) { $display = false; if (isset($filter['param']) && isset($options[$filter['param']])) { $filter_details = $options[$filter['param']]; } if (isset($filter['is_custom'])) { // custom fields $fld_id = $filter['fld_id']; if (!isset($options['custom_field'][$fld_id]) || empty($options['custom_field'][$fld_id])) { continue; } elseif ($filter['fld_type'] == 'date' && empty($options['custom_field'][$fld_id]['Year'])) { continue; } elseif ($filter['fld_type'] == 'integer') { if (!isset($options['custom_field'][$fld_id]['value']) || empty($options['custom_field'][$fld_id]['value'])) { continue; } else { $filter_details = $options['custom_field'][$fld_id]; switch ($filter_details['filter_type']) { case 'ge': $display = ev_gettext('%1$s or greater', $filter_details['value']); break; case 'le': $display = ev_gettext('%1$s or less', $filter_details['value']); break; case 'gt': $display = ev_gettext('Greater than %1$s', $filter_details['value']); break; case 'lt': $display = ev_gettext('Less than %1$s', $filter_details['value']); break; default: $display = $filter_details['value']; } } } elseif (in_array($filter['fld_type'], array('multiple', 'combo'))) { $display = implode(', ', Custom_Field::getOptions($fld_id, $options['custom_field'][$fld_id])); } else { $display = $options['custom_field'][$fld_id]; } } elseif (!isset($options[$filter['param']]) || empty($options[$filter['param']]) || in_array($filter_key, array('sort_order', 'sort_by', 'rows', 'search_type'))) { continue; } elseif (isset($filter['is_date']) && $filter['is_date'] == true) { if (!empty($filter_details['Year']) || isset($filter_details['time_period'])) { switch ($filter_details['filter_type']) { case 'in_past': $display = ev_gettext('In Past %1$s hours', $filter_details['time_period']); break; case 'null': $display = ev_gettext('Is NULL'); break; case 'between': $end = $options[$filter['param'] . '_end']; $display = ev_gettext('Is between %1$s-%2$s-%3$s AND %4$s-%5$s-%6$s', $filter_details['Year'], $filter_details['Month'], $filter_details['Day'], $end['Year'], $end['Month'], $end['Day']); break; case 'greater': $display = ev_gettext('Is greater than %1$s-%2$s-%3$s', $filter_details['Year'], $filter_details['Month'], $filter_details['Day']); break; case 'less': $display = ev_gettext('Is less than %1$s-%2$s-%3$s', $filter_details['Year'], $filter_details['Month'], $filter_details['Day']); } } } elseif ($filter['param'] == 'status') { $statuses = Status::getAssocStatusList($prj_id); $display = $statuses[$filter_details]; } elseif ($filter['param'] == 'category') { $categories = Category::getAssocList($prj_id); if (is_array($filter_details)) { $active_categories = array(); foreach ($filter_details as $category) { $active_categories[] = $categories[$category]; } $display = implode(', ', $active_categories); } else { $display = $categories[$filter_details]; } } elseif ($filter['param'] == 'priority') { $priorities = Priority::getAssocList($prj_id); $display = $priorities[$filter_details]; } elseif ($filter['param'] == 'severity') { $severities = Severity::getAssocList($prj_id); $display = $severities[$filter_details]; } elseif ($filter['param'] == 'users') { if ($filter_details == -1) { $display = ev_gettext('un-assigned'); } elseif ($filter_details == -2) { $display = ev_gettext('myself and un-assigned'); } elseif ($filter_details == -3) { $display = ev_gettext('myself and my group'); } elseif ($filter_details == -4) { $display = ev_gettext('myself, un-assigned and my group'); } elseif (substr($filter_details, 0, 3) == 'grp') { $display = ev_gettext('%1$s Group', Group::getName(substr($filter_details, 4))); } else { $display = User::getFullName($filter_details); } } elseif ($filter['param'] == 'hide_closed') { if ($filter_details == true) { $display = ev_gettext('Yes'); } } elseif ($filter['param'] == 'reporter') { $display = User::getFullName($filter_details); } elseif ($filter['param'] == 'release') { $display = Release::getTitle($filter_details); } elseif ($filter['param'] == 'customer_id') { try { $crm = CRM::getInstance($prj_id); $customer = $crm->getCustomer($filter_details); $display = $customer->getName(); } catch (CRMException $e) { $display = $filter_details; } } elseif ($filter['param'] == 'product') { $display = Product::getTitle($filter_details); } else { $display = $filter_details; } if ($display != false) { $return[$filter['title']] = array('value' => $display, 'remove_link' => 'list.php?view=clearandfilter&' . self::buildUrl($filter_info, $options, $filter_key, true)); } } return $return; }
$tpl->assign(array('email' => $email, 'parent_email_id' => $_GET['id'])); } } // special handling when someone tries to 'reply' to an issue if ($cat == 'reply') { $details = Issue::getReplyDetails($_GET['issue_id']); if ($details != '') { $header = Misc::formatReplyPreamble($details['created_date_ts'], $details['reporter']); $details['seb_body'] = $header . Misc::formatReply($details['description']); $details['sup_from'] = Mail_Helper::getFormattedName($details['reporter'], $details['reporter_email']); $tpl->assign(array('email' => $details, 'parent_email_id' => 0, 'extra_title' => 'Issue #' . $_GET['issue_id'] . ': Reply')); } } if (!empty($issue_id)) { // list the available statuses $tpl->assign('statuses', Status::getAssocStatusList($prj_id, false)); $tpl->assign('current_issue_status', Issue::getStatusID($issue_id)); // set if the current user is allowed to send emails on this issue or not $sender_details = User::getDetails($usr_id); $tpl->assign('can_send_email', Support::isAllowedToEmail($issue_id, $sender_details['usr_email'])); $tpl->assign('subscribers', Notification::getSubscribers($issue_id, 'emails')); } if (!empty($_GET['ema_id']) || !empty($_POST['ema_id'])) { $ema_id = isset($_GET['ema_id']) ? (int) $_GET['ema_id'] : (isset($_POST['ema_id']) ? (int) $_POST['ema_id'] : null); $tpl->assign('ema_id', $ema_id); } $user_prefs = Prefs::get($usr_id); // list of users to display in the lookup field in the To: and Cc: fields $t = Project::getAddressBook($prj_id, $issue_id); $tpl->assign(array('from' => User::getFromHeader($usr_id), 'assoc_users' => $t, 'assoc_emails' => array_keys($t), 'canned_responses' => Email_Response::getAssocList($prj_id), 'js_canned_responses' => Email_Response::getAssocListBodies($prj_id), 'current_user_prefs' => $user_prefs, 'issue_access' => Access::getIssueAccessArray($issue_id, $usr_id), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true))); // don't add signature if it already exists. Note: This won't handle multiple user duplicate sigs.
/** * Method used to get an associative array of the list of statuses and the * total number of issues associated with each of them. * * @param boolean $hide_closed If closed issues should be hidden. * @return array List of statuses */ public static function getAssocStatus($hide_closed = true) { $prj_id = Auth::getCurrentProject(); $list = Status::getAssocStatusList($prj_id); $stats = array(); foreach ($list as $sta_id => $sta_title) { $stmt = 'SELECT COUNT(*) AS total_items FROM {{%issue}}, {{%status}} WHERE iss_sta_id = sta_id AND iss_prj_id=? AND iss_sta_id=?'; if ($hide_closed) { $stmt .= ' AND sta_is_closed = 0'; } $res = (int) DB_Helper::getInstance()->getOne($stmt, array($prj_id, $sta_id)); if ($res > 0) { $stats[$sta_title] = $res; } } arsort($stats); return $stats; }
* For the full copyright and license information, * 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('reports/category_statuses.tpl.html'); Auth::checkAuthentication(); if (!Access::canAccessReports(Auth::getUserID())) { echo 'Invalid role'; exit; } // TODO: move this query to some class $prj_id = Auth::getCurrentProject(); $categories = Category::getAssocList($prj_id); $statuses = Status::getAssocStatusList($prj_id, true); $data = array(); foreach ($categories as $cat_id => $cat_title) { $data[$cat_id] = array('title' => $cat_title, 'statuses' => array()); foreach ($statuses as $sta_id => $sta_title) { $sql = 'SELECT count(*) FROM {{%issue}} WHERE iss_prj_id = ? AND iss_sta_id = ? AND iss_prc_id = ?'; try { $res = DB_Helper::getInstance()->getOne($sql, array($prj_id, $sta_id, $cat_id)); } catch (DbException $e) {
/** * Method is called to return the list of statuses valid for a specific issue. * * @param integer $prj_id The projectID * @param integer $issue_id The ID of the issue. * @return array An associative array of statuses valid for this issue. */ function getAllowedStatuses($prj_id, $issue_id) { $statuses = Status::getAssocStatusList($prj_id, true); // you should perform any logic and remove any statuses you need to here. return $statuses; }
// | 59 Temple Place - Suite 330 | // | Boston, MA 02111-1307, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ // // @(#) $Id: s.searchbar.php 1.3 03/09/26 02:06:54-00:00 jpradomaia $ // include_once "config.inc.php"; include_once APP_INC_PATH . "db_access.php"; include_once APP_INC_PATH . "class.template.php"; include_once APP_INC_PATH . "class.auth.php"; include_once APP_INC_PATH . "class.category.php"; include_once APP_INC_PATH . "class.priority.php"; include_once APP_INC_PATH . "class.misc.php"; include_once APP_INC_PATH . "class.release.php"; include_once APP_INC_PATH . "class.project.php"; include_once APP_INC_PATH . "class.filter.php"; include_once APP_INC_PATH . "class.status.php"; $tpl = new Template_API(); $tpl->setTemplate("searchbar.tpl.html"); Auth::checkAuthentication(APP_COOKIE); $prj_id = Auth::getCurrentProject(); $tpl->assign("priorities", Priority::getList($prj_id)); $tpl->assign("status", Status::getAssocStatusList($prj_id)); $tpl->assign("users", Project::getUserAssocList($prj_id)); $tpl->assign("categories", Category::getAssocList($prj_id)); $tpl->assign("custom", Filter::getListing($prj_id)); $options = Issue::saveSearchParams(); $tpl->assign("options", $options); $tpl->displayTemplate();
/** * Method is called to return the list of statuses valid for a specific issue. * * @param integer $prj_id The projectID * @param integer $issue_id The ID of the issue. * @return array An associative array of statuses valid for this issue. */ public function getAllowedStatuses($prj_id, $issue_id) { return Status::getAssocStatusList($prj_id, false); }
$tpl->setTemplate("reports/stalled_issues.tpl.html"); Auth::checkAuthentication(APP_COOKIE); if (Auth::getCurrentRole() <= User::getRoleID("Customer")) { echo "Invalid role"; exit; } $prj_id = Auth::getCurrentProject(); if (count(@$_REQUEST['before']) < 1) { $before = date("Y-m-d", time() - MONTH); } else { $before = join('-', $_REQUEST['before']); } if (count(@$_REQUEST['after']) < 1) { $after = date("Y-m-d", time() - YEAR); } else { $after = join('-', $_REQUEST['after']); } if (empty($_REQUEST['sort_order'])) { $_REQUEST['sort_order'] = 'ASC'; } $data = Report::getStalledIssuesByUser($prj_id, @$_REQUEST['developers'], @$_REQUEST['status'], $before, $after, $_REQUEST['sort_order']); $groups = Group::getAssocList($prj_id); $assign_options = array(); if (count($groups) > 0 && Auth::getCurrentRole() > User::getRoleID("Customer")) { foreach ($groups as $grp_id => $grp_name) { $assign_options["grp:{$grp_id}"] = "Group: " . $grp_name; } } $assign_options += Project::getUserAssocList($prj_id, 'active', User::getRoleID('Standard User')); $tpl->assign(array("users" => $assign_options, "before_date" => $before, "after_date" => $after, "data" => $data, "developers" => @$_REQUEST['developers'], "status_list" => Status::getAssocStatusList($prj_id), "status" => @$_REQUEST['status'], "sort_order" => $_REQUEST['sort_order'])); $tpl->displayTemplate();
$show_category = 0; } $cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE); if (!empty($auto_switched_from)) { $tpl->assign(array("project_auto_switched" => 1, "old_project" => Project::getName($auto_switched_from))); } $setup = Setup::load(); $tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]); $tpl->assign(array('next_issue' => @$sides['next'], 'previous_issue' => @$sides['previous'], 'subscribers' => Notification::getSubscribers($issue_id), 'custom_fields' => Custom_Field::getListByIssue($prj_id, $issue_id), 'files' => Attachment::getList($issue_id), 'emails' => Support::getEmailsByIssue($issue_id), 'zones' => Date_API::getTimezoneList(), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'ema_id' => Email_Account::getEmailAccount(), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'show_releases' => $show_releases, 'show_category' => $show_category, 'categories' => Category::getAssocList($prj_id), 'quarantine' => Issue::getQuarantineInfo($issue_id))); if ($role_id != User::getRoleID('customer')) { if (@$_REQUEST['show_all_drafts'] == 1) { $show_all_drafts = true; } else { $show_all_drafts = false; } if (Workflow::hasWorkflowIntegration($prj_id)) { $statuses = Workflow::getAllowedStatuses($prj_id, $issue_id); // if currently selected release is not on list, go ahead and add it. } else { $statuses = Status::getAssocStatusList($prj_id); } if (!empty($details['iss_sta_id']) && empty($statuses[$details['iss_sta_id']])) { $statuses[$details['iss_sta_id']] = Status::getStatusTitle($details['iss_sta_id']); } $time_entries = Time_Tracking::getListing($issue_id); $tpl->assign(array('notes' => Note::getListing($issue_id), 'is_user_assigned' => Issue::isAssignedToUser($issue_id, $usr_id), 'is_user_authorized' => Authorized_Replier::isUserAuthorizedReplier($issue_id, $usr_id), 'phone_entries' => Phone_Support::getListing($issue_id), 'phone_categories' => Phone_Support::getCategoryAssocList($prj_id), 'checkins' => SCM::getCheckinList($issue_id), 'time_categories' => Time_Tracking::getAssocCategories(), 'time_entries' => $time_entries['list'], 'total_time_spent' => $time_entries['total_time_spent'], 'impacts' => Impact_Analysis::getListing($issue_id), 'statuses' => $statuses, 'drafts' => Draft::getList($issue_id, $show_all_drafts), 'groups' => Group::getAssocList($prj_id))); } } } } $tpl->displayTemplate();
// customers should not be able to see this page $role_id = Auth::getCurrentRole(); if ($role_id < User::getRoleID('Standard User')) { Auth::redirect(APP_RELATIVE_URL . "list.php"); } $prj_id = Auth::getCurrentProject(); // 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("" => "Any", "-1" => "un-assigned", "-2" => "myself and un-assigned"); if (User::getGroupID(Auth::getUserID()) != '') { $assign_options['-3'] = 'myself and my group'; $assign_options['-4'] = '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), "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))); if (!empty($HTTP_GET_VARS["custom_id"])) { $check_perm = true; if (Filter::isGlobal($HTTP_GET_VARS["custom_id"])) { if ($role_id >= User::getRoleID('Manager')) { $check_perm = false; } } $tpl->assign("options", Filter::getDetails($HTTP_GET_VARS["custom_id"], $check_perm)); } $tpl->displayTemplate();
/** * Method used to get an associative array of the list of statuses and the * total number of issues associated with each of them. * * @access public * @return array List of statuses */ function getAssocStatus() { $prj_id = Auth::getCurrentProject(); $list = Status::getAssocStatusList($prj_id); $stats = array(); foreach ($list as $sta_id => $sta_title) { $stmt = "SELECT\n COUNT(*) AS total_items\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n WHERE\n iss_prj_id={$prj_id} AND\n iss_sta_id=" . $sta_id; $res = (int) $GLOBALS["db_api"]->dbh->getOne($stmt); if ($res > 0) { $stats[$sta_title] = $res; } } arsort($stats); return $stats; }
Misc::setMessage($update_tpl->getTemplateContents(false), Misc::MSG_HTML_BOX); } Auth::redirect(APP_RELATIVE_URL . 'view.php?id=' . $issue_id); exit; } $prj_id = Auth::getCurrentProject(); // if currently selected release is in the past, manually add it to list $releases = Release::getAssocList($prj_id); if ($details['iss_pre_id'] != 0 && empty($releases[$details['iss_pre_id']])) { $releases = array($details['iss_pre_id'] => $details['pre_title']) + $releases; } if (Workflow::hasWorkflowIntegration($prj_id)) { $statuses = Workflow::getAllowedStatuses($prj_id, $issue_id); // if currently selected release is not on list, go ahead and add it. } else { $statuses = Status::getAssocStatusList($prj_id, false); } if (!empty($details['iss_sta_id']) && empty($statuses[$details['iss_sta_id']])) { $statuses[$details['iss_sta_id']] = Status::getStatusTitle($details['iss_sta_id']); } $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'); } $categories = Category::getAssocList($prj_id); if (count($categories) > 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::getAssocList($prj_id);
// 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();
/** * Method used to update the details of the project information. * * @access public * @return integer 1 if the update worked, -1 otherwise */ function update() { global $HTTP_POST_VARS; if (Validation::isWhitespace($HTTP_POST_VARS["title"])) { return -2; } $stmt = "UPDATE\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project\n SET\n prj_title='" . Misc::escapeString($HTTP_POST_VARS["title"]) . "',\n prj_status='" . Misc::escapeString($HTTP_POST_VARS["status"]) . "',\n prj_lead_usr_id=" . Misc::escapeInteger($HTTP_POST_VARS["lead_usr_id"]) . ",\n prj_initial_sta_id=" . Misc::escapeInteger($HTTP_POST_VARS["initial_status"]) . ",\n prj_outgoing_sender_name='" . Misc::escapeString($HTTP_POST_VARS["outgoing_sender_name"]) . "',\n prj_outgoing_sender_email='" . Misc::escapeString($HTTP_POST_VARS["outgoing_sender_email"]) . "',\n prj_remote_invocation='" . Misc::escapeString($HTTP_POST_VARS["remote_invocation"]) . "',\n prj_segregate_reporter='" . Misc::escapeString($HTTP_POST_VARS["segregate_reporter"]) . "',\n prj_customer_backend='" . Misc::escapeString($HTTP_POST_VARS["customer_backend"]) . "',\n prj_workflow_backend='" . Misc::escapeString($HTTP_POST_VARS["workflow_backend"]) . "'\n WHERE\n prj_id=" . Misc::escapeInteger($HTTP_POST_VARS["id"]); $res = $GLOBALS["db_api"]->dbh->query($stmt); if (PEAR::isError($res)) { Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); return -1; } else { // START ETEL MODIFIED /* This is terrible right here: Project::removeUserByProjects(array($HTTP_POST_VARS["id"]), $HTTP_POST_VARS["users"]); for ($i = 0; $i < count($HTTP_POST_VARS["users"]); $i++) { if ($HTTP_POST_VARS["users"][$i] == $HTTP_POST_VARS["lead_usr_id"]) { Project::associateUser($HTTP_POST_VARS["id"], $HTTP_POST_VARS["users"][$i], User::getRoleID("Manager")); } elseif (User::getRoleByUser($HTTP_POST_VARS["users"][$i], $HTTP_POST_VARS["id"]) == '') { // users who are now being associated with this project should be set to 'Standard User' Project::associateUser($HTTP_POST_VARS["id"], $HTTP_POST_VARS["users"][$i], User::getRoleID("Standard User")); } } */ // END ETEL MODIFIED $statuses = array_keys(Status::getAssocStatusList($HTTP_POST_VARS["id"])); if (count($statuses) > 0) { Status::removeProjectAssociations($statuses, $HTTP_POST_VARS["id"]); } foreach ($HTTP_POST_VARS['statuses'] as $sta_id) { Status::addProjectAssociation($sta_id, $HTTP_POST_VARS["id"]); } return 1; } }
$tpl->setTemplate('reports/stalled_issues.tpl.html'); Auth::checkAuthentication(); if (!Access::canAccessReports(Auth::getUserID())) { echo 'Invalid role'; exit; } $prj_id = Auth::getCurrentProject(); if (count(@$_REQUEST['before']) < 1) { $before = date('Y-m-d', time() - Date_Helper::MONTH); } else { $before = implode('-', $_REQUEST['before']); } if (count(@$_REQUEST['after']) < 1) { $after = date('Y-m-d', time() - Date_Helper::YEAR); } else { $after = implode('-', $_REQUEST['after']); } if (empty($_REQUEST['sort_order'])) { $_REQUEST['sort_order'] = 'ASC'; } $data = Report::getStalledIssuesByUser($prj_id, @$_REQUEST['developers'], @$_REQUEST['status'], $before, $after, $_REQUEST['sort_order']); $groups = Group::getAssocList($prj_id); $assign_options = array(); if (count($groups) > 0 && Auth::getCurrentRole() > User::ROLE_CUSTOMER) { foreach ($groups as $grp_id => $grp_name) { $assign_options["grp:{$grp_id}"] = 'Group: ' . $grp_name; } } $assign_options += Project::getUserAssocList($prj_id, 'active', User::ROLE_USER); $tpl->assign(array('users' => $assign_options, 'before_date' => $before, 'after_date' => $after, 'data' => $data, 'developers' => @$_REQUEST['developers'], 'status_list' => Status::getAssocStatusList($prj_id), 'status' => @$_REQUEST['status'], 'sort_order' => $_REQUEST['sort_order'])); $tpl->displayTemplate();
if (@$HTTP_GET_VARS["cat"] == "edit") { $info = Reminder_Condition::getDetails($HTTP_GET_VARS["id"]); if (!empty($HTTP_GET_VARS['field'])) { $info['rlc_rmf_id'] = $HTTP_GET_VARS['field']; } else { $HTTP_GET_VARS['field'] = $info['rlc_rmf_id']; } $tpl->assign("info", $info); } if (!empty($HTTP_GET_VARS['field'])) { $field_title = Reminder_Condition::getFieldTitle($HTTP_GET_VARS['field']); if (Reminder_Condition::canFieldBeCompared($HTTP_GET_VARS['field'])) { $tpl->assign(array('show_field_options' => 'yes', 'comparable_fields' => Reminder_Condition::getFieldAdminList(true))); } elseif (strtolower($field_title) == 'status') { $prj_id = Reminder::getProjectID($rem_id); $tpl->assign(array('show_status_options' => 'yes', 'statuses' => Status::getAssocStatusList($prj_id))); } elseif (strtolower($field_title) == 'category') { $prj_id = Reminder::getProjectID($rem_id); $tpl->assign(array('show_category_options' => 'yes', 'categories' => Category::getAssocList($prj_id))); } else { $tpl->assign('show_status_options', 'no'); } if (@$HTTP_GET_VARS["cat"] != "edit") { $tpl->assign('info', array('rlc_rmf_id' => $HTTP_GET_VARS['field'], 'rlc_rmo_id' => '', 'rlc_value' => '')); } } $tpl->assign("rem_id", $rem_id); $tpl->assign("rma_id", $rma_id); $tpl->assign("rem_title", Reminder::getTitle($rem_id)); $tpl->assign("rma_title", Reminder_Action::getTitle($rma_id)); $tpl->assign("fields", Reminder_Condition::getFieldAdminList());
/** * Method used to update the details of the project information. * * @return integer 1 if the update worked, -1 otherwise */ public static function update() { if (Validation::isWhitespace($_POST['title'])) { return -2; } $stmt = 'UPDATE {{%project}} SET prj_title=?, prj_status=?, prj_lead_usr_id=?, prj_initial_sta_id=?, prj_outgoing_sender_name=?, prj_outgoing_sender_email=?, prj_mail_aliases=?, prj_remote_invocation=?, prj_segregate_reporter=?, prj_customer_backend=?, prj_workflow_backend=? WHERE prj_id=?'; try { DB_Helper::getInstance()->query($stmt, array($_POST['title'], $_POST['status'], $_POST['lead_usr_id'], $_POST['initial_status'], $_POST['outgoing_sender_name'], $_POST['outgoing_sender_email'], $_POST['mail_aliases'], $_POST['remote_invocation'], $_POST['segregate_reporter'], $_POST['customer_backend'], $_POST['workflow_backend'], $_POST['id'])); } catch (DbException $e) { return -1; } self::removeUserByProjects(array($_POST['id']), $_POST['users']); foreach ($_POST['users'] as $user) { if ($user == $_POST['lead_usr_id']) { self::associateUser($_POST['id'], $user, User::getRoleID('Manager')); } elseif (User::getRoleByUser($user, $_POST['id']) == '') { // users who are now being associated with this project should be set to 'Standard User' self::associateUser($_POST['id'], $user, User::getRoleID('Standard User')); } } $statuses = array_keys(Status::getAssocStatusList($_POST['id'])); if (count($statuses) > 0) { Status::removeProjectAssociations($statuses, $_POST['id']); } foreach ($_POST['statuses'] as $sta_id) { Status::addProjectAssociation($sta_id, $_POST['id']); } return 1; }
/** * Method is called to return the list of statuses valid for a specific issue. * * @param integer $prj_id The projectID * @param integer $issue_id The ID of the issue. * @return array An associative array of statuses valid for this issue. */ function getAllowedStatuses($prj_id, $issue_id) { echo "Workflow: Returning allowed statuses<br />\n"; $statuses = Status::getAssocStatusList($prj_id, false); unset($statuses[4], $statuses[3]); // you should perform any logic and remove any statuses you need to here. return $statuses; }
$tpl->setTemplate("manage/index.tpl.html"); Auth::checkAuthentication(APP_COOKIE); $tpl->assign("type", "customize_listing"); $role_id = Auth::getCurrentRole(); if ($role_id == User::getRoleID('administrator')) { $tpl->assign("show_setup_links", true); if (@$HTTP_POST_VARS["cat"] == "new") { $tpl->assign("result", Status::insertCustomization($HTTP_POST_VARS['project'], $HTTP_POST_VARS['status'], $HTTP_POST_VARS['date_field'], $HTTP_POST_VARS['label'])); } elseif (@$HTTP_POST_VARS["cat"] == "update") { $tpl->assign("result", Status::updateCustomization($HTTP_POST_VARS['id'], $HTTP_POST_VARS['project'], $HTTP_POST_VARS['status'], $HTTP_POST_VARS['date_field'], $HTTP_POST_VARS['label'])); } elseif (@$HTTP_POST_VARS["cat"] == "delete") { Status::removeCustomization($HTTP_POST_VARS['items']); } if (@$HTTP_GET_VARS["cat"] == "edit") { $details = Status::getCustomizationDetails($HTTP_GET_VARS["id"]); $tpl->assign(array("info" => $details, 'project_id' => $details['psd_prj_id'], 'status_list' => Status::getAssocStatusList($details['psd_prj_id'], TRUE))); } $display_customer_fields = false; @($prj_id = $HTTP_POST_VARS["prj_id"] ? $HTTP_POST_VARS["prj_id"] : $HTTP_GET_VARS["prj_id"]); if (!empty($prj_id)) { $tpl->assign("status_list", Status::getAssocStatusList($prj_id, TRUE)); $tpl->assign('project_id', $prj_id); $display_customer_fields = Customer::hasCustomerIntegration($prj_id); } $tpl->assign("date_fields", Issue::getDateFieldsAssocList($display_customer_fields)); $tpl->assign("project_list", Project::getAll()); $tpl->assign("list", Status::getCustomizationList()); } else { $tpl->assign("show_not_allowed_msg", true); } $tpl->displayTemplate();
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();
continue; } $field = Custom_Field::getDetails($fld_id); if ($field['fld_type'] == 'combo' || $field['fld_type'] == 'multiple') { $custom_fields_display[$fld_id] = join(', ', Custom_Field::getOptions($fld_id, $search_value)); } } } $list = Issue::getListing($prj_id, $options, $pagerRow, $rows); $tpl->assign("list", $list["list"]); $tpl->assign("list_info", $list["info"]); $tpl->assign("csv_data", base64_encode(@$list["csv"])); $tpl->assign("columns", Display_Column::getColumnsToDisplay($prj_id, 'list_issues')); $tpl->assign("priorities", Priority::getAssocList($prj_id)); $tpl->assign("status", Status::getAssocStatusList($prj_id)); $tpl->assign("open_status", Status::getAssocStatusList($prj_id, true)); $tpl->assign("users", $users); $tpl->assign("assign_options", $assign_options); $tpl->assign("custom", Filter::getAssocList($prj_id)); $tpl->assign("csts", Filter::getListing(true)); $tpl->assign("filter_info", Filter::getFiltersInfo()); $tpl->assign("categories", Category::getAssocList($prj_id)); $tpl->assign("releases", Release::getAssocList($prj_id, true)); $tpl->assign("available_releases", Release::getAssocList($prj_id)); $tpl->assign("groups", $groups); $tpl->assign("custom_fields_display", $custom_fields_display); $tpl->assign("reporters", Project::getReporters($prj_id)); $prefs = Prefs::get($usr_id); $tpl->assign("refresh_rate", $prefs['list_refresh_rate'] * 60); $tpl->assign("refresh_page", "list.php"); $tpl->displayTemplate();