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 ) ); bug_close($t_bug_id, $f_bug_notetext, $f_bug_noteprivate); helper_call_custom_function('issue_update_notify', array($t_bug_id)); } else { $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_status'); } } else { $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_access'); } break; case 'DELETE': if (access_has_bug_level(config_get('delete_bug_threshold'), $t_bug_id)) { event_signal('EVENT_BUG_DELETED', array($t_bug_id)); bug_delete($t_bug_id);
/** * Make sure that the user can close the specified bug * @see access_can_close_bug * @param BugData $p_bug Bug to check access against * @param int|null $p_user_id integer representing user id, defaults to null to use current user * @access public */ function access_ensure_can_close_bug($p_bug, $p_user_id = null) { if (!access_can_close_bug($p_bug, $p_user_id)) { access_denied(); } }
} echo '</tr>'; } # # Status, Resolution # if ($t_show_status || $t_show_resolution) { echo '<tr>'; $t_spacer = 2; if ($t_show_status) { # Status echo '<th class="category"><label for="status">' . lang_get('status') . '</label></th>'; # choose color based on status $status_label = html_get_status_css_class($t_bug->status); echo '<td class="' . $status_label . '">'; print_status_option_list('status', $t_bug->status, access_can_close_bug($t_bug), $t_bug->project_id); echo '</td>'; } else { $t_spacer += 2; } if ($t_show_resolution) { # Resolution echo '<th class="category"><label for="resolution">' . lang_get('resolution') . '</label></th>'; echo '<td><select ' . helper_get_tab_index() . ' id="resolution" name="resolution">'; print_enum_string_option_list('resolution', $t_bug->resolution); echo '</select></td>'; } else { $t_spacer += 2; } # spacer if ($t_spacer > 0) {
/** * Print a button to close the given bug * @param BugData $p_bug Bug object * @return null */ function html_button_bug_close($p_bug) { if (access_can_close_bug($p_bug)) { $t_closed_status = config_get('bug_closed_status_threshold', null, null, $p_bug->project_id); html_button('bug_change_status_page.php', lang_get('close_bug_button'), array('id' => $p_bug->id, 'new_status' => $t_closed_status)); } }
$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; # @@@ (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': if (access_can_close_bug($t_bug_id) && $t_status < CLOSED && bug_check_workflow($t_status, CLOSED)) { bug_close($t_bug_id); } else { if (!access_can_close_bug($t_bug_id)) { $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_access'); } else { $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_status'); } } break; case 'DELETE': if (access_has_bug_level(config_get('delete_bug_threshold'), $t_bug_id)) { bug_delete($t_bug_id); } else { $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_access'); } break; case 'MOVE': if (access_has_bug_level(config_get('move_bug_threshold'), $t_bug_id)) {
$t_reopen_resolution = config_get('bug_reopen_resolution'); $t_resolve_issue = false; $t_close_issue = false; $t_reopen_issue = false; if ($t_existing_bug->status < $t_resolved_status && $t_updated_bug->status >= $t_resolved_status && $t_updated_bug->status < $t_closed_status) { $t_resolve_issue = true; } else { if ($t_existing_bug->status < $t_closed_status && $t_updated_bug->status >= $t_closed_status) { $t_close_issue = true; } else { if ($t_existing_bug->status >= $t_resolved_status && $t_updated_bug->status <= config_get('bug_reopen_status')) { $t_reopen_issue = true; } } } $t_reporter_closing = $f_update_type == BUG_UPDATE_TYPE_CLOSE && bug_is_user_reporter($f_bug_id, $t_current_user_id) && access_can_close_bug($t_existing_bug, $t_current_user_id); $t_reporter_reopening = ($f_update_type == BUG_UPDATE_TYPE_REOPEN || $t_reopen_issue) && bug_is_user_reporter($f_bug_id, $t_current_user_id) && access_can_reopen_bug($t_existing_bug, $t_current_user_id); if (!$t_reporter_reopening && !$t_reporter_closing) { # Ensure that the user has permission to update bugs. This check also factors # in whether the user has permission to view private bugs. The # $g_limit_reporters option is also taken into consideration. access_ensure_bug_level(config_get('update_bug_threshold'), $f_bug_id); # Check if the bug is in a read-only state and whether the current user has # permission to update read-only bugs. if (bug_is_readonly($f_bug_id)) { error_parameters($f_bug_id); trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR); } } # If resolving or closing, ensure that all dependant issues have been resolved. if (($t_resolve_issue || $t_close_issue) && !relationship_can_resolve_bug($f_bug_id)) {
/** * Print a button to close the given bug * Only if user can close bugs and workflow allows moving them to that status * @param BugData $p_bug A valid bug object. * @return void */ function html_button_bug_close(BugData $p_bug) { $t_closed_status = config_get('bug_closed_status_threshold', null, null, $p_bug->project_id); if (access_can_close_bug($p_bug) && bug_check_workflow($p_bug->status, $t_closed_status)) { html_button('bug_change_status_page.php', lang_get('close_bug_button'), array('id' => $p_bug->id, 'new_status' => $t_closed_status, 'change_type' => BUG_UPDATE_TYPE_CLOSE)); } }