function updateMantisBugStatusById($bug_id, $status) { $bug = bug_get($bug_id); $bug->status = $status; $result = bug_update($bug_id, $bug); return $result; }
function displayResultsCore($query, $fields) { $result = db_query_bound($query); $nbRows = 0; while ($row = db_fetch_array($result)) { $nbRows++; $t_bug = bug_get($row['id']); print "<tr> \n"; print '<td><a href="' . string_get_bug_view_url($row['id']) . '">' . bug_format_id($row['id']) . '</a></td>'; //print "<td> ".string_get_bug_view_url( ))." </td>\n"; print "<td> " . string_display_line(get_enum_element('status', $t_bug->status)) . " </td>\n"; print "<td> " . category_get_row($t_bug->category_id)['name'] . " </td>\n"; print "<td> " . $t_bug->summary . " </td>\n"; print "<td> " . user_get_field($t_bug->reporter_id, 'username') . " </td>\n"; if ($t_bug->handler_id != null) { print "<td> " . user_get_field($t_bug->handler_id, 'username') . " </td>\n"; } if (sizeof($fields) > 0) { for ($i = 0; $i < sizeof($fields); $i++) { print "<td> " . $row[$fields[$i]] . " </td>\n"; } } print "</tr>\n"; } return $nbRows; }
/** * Posts a twitter update when a bug is resolved. * * @param $p_bug_id The bug id that was resolved. * @access public */ function twitter_issue_resolved($p_bug_id) { if (!twitter_enabled()) { return true; } $t_bug = bug_get($p_bug_id, false); # Do not twitter except fixed issues if ($t_bug->resolution < config_get('bug_resolution_fixed_threshold') || $t_bug->resolution >= config_get('bug_resolution_not_fixed_threshold')) { return true; } # Do not twitter private bugs. if ($t_bug->view_state != VS_PUBLIC) { return true; } # Do not twitter bugs belonging to private projects. if (VS_PRIVATE == project_get_field($t_bug->project_id, 'view_state')) { return true; } $c_bug_id = db_prepare_int($p_bug_id); if (is_blank($t_bug->fixed_in_version)) { $t_message = sprintf(lang_get('twitter_resolved_no_version'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id)); } else { $t_message = sprintf(lang_get('twitter_resolved'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id), $t_bug->fixed_in_version); } return twitter_update($t_message); }
function custom_function_default_roadmap_print_issue($p_issue_id, $p_issue_level = 0) { static $t_status; $t_bug = bug_get($p_issue_id); if (bug_is_resolved($p_issue_id)) { $t_strike_start = '<strike>'; $t_strike_end = '</strike>'; } else { $t_strike_start = $t_strike_end = ''; } if ($t_bug->category_id) { $t_category_name = category_get_name($t_bug->category_id); } else { $t_category_name = ''; } $t_category = is_blank($t_category_name) ? '' : '<b>[' . string_display_line($t_category_name) . ']</b> '; echo utf8_str_pad('', $p_issue_level * 6, ' '), '- ', $t_strike_start, string_get_bug_view_link($p_issue_id), ': ', $t_category, string_display_line_links($t_bug->summary); if ($t_bug->handler_id != 0) { echo ' (', prepare_user_name($t_bug->handler_id), ')'; } if (!isset($t_status[$t_bug->status])) { $t_status[$t_bug->status] = get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id); } echo ' - ', $t_status[$t_bug->status], $t_strike_end, '.<br />'; }
function custom_function_default_changelog_print_issue($p_issue_id) { $t_bug = bug_get($p_issue_id); echo '- ', string_get_bug_view_link($p_issue_id), ': <b>[', $t_bug->category, ']</b> ', string_attribute($t_bug->summary); if ($t_bug->handler_id != 0) { echo ' (', prepare_user_name($t_bug->handler_id), ')'; } echo '<br />'; }
/** * @param $bug_id * @param $version_date * @return array */ function get_bug_description($bug_id, $version_date) { $specmanagement_database_api = new specmanagement_database_api(); $description_value = null; $bug = bug_get($bug_id); $value_type = 1; $description_value = $specmanagement_database_api->calculate_last_text_fields($bug_id, $version_date, $value_type); if (strlen($description_value) == 0) { $description_value = $bug->description; } return $description_value; }
/** * Get all details about an issue. * * @param string $p_username The name of the user trying to access the issue. * @param string $p_password The password of the user. * @param integer $p_issue_id The id of the issue to retrieve. * @return Array that represents an IssueData structure */ function mc_issue_get($p_username, $p_password, $p_issue_id) { $t_user_id = mci_check_login($p_username, $p_password); if ($t_user_id === false) { return mci_soap_fault_login_failed(); } $t_lang = mci_get_user_lang($t_user_id); if (!bug_exists($p_issue_id)) { return new soap_fault('Client', '', 'Issue does not exist.'); } $t_project_id = bug_get_field($p_issue_id, 'project_id'); if (!mci_has_readonly_access($t_user_id, $t_project_id)) { return mci_soap_fault_access_denied($t_user_id); } $t_bug = bug_get($p_issue_id, true); $t_issue_data = array(); $t_issue_data['id'] = $p_issue_id; $t_issue_data['view_state'] = mci_enum_get_array_by_id($t_bug->view_state, 'view_state', $t_lang); $t_issue_data['last_updated'] = timestamp_to_iso8601($t_bug->last_updated); $t_issue_data['project'] = mci_project_as_array_by_id($t_bug->project_id); $t_issue_data['category'] = mci_get_category($t_bug->category_id); $t_issue_data['priority'] = mci_enum_get_array_by_id($t_bug->priority, 'priority', $t_lang); $t_issue_data['severity'] = mci_enum_get_array_by_id($t_bug->severity, 'severity', $t_lang); $t_issue_data['status'] = mci_enum_get_array_by_id($t_bug->status, 'status', $t_lang); $t_issue_data['reporter'] = mci_account_get_array_by_id($t_bug->reporter_id); $t_issue_data['summary'] = $t_bug->summary; $t_issue_data['version'] = mci_null_if_empty($t_bug->version); $t_issue_data['build'] = mci_null_if_empty($t_bug->build); $t_issue_data['platform'] = mci_null_if_empty($t_bug->platform); $t_issue_data['os'] = mci_null_if_empty($t_bug->os); $t_issue_data['os_build'] = mci_null_if_empty($t_bug->os_build); $t_issue_data['reproducibility'] = mci_enum_get_array_by_id($t_bug->reproducibility, 'reproducibility', $t_lang); $t_issue_data['date_submitted'] = timestamp_to_iso8601($t_bug->date_submitted); $t_issue_data['sponsorship_total'] = $t_bug->sponsorship_total; if (!empty($t_bug->handler_id)) { $t_issue_data['handler'] = mci_account_get_array_by_id($t_bug->handler_id); } $t_issue_data['projection'] = mci_enum_get_array_by_id($t_bug->projection, 'projection', $t_lang); $t_issue_data['eta'] = mci_enum_get_array_by_id($t_bug->eta, 'eta', $t_lang); $t_issue_data['resolution'] = mci_enum_get_array_by_id($t_bug->resolution, 'resolution', $t_lang); $t_issue_data['fixed_in_version'] = mci_null_if_empty($t_bug->fixed_in_version); $t_issue_data['target_version'] = mci_null_if_empty($t_bug->target_version); $t_issue_data['due_date'] = mci_issue_get_due_date($t_bug); $t_issue_data['description'] = $t_bug->description; $t_issue_data['steps_to_reproduce'] = mci_null_if_empty($t_bug->steps_to_reproduce); $t_issue_data['additional_information'] = mci_null_if_empty($t_bug->additional_information); $t_issue_data['attachments'] = mci_issue_get_attachments($p_issue_id); $t_issue_data['relationships'] = mci_issue_get_relationships($p_issue_id, $t_user_id); $t_issue_data['notes'] = mci_issue_get_notes($p_issue_id); $t_issue_data['custom_fields'] = mci_issue_get_custom_fields($p_issue_id); return $t_issue_data; }
public function populate_from_db() { /** * Populates the Bug instance based on what's in the Mantis DB. */ $bugdata = bug_get($this->bug_id, TRUE); foreach (Bug::$mantis_attrs as $a) { $this->mantis_data[$a] = $bugdata->{$a}; } foreach (Bug::$rsrc_attrs as $a) { $this->rsrc_data[$a] = $this->_get_rsrc_attr($a); } }
function custom_function_default_roadmap_print_issue($p_issue_id, $p_issue_level = 0) { $t_bug = bug_get($p_issue_id); if (bug_is_resolved($p_issue_id)) { $t_strike_start = '<strike>'; $t_strike_end = '</strike>'; } else { $t_strike_start = $t_strike_end = ''; } $t_category = is_blank($t_bug->category) ? '' : '<b>[' . $t_bug->category . ']</b> '; echo str_pad('', $p_issue_level * 6, ' '), '- ', $t_strike_start, string_get_bug_view_link($p_issue_id), ': ', $t_category, string_display_line_links($t_bug->summary); if ($t_bug->handler_id != 0) { echo ' (', prepare_user_name($t_bug->handler_id), ')'; } echo ' - ', get_enum_element('status', $t_bug->status), $t_strike_end, '.<br />'; }
/** * Builds notification emails for the selected customers about changes made in bugs reports they are linked to * * @param array $customer_ids the ids of the customer to notify * @param string $from the start of the interval * @param string $to the end of the interval * * @return array notified customers */ static function buildNotificationEmails($customer_ids, $from, $to) { $emails = array(); lang_push(plugin_config_get('email_notification_language')); $fromDate = self::startOfDay(strtotime($from)); $toDate = self::endOfDay(strtotime($to)); $changedBugIds = CustomerManagementDao::findAllChangedBugIds($customer_ids, $fromDate, $toDate); $dateFormat = config_get('short_date_format'); foreach ($customer_ids as $customer_id) { $changesForCustomer = array(); foreach ($changedBugIds as $changedBugId) { if ($changedBugId['customer_id'] == $customer_id) { $changesForCustomer[] = array('bug' => bug_get($changedBugId['bug_id'])); } } if (count($changesForCustomer) > 0) { $counter = 0; $text = ''; foreach ($changesForCustomer as $changeForCustomer) { $counter++; $bugId = $changeForCustomer['bug']->id; $text .= $counter . '. '; $text .= sprintf(plugin_lang_get('email_notification_bug_header'), $changeForCustomer['bug']->id, $changeForCustomer['bug']->summary, date($dateFormat, $changeForCustomer['bug']->date_submitted), get_enum_element('status', $changeForCustomer['bug']->status)); $text .= "\n"; $reporterName = user_get_name($changeForCustomer['bug']->reporter_id); $reporterEmail = user_get_email($changeForCustomer['bug']->reporter_id); $text .= sprintf(plugin_lang_get('email_notification_bug_reported_by'), $reporterName, $reporterEmail); $text .= "\n"; $text .= sprintf(plugin_lang_get('email_notification_bug_description'), $changeForCustomer['bug']->description); $text .= "\n\n"; } $customer = CustomerManagementDao::getCustomer($customer_id); $email = new EmailData(); $email->email = $customer['email']; $email->subject = sprintf(plugin_lang_get('email_notification_title'), $customer['name'], $from, $to); $email->body = $text; $email->metadata['priority'] = config_get('mail_priority'); $email->metadata['charset'] = 'utf-8'; array_push($emails, $email); } } lang_pop(); return $emails; }
function worklogmenu() { if (ON == plugin_config_get('promote_text')) { $bugid = gpc_get_int('id'); if (access_has_bug_level(plugin_config_get('promote_threshold'), $bugid)) { $t_bug_p = bug_get($bugid, true); if (OFF == plugin_config_get('project_text')) { $proj_id = 0; } else { $proj_id = $t_bug_p->project_id; } $subject = urlencode($t_bug_p->description); $subject .= " "; $subject .= urlencode($t_bug_p->additional_information); $content = category_full_name($t_bug_p->category_id); $content .= " -> "; $content .= urlencode($t_bug_p->summary); if (ON == plugin_config_get('worklog_view_check')) { $import_page = 'worklog_add_page2.php'; } else { $import_page = 'worklog_add.php'; } $import_page .= '&log_type=0&'; $import_page .= '&ref_log_ids='; $import_page .= '&ref_issue_ids='; $import_page .= '&log_begin='; $import_page .= '&log_end='; $import_page .= '&content='; $import_page .= $content; $import_page .= '&subject='; $import_page .= $subject; $import_page .= '&project_id='; $import_page .= $proj_id; if (ON == plugin_config_get('worklog_view_check')) { return array(plugin_lang_get('import_worklog') => plugin_page($import_page) . '" target=_new>'); } else { return array(plugin_lang_get('import_worklog') => plugin_page($import_page)); } } } }
function display_bug_id($p_event, $p_text) { $p_bug_id = (int) $p_text; if (!bug_exists($p_bug_id)) { return $p_text; } $bug = bug_get($p_bug_id); $project = $bug->__get("project_id"); if ($project != plugin_config_get('project_id')) { return $p_text; } $p_field_id = plugin_config_get('field_id'); $prefix = plugin_config_get('prefix'); $has_parent = false; $t_bugs_ids = relationship_get_all_src($p_bug_id); foreach ($t_bugs_ids as $t_relaship) { if ($t_relaship->type == BUG_BLOCKS) { $has_parent = true; break; } } $t_bugs_ids = relationship_get_all_dest($p_bug_id); foreach ($t_bugs_ids as $t_relaship) { if ($t_relaship->type == BUG_DEPENDANT) { $has_parent = true; break; } } $prefix_two = plugin_config_get('prefix_two'); if ($has_parent) { $prefix = $prefix_two; } $p_def = custom_field_get_definition($p_field_id); $t_custom_field_value = custom_field_get_value($p_field_id, $p_bug_id); global $g_custom_field_type_definition; if (isset($g_custom_field_type_definition[$p_def['type']]['#function_string_value'])) { return $prefix . call_user_func($g_custom_field_type_definition[$p_def['type']]['#function_string_value'], $t_custom_field_value); } return $prefix . $t_custom_field_value; }
function faqmenu() { if (ON == plugin_config_get('promote_text')) { $bugid = gpc_get_int('id'); if (access_has_bug_level(plugin_config_get('promote_threshold'), $bugid)) { $t_bug_p = bug_get($bugid, true); if (OFF == plugin_config_get('project_text')) { $proj_id = 0; } else { $proj_id = $t_bug_p->project_id; } $answer = urlencode($t_bug_p->description); $answer .= " "; $answer .= urlencode($t_bug_p->additional_information); $question = category_full_name($t_bug_p->category_id); $question .= " -> "; $question .= urlencode($t_bug_p->summary); if (ON == plugin_config_get('faq_view_check')) { $import_page = 'faq_add_page2.php'; } else { $import_page = 'faq_add.php'; } $import_page .= '&question='; $import_page .= $question; $import_page .= '&answere='; $import_page .= $answer; $import_page .= '&project_id='; $import_page .= $proj_id; if (ON == plugin_config_get('faq_view_check')) { return array(plugin_lang_get('import_faq') => plugin_page($import_page) . '" target=_new>'); } else { return array(plugin_lang_get('import_faq') => plugin_page($import_page)); } } } }
function display_commit_message($event, $bugid) { if (!$bugid) { return; } $t_fields = config_get('bug_view_page_fields'); $t_fields = columns_filter_disabled($t_fields); $tpl_show_id = in_array('id', $t_fields); $tpl_show_description = in_array('description', $t_fields); $tpl_show_status = in_array('status', $t_fields); if ($tpl_show_id && $tpl_show_description && $tpl_show_status) { bug_ensure_exists($bugid); $bug = bug_get($bugid, true); access_ensure_bug_level(VIEWER, $bugid); $tpl_description = string_display_links($bug->summary); $tpl_status = get_enum_element('status', $bug->status); $tpl_link = config_get('path') . string_get_bug_view_url($bugid, null); $message = sprintf('%s - #JJ%d: %s<br/>%s', strtoupper($tpl_status), $bugid, $tpl_description, $tpl_link); echo '<tr ', helper_alternate_class(), '>'; echo '<td class="category">', plugin_lang_get('commit_message'), '</td>'; echo '<td colspan="5">' . $message . '</td>'; echo '</tr>'; } }
$t_bug_revisions = array_reverse(bug_revision_list($t_bug_id), true); $t_title = lang_get('issue_id') . $t_bug_id; } else { if ($f_bugnote_id) { $t_bug_id = bugnote_get_field($f_bugnote_id, 'bug_id'); $t_bug_data = bug_get($t_bug_id, true); $t_bug_revisions = bug_revision_list($t_bug_id, REV_ANY, $f_bugnote_id); $t_title = lang_get('bugnote') . ' ' . $f_bugnote_id; } else { if ($f_rev_id) { $t_bug_revisions = bug_revision_like($f_rev_id); if (count($t_bug_revisions) < 1) { trigger_error(ERROR_GENERIC, ERROR); } $t_bug_id = $t_bug_revisions[$f_rev_id]['bug_id']; $t_bug_data = bug_get($t_bug_id, true); $t_title = lang_get('issue_id') . $t_bug_id; } else { trigger_error(ERROR_GENERIC, ERROR); } } } function show_revision($t_revision) { static $s_can_drop = null; static $s_drop_token = null; static $s_user_access = null; if (is_null($s_can_drop)) { $s_can_drop = access_has_bug_level(config_get('bug_revision_drop_threshold'), $t_revision['bug_id']); $s_drop_token = form_security_param('bug_revision_drop'); }
/** * print a mailto: href link with subject * * @param string $p_email Email Address. * @param string $p_text Link text to display to user. * @param string $p_bug_id The bug identifier. * @return void */ function print_email_link_with_subject($p_email, $p_text, $p_bug_id) { $t_bug = bug_get($p_bug_id, true); if (!access_has_project_level(config_get('show_user_email_threshold', null, null, $t_bug->project_id), $t_bug->project_id)) { echo $p_text; return; } $t_subject = email_build_subject($p_bug_id); echo get_email_link_with_subject($p_email, $p_text, $t_subject); }
$t_form_name = 'bug_actiongroup_' . $f_action; form_security_validate($t_form_name); $t_custom_group_actions = config_get('custom_group_actions'); foreach ($t_custom_group_actions as $t_custom_group_action) { if ($f_action == $t_custom_group_action['action']) { require_once $t_custom_group_action['action_page']; exit; } } $t_failed_ids = array(); if (0 != $f_custom_field_id) { $t_custom_field_def = custom_field_get_definition($f_custom_field_id); } foreach ($f_bug_arr as $t_bug_id) { bug_ensure_exists($t_bug_id); $t_bug = bug_get($t_bug_id, true); if ($t_bug->project_id != helper_get_current_project()) { # in case the current project is not the same project of the bug we are viewing... # ... override the current project. This to avoid problems with categories and handlers lists etc. $g_project_override = $t_bug->project_id; # @todo (thraxisp) the next line goes away if the cache was smarter and used project config_flush_cache(); # flush the config cache so that configs are refetched } $t_status = $t_bug->status; switch ($f_action) { case 'CLOSE': $t_closed = config_get('bug_closed_status_threshold'); if (access_can_close_bug($t_bug)) { if ($t_status < $t_closed && bug_check_workflow($t_status, $t_closed)) { # @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) );
/** * hook function for system event EVENT_NOTIFY_USER_INCLUDE * @param string $p_event * @param int $p_param contains the bug_id * @return array */ function notify_group_users($p_event, $p_param) { $t_bug_id = $p_param; $t_bug = bug_get($t_bug_id); //collect all user ids that can hold groups $t_users = array() + bug_get_monitors($t_bug_id); $t_users[] = $t_bug->reporter_id; $t_users[] = $t_bug->handler_id; //exclude the native users $t_all_groups = $this->get_all_groups(TRUE); $t_notify_groups = array_merge(array_intersect($t_users, $t_all_groups)); //get the users from the group(s) $t_group_users = array(); for ($i = 0; $i < count($t_notify_groups); $i++) { $t_group_users = array_merge($t_group_users, $this->get_all_users_from_group($t_notify_groups[$i])); } return $t_group_users; }
# -------------------------------------------------------- require_once 'core.php'; $t_core_path = config_get('core_path'); require_once $t_core_path . 'bug_api.php'; require_once $t_core_path . 'custom_field_api.php'; require_once $t_core_path . 'file_api.php'; require_once $t_core_path . 'compress_api.php'; require_once $t_core_path . 'date_api.php'; require_once $t_core_path . 'relationship_api.php'; require_once $t_core_path . 'last_visited_api.php'; require_once $t_core_path . 'tag_api.php'; $f_bug_id = gpc_get_int('bug_id'); $f_history = gpc_get_bool('history', config_get('history_default_visible')); bug_ensure_exists($f_bug_id); access_ensure_bug_level(VIEWER, $f_bug_id); $t_bug = bug_prepare_display(bug_get($f_bug_id, true)); if ($t_bug->project_id != helper_get_current_project()) { # in case the current project is not the same project of the bug we are viewing... # ... override the current project. This to avoid problems with categories and handlers lists etc. $g_project_override = $t_bug->project_id; } if (SIMPLE_ONLY == config_get('show_view')) { print_header_redirect('bug_view_page.php?bug_id=' . $f_bug_id); } compress_enable(); html_page_top1(bug_format_summary($f_bug_id, SUMMARY_CAPTION)); html_page_top2(); print_recently_visited(); $t_access_level_needed = config_get('view_history_threshold'); $t_can_view_history = access_has_bug_level($t_access_level_needed, $f_bug_id); $t_bugslist = gpc_get_cookie(config_get('bug_list_cookie'), false);
$headers[VERIFY_RESULTS_CUR_MEM_UTIL] = lang_get('cur_mem_util'); $headers[VERIFY_RESULTS_TOTAL_PAGE_FILE] = lang_get('tot_page_file'); $headers[VERIFY_RESULTS_FREE_PAGE_FILE] = lang_get('free_page_file'); } $rows = results_get_verify_results_detail($test_run_id); /* foreach($rows as $key => $val) { print"$key = $val<br>"; } */ break; case "bugs": $headers = array(BUG_ID => lang_get('bug_id'), BUG_PRIORITY => lang_get('bug_priority'), BUG_SEVERITY => lang_get('bug_severity'), BUG_STATUS => lang_get('bug_status'), BUG_CATEGORY => lang_get('bug_category'), BUG_REPORTER => lang_get('reported_by'), BUG_ASSIGNED_TO => lang_get('assigned_to'), BUG_ASSIGNED_TO_DEVELOPER => lang_get('assigned_to_developer'), BUG_FOUND_IN_RELEASE => lang_get('found_in_release'), BUG_ASSIGN_TO_RELEASE => lang_get('assigned_to_release'), BUG_DESCRIPTION => lang_get('bug_description'), BUG_SUMMARY => lang_get('bug_summary')); $display_options = session_get_display_options("bug"); # We really should create a seperate function for csv/excel export $rows = bug_get($project_id, $page_number = 0, $display_options['order_by'], $display_options['order_dir'], $display_options['filter']['status'], $display_options['filter']['category'], $display_options['filter']['component'], $display_options['filter']['reported_by'], $display_options['filter']['assigned_to'], $display_options['filter']['assigned_to_developer'], $display_options['filter']['found_in_release'], $display_options['filter']['assigned_to_release']); break; case "test_steps": $headers = array(TEST_STEP_NO => lang_get('step_no'), TEST_STEP_ACTION => lang_get('step_action'), TEST_STEP_TEST_INPUTS => lang_get('test_inputs'), TEST_STEP_EXPECTED => lang_get('step_expected'), TEST_STEP_INFO_STEP => lang_get('info_step')); $s_test_details = session_get_properties("test"); $test_id = $s_test_details['test_id']; $rows = test_get_test_steps_for_export($test_id); break; default: exit; } if (IMPORT_EXPORT_TO_EXCEL) { if (isset($headers)) { # HEADER ROW $row = $rows[0]; $header = "";
do { $t_more = true; $t_row_count = count( $result ); for( $i = 0; $i < $t_row_count; $i++ ) { $t_row = $result[$i]; $t_bug = null; if ( is_blank( $f_export ) || in_array( $t_row->id, $f_bug_arr ) ) { echo excel_get_start_row(); foreach ( $t_columns as $t_column ) { if ( column_is_extended( $t_column ) ) { if ( $t_bug === null ) { $t_bug = bug_get( $t_row->id, /* extended = */ true ); } $t_function = 'excel_format_' . $t_column; echo $t_function( $t_bug->$t_column ); } else { $t_custom_field = column_get_custom_field_name( $t_column ); if ( $t_custom_field !== null ) { echo excel_format_custom_field( $t_row->id, $t_row->project_id, $t_custom_field ); } else { $t_function = 'excel_format_' . $t_column; echo $t_function( $t_row->$t_column ); } } }
<td class="form-title"><?php echo lang_get('amount'); ?> </td> <td class="form-title"><?php echo lang_get('status'); ?> </td> </tr> <?php $t_bug_list = array(); $t_total_owing = 0; $t_total_paid = 0; for ($i = 0; $i < $t_sponsor_count; ++$i) { $t_sponsor_row = $t_sponsors[$i]; $t_bug = bug_get($t_sponsor_row['bug']); $t_sponsor = sponsorship_get($t_sponsor_row['sponsor']); $t_buglist[] = $t_sponsor_row['bug'] . ':' . $t_sponsor_row['sponsor']; # describe bug $t_status = string_attribute(get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id)); $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id)); $t_version_id = version_get_id($t_bug->fixed_in_version, $t_bug->project_id); if (false !== $t_version_id && VERSION_RELEASED == version_get_field($t_version_id, 'released')) { $t_released_label = '<a title="' . lang_get('released') . '">' . $t_bug->fixed_in_version . '</a>'; } else { $t_released_label = $t_bug->fixed_in_version; } # choose color based on status $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id); echo '<tr class="' . $t_status_label . '">'; echo '<td><a href="' . string_get_bug_view_url($t_sponsor_row['bug']) . '">' . bug_format_id($t_sponsor_row['bug']) . '</a></td>';
# this page is invalid for the 'All Project' selection except if this is a clone if (ALL_PROJECTS == helper_get_current_project() && 0 == $f_master_bug_id) { print_header_redirect('login_select_proj_page.php?ref=bug_report_page.php'); } if (ADVANCED_ONLY == config_get('show_report')) { print_header_redirect('bug_report_advanced_page.php' . (0 == $f_master_bug_id) ? '' : '?m_id=' . $f_master_bug_id); } if ($f_master_bug_id > 0) { # master bug exists... bug_ensure_exists($f_master_bug_id); # master bug is not read-only... if (bug_is_readonly($f_master_bug_id)) { error_parameters($f_master_bug_id); trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR); } $t_bug = bug_prepare_edit(bug_get($f_master_bug_id, true)); # the user can at least update the master bug (needed to add the relationship)... access_ensure_bug_level(config_get('update_bug_threshold', null, $t_bug->project_id), $f_master_bug_id); #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of # what the current project is set to. if ($t_bug->project_id != helper_get_current_project()) { # in case the current project is not the same project of the bug we are viewing... # ... override the current project. This to avoid problems with categories and handlers lists etc. $g_project_override = $t_bug->project_id; $t_changed_project = true; } else { $t_changed_project = false; } access_ensure_project_level(config_get('report_bug_threshold')); $f_product_version = $t_bug->version; $f_category = $t_bug->category;
print"filter_search = $filter_search<br>"; */ html_window_title(); html_print_body(); html_page_title($project_name . " - " . lang_get('bug_page')); html_page_header($db, $project_name); html_print_menu(); bug_menu_print($page); error_report_check($_GET); print "<br>"; print "<form method='post' action='{$page}' name='bug_form'>" . NEWLINE; print "<div align=center>" . NEWLINE; html_print_bug_filter($project_id, $filter_bug_status, $filter_bug_category, $filter_bug_component, $filter_reported_by, $filter_assigned_to, $filter_assigned_to_dev, $filter_found_in_rel, $filter_assigned_to_rel, $filter_per_page, $filter_view_closed, $filter_search, $filter_jump); print "<br>" . NEWLINE; $g_timer->mark_time("Load rows to display on page from db into memory"); $row = bug_get($project_id, $page_number, $order_by, $order_dir, $filter_bug_status, $filter_bug_category, $filter_bug_component, $filter_reported_by, $filter_assigned_to, $filter_assigned_to_dev, $filter_found_in_rel, $filter_assigned_to_rel, $filter_per_page, $filter_view_closed, $filter_search, $filter_jump, $csv_export = "bugs"); print "</div>" . NEWLINE; $g_timer->mark_time("Finished load rows to display on page from db into memory"); if ($row) { print "<div align=center>" . NEWLINE; print "<table class=width100 rules=cols>" . NEWLINE; print "<tr class=tbl_header>" . NEWLINE; print "<th></th>" . NEWLINE; print "<th></th>" . NEWLINE; html_tbl_print_header(lang_get('bug_id'), BUG_ID, $order_by, $order_dir); html_tbl_print_header(lang_get('bug_priority'), BUG_PRIORITY, $order_by, $order_dir); html_tbl_print_header(lang_get('bug_status'), BUG_STATUS, $order_by, $order_dir); html_tbl_print_header(lang_get('bug_category'), BUG_CATEGORY, $order_by, $order_dir); html_tbl_print_header(lang_get('reported_by'), BUG_REPORTER, $order_by, $order_dir); html_tbl_print_header(lang_get('assigned_to'), BUG_ASSIGNED_TO, $order_by, $order_dir); #html_tbl_print_header( lang_get('found_in_release'), BUG_FOUND_IN_RELEASE, $order_by, $order_dir );
/** * Given a set of changeset objects, parse the bug links * and save the changes. * @param array Changeset objects * @param object Repository object */ function Source_Process_Changesets($p_changesets, $p_repo = null) { global $g_cache_current_user_id; if (!is_array($p_changesets)) { return; } if (is_null($p_repo)) { $t_repos = SourceRepo::load_by_changesets($p_changesets); } else { $t_repos = array($p_repo->id => $p_repo); } $t_resolved_threshold = config_get('bug_resolved_status_threshold'); $t_fixed_threshold = config_get('bug_resolution_fixed_threshold'); $t_notfixed_threshold = config_get('bug_resolution_not_fixed_threshold'); # Link author and committer name/email to user accounts foreach ($p_changesets as $t_key => $t_changeset) { $p_changesets[$t_key] = Source_Parse_Users($t_changeset); } # Parse normal bug links foreach ($p_changesets as $t_changeset) { $t_changeset->bugs = Source_Parse_Buglinks($t_changeset->message); } # Parse fixed bug links $t_fixed_bugs = array(); # Find and associate resolve links with the changeset foreach ($p_changesets as $t_changeset) { $t_bugs = Source_Parse_Bugfixes($t_changeset->message); foreach ($t_bugs as $t_bug_id) { $t_fixed_bugs[$t_bug_id] = $t_changeset; } # Add the link to the normal set of buglinks $t_changeset->bugs = array_unique(array_merge($t_changeset->bugs, $t_bugs)); } # Save changeset data before processing their consequences foreach ($p_changesets as $t_changeset) { $t_changeset->repo = $p_repo; $t_changeset->save(); } # Precache information for resolved bugs bug_cache_array_rows(array_keys($t_fixed_bugs)); $t_current_user_id = $g_cache_current_user_id; $t_enable_resolving = config_get('plugin_Source_enable_resolving'); $t_enable_message = config_get('plugin_Source_enable_message'); $t_enable_mapping = config_get('plugin_Source_enable_mapping'); $t_bugfix_status = config_get('plugin_Source_bugfix_status'); $t_bugfix_status_pvm = config_get('plugin_Source_bugfix_status_pvm'); $t_resolution = config_get('plugin_Source_bugfix_resolution'); $t_handler = config_get('plugin_Source_bugfix_handler'); $t_message_template = str_replace(array('$1', '$2', '$3', '$4', '$5', '$6'), array('%1$s', '%2$s', '%3$s', '%4$s', '%5$s', '%6$s'), config_get('plugin_Source_bugfix_message')); $t_mappings = array(); # Start fixing and/or resolving issues foreach ($t_fixed_bugs as $t_bug_id => $t_changeset) { # make sure the bug exists before processing if (!bug_exists($t_bug_id)) { continue; } # fake the history entries as the committer/author user ID $t_user_id = null; if ($t_changeset->committer_id > 0) { $t_user_id = $t_changeset->committer_id; } else { if ($t_changeset->user_id > 0) { $t_user_id = $t_changeset->user_id; } } if (!is_null($t_user_id)) { $g_cache_current_user_id = $t_user_id; } else { if (!is_null($t_current_user_id)) { $g_cache_current_user_id = $t_current_user_id; } else { $g_cache_current_user_id = 0; } } # generate the branch mappings $t_version = ''; $t_pvm_version_id = 0; if ($t_enable_mapping) { $t_repo_id = $t_changeset->repo_id; if (!isset($t_mappings[$t_repo_id])) { $t_mappings[$t_repo_id] = SourceMapping::load_by_repo($t_repo_id); } if (isset($t_mappings[$t_repo_id][$t_changeset->branch])) { $t_mapping = $t_mappings[$t_repo_id][$t_changeset->branch]; if (Source_PVM()) { $t_pvm_version_id = $t_mapping->apply_pvm($t_bug_id); } else { $t_version = $t_mapping->apply($t_bug_id); } } } # generate a note message if ($t_enable_message) { $t_message = sprintf($t_message_template, $t_changeset->branch, $t_changeset->revision, $t_changeset->timestamp, $t_changeset->message, $t_repos[$t_changeset->repo_id]->name, $t_changeset->id); } else { $t_message = ''; } $t_bug = bug_get($t_bug_id); # Update the resolution, fixed-in version, and/or add a bugnote $t_update = false; if (Source_PVM()) { if ($t_bugfix_status_pvm > 0 && $t_pvm_version_id > 0) { $t_matrix = new ProductMatrix($t_bug_id); if (isset($t_matrix->status[$t_pvm_version_id])) { $t_matrix->status[$t_pvm_version_id] = $t_bugfix_status_pvm; $t_matrix->save(); } } } else { if ($t_bugfix_status > 0 && $t_bug->status != $t_bugfix_status) { $t_bug->status = $t_bugfix_status; $t_update = true; } else { if ($t_enable_resolving && $t_bugfix_status == -1 && $t_bug->status < $t_resolved_threshold) { $t_bug->status = $t_resolved_threshold; $t_update = true; } } if ($t_bug->resolution < $t_fixed_threshold || $t_bug->resolution >= $t_notfixed_threshold) { $t_bug->resolution = $t_resolution; $t_update = true; } if (is_blank($t_bug->fixed_in_version)) { $t_bug->fixed_in_version = $t_version; $t_update = true; } } if ($t_handler && !is_null($t_user_id)) { $t_bug->handler_id = $t_user_id; } $t_private = plugin_config_get('bugfix_message_view_status') == VS_PRIVATE; if ($t_update) { if ($t_message) { bugnote_add($t_bug_id, $t_message, '0:00', $t_private, 0, '', null, false); } $t_bug->update(); } else { if ($t_message) { bugnote_add($t_bug_id, $t_message, '0:00', $t_private); } } } # reset the user ID $g_cache_current_user_id = $t_current_user_id; # Allow other plugins to post-process commit data event_signal('EVENT_SOURCE_COMMITS', array($p_changesets)); event_signal('EVENT_SOURCE_FIXED', array($t_fixed_bugs)); }
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org * @copyright Copyright (C) 2002 - 2012 MantisBT Team - mantisbt-dev@lists.sourceforge.net * @link http://www.mantisbt.org */ /** * MantisBT Core API's */ require_once 'core.php'; require_once 'bug_api.php'; require_once 'custom_field_api.php'; require_once 'date_api.php'; require_once 'string_api.php'; require_once 'last_visited_api.php'; $f_bug_id = gpc_get_int('bug_id'); bug_ensure_exists($f_bug_id); $tpl_bug = bug_get($f_bug_id, true); $t_selected_project = helper_get_current_project(); if ($tpl_bug->project_id != $t_selected_project) { # in case the current project is not the same project of the bug we are viewing... # ... override the current project. This to avoid problems with categories and handlers lists etc. $g_project_override = $tpl_bug->project_id; } access_ensure_bug_level(VIEWER, $f_bug_id); $t_fields = config_get('bug_print_page_fields'); $t_fields = columns_filter_disabled($t_fields); compress_enable(); $tpl_show_id = in_array('id', $t_fields); $tpl_show_project = in_array('project', $t_fields); $tpl_show_category = in_array('category_id', $t_fields); $tpl_show_date_submitted = in_array('date_submitted', $t_fields); $tpl_show_last_updated = in_array('last_updated', $t_fields);
/** * return formatted string with all the details on the requested relationship * @param integer $p_bug_id A bug identifier. * @param BugRelationshipData $p_relationship A bug relationship object. * @param boolean $p_html Whether to return html or text output. * @param boolean $p_html_preview Whether to include style/hyperlinks - if preview is false, we prettify the output. * @param boolean $p_show_project Show Project details. * @return string */ function relationship_get_details($p_bug_id, BugRelationshipData $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false) { $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 28; $t_icon_path = config_get('icon_path'); if ($p_bug_id == $p_relationship->src_bug_id) { # root bug is in the source side, related bug in the destination side $t_related_bug_id = $p_relationship->dest_bug_id; $t_related_project_name = project_get_name($p_relationship->dest_project_id); $t_relationship_descr = relationship_get_description_src_side($p_relationship->type); } else { # root bug is in the dest side, related bug in the source side $t_related_bug_id = $p_relationship->src_bug_id; $t_related_project_name = project_get_name($p_relationship->src_project_id); $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type); } # related bug not existing... if (!bug_exists($t_related_bug_id)) { return ''; } # user can access to the related bug at least as a viewer if (!access_has_bug_level(VIEWER, $t_related_bug_id)) { return ''; } if ($p_html_preview == false) { $t_td = '<td>'; } else { $t_td = '<td class="print">'; } # get the information from the related bug and prepare the link $t_bug = bug_get($t_related_bug_id, false); $t_status_string = get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id); $t_resolution_string = get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id); $t_relationship_info_html = $t_td . string_no_break($t_relationship_descr) . ' </td>'; if ($p_html_preview == false) { $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url($t_related_bug_id) . '">' . string_display_line(bug_format_id($t_related_bug_id)) . '</a></td>'; $t_relationship_info_html .= '<td><span class="issue-status" title="' . string_attribute($t_resolution_string) . '">' . string_display_line($t_status_string) . '</span></td>'; } else { $t_relationship_info_html .= $t_td . string_display_line(bug_format_id($t_related_bug_id)) . '</td>'; $t_relationship_info_html .= $t_td . string_display_line($t_status_string) . ' </td>'; } $t_relationship_info_text = utf8_str_pad($t_relationship_descr, 20); $t_relationship_info_text .= utf8_str_pad(bug_format_id($t_related_bug_id), 8); # get the handler name of the related bug $t_relationship_info_html .= $t_td; if ($t_bug->handler_id > 0) { $t_relationship_info_html .= string_no_break(prepare_user_name($t_bug->handler_id)); } $t_relationship_info_html .= ' </td>'; # add project name if ($p_show_project) { $t_relationship_info_html .= $t_td . string_display_line($t_related_project_name) . ' </td>'; } # add summary if ($p_html == true) { $t_relationship_info_html .= $t_td . string_display_line_links($t_bug->summary); if (VS_PRIVATE == $t_bug->view_state) { $t_relationship_info_html .= sprintf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private')); } } else { if (utf8_strlen($t_bug->summary) <= $t_summary_wrap_at) { $t_relationship_info_text .= string_email_links($t_bug->summary); } else { $t_relationship_info_text .= utf8_substr(string_email_links($t_bug->summary), 0, $t_summary_wrap_at - 3) . '...'; } } # add delete link if bug not read only and user has access level if (!bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && $p_html_preview == false) { if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) { $t_relationship_info_html .= ' [<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id . '&rel_id=' . $p_relationship->id . htmlspecialchars(form_security_param('bug_relationship_delete')) . '">' . lang_get('delete_link') . '</a>]'; } } $t_relationship_info_html .= ' </td>'; $t_relationship_info_text .= "\n"; if ($p_html_preview == false) { # choose color based on status $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id); $t_relationship_info_html = '<tr class="' . $t_status_label . '">' . $t_relationship_info_html . '</tr>' . "\n"; } else { $t_relationship_info_html = '<tr>' . $t_relationship_info_html . '</tr>'; } if ($p_html == true) { return $t_relationship_info_html; } else { return $t_relationship_info_text; } }
$t_user_notes = db_query_bound($sql_notes, array($t_bug['bug_id'], $t_bug['date_modified'])); #Si pas de notes on en rajoute une if (db_num_rows($t_user_notes) < 1) { $t_bugnote_text = sprintf(plugin_lang_get('before_change_status_message'), $t_status_names[$change['from_status']], $change['reminder_days'], $t_status_names[$change['to_status']], $change['status_days'] - $change['reminder_days']); bugnote_add($t_bug['bug_id'], $t_bugnote_text, '0:02', false, BUGNOTE, '', $g_cron_current_user_id); } } } #### # 2ème étape : Changement automatique des statuts ### if ($change['project_id'] != 0) { $t_bug_status_pool = db_query_bound($sql_status, array($change['from_status'], $change['from_status'], $change['project_id'], $change['status_days'])); } else { $t_bug_status_pool = db_query_bound($sql_status_no_project, array($change['from_status'], $change['from_status'], $change['status_days'])); } while ($t_bug_status = db_fetch_array($t_bug_status_pool)) { #On regarde si ces bugs ont été commenté dans la période $t_user_notes_status = db_query_bound($sql_notes, array($t_bug_status['bug_id'], $t_bug_status['date_modif'])); #Si pas de notes on en rajoute une if (db_num_rows($t_user_notes_status) < 1) { #Rajout d'une note informative $t_bugnote_text_status = sprintf(plugin_lang_get('change_status_message'), $change['status_days']); bugnote_add($t_bug_status['bug_id'], $t_bugnote_text_status, '0:02', false, BUGNOTE, '', $g_cron_current_user_id); #Changement du status du bug $t_bug_model = bug_get($t_bug_status['bug_id']); $t_bug_model->status = $change['to_status']; $t_bug_model->update(); } } }
require_api('profile_api.php'); require_api('project_api.php'); require_api('relationship_api.php'); require_api('string_api.php'); require_api('utility_api.php'); require_api('version_api.php'); $f_master_bug_id = gpc_get_int('m_id', 0); if ($f_master_bug_id > 0) { # master bug exists... bug_ensure_exists($f_master_bug_id); # master bug is not read-only... if (bug_is_readonly($f_master_bug_id)) { error_parameters($f_master_bug_id); trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR); } $t_bug = bug_get($f_master_bug_id, true); #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of # what the current project is set to. if ($t_bug->project_id != helper_get_current_project()) { # in case the current project is not the same project of the bug we are viewing... # ... override the current project. This to avoid problems with categories and handlers lists etc. $g_project_override = $t_bug->project_id; $t_changed_project = true; } else { $t_changed_project = false; } access_ensure_project_level(config_get('report_bug_threshold')); $f_build = $t_bug->build; $f_platform = $t_bug->platform; $f_os = $t_bug->os; $f_os_build = $t_bug->os_build;
if ($f_src_bug_id == $f_dest_bug_id) { trigger_error(ERROR_RELATIONSHIP_SAME_BUG, ERROR); } # the related bug exists... bug_ensure_exists($f_dest_bug_id); # bug is not read-only... if (bug_is_readonly($f_src_bug_id)) { error_parameters($f_src_bug_id); trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR); } # user can access to the related bug at least as viewer... if (!access_has_bug_level(VIEWER, $f_dest_bug_id)) { error_parameters($f_dest_bug_id); trigger_error(ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW, ERROR); } $t_bug = bug_get($f_src_bug_id, true); if ($t_bug->project_id != helper_get_current_project()) { # in case the current project is not the same project of the bug we are viewing... # ... override the current project. This to avoid problems with categories and handlers lists etc. $g_project_override = $t_bug->project_id; } # check if there is other relationship between the bugs... $t_old_id_relationship = relationship_same_type_exists($f_src_bug_id, $f_dest_bug_id, $f_rel_type); if ($t_old_id_relationship == -1) { # the relationship type is exactly the same of the new one. No sense to proceed trigger_error(ERROR_RELATIONSHIP_ALREADY_EXISTS, ERROR); } else { if ($t_old_id_relationship > 0) { # there is already a relationship between them -> we have to update it and not to add a new one helper_ensure_confirmed(lang_get('replace_relationship_sure_msg'), lang_get('replace_relationship_button')); # Update the relationship