Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8d35e57a9977
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f9b9e2fc4356
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Jul 3, 2012

  1. Fix system warning in html_status_legend() with custom status

    When using custom status for which no language strings are defined,
    html_status_legend() triggered system warnings.
    
    MantisBT now displays the custom status' name as defined in the enum,
    in case there is no available translation string.
    
    Fixes #14446
    dregad committed Jul 3, 2012
    Copy the full SHA
    123c2c8 View commit details
  2. Add param to bug_resolve() to allow "resolution" to custom status

    Function bug_resolve() sets the status to bug_resolved_status_threshold.
    This behavior is fine with MantisBT's default status enum, but is
    causing issues when using a custom target status that is
    >= $g_bug_resolved_status_threshold & < $g_bug_closed_status_threshold.
    
    In this case, when changing status using the button on view.php, the
    target status selected by the user is overriden by the value of
    bug_resolved_status_threshold, resulting in incorrect behavior. The only
    way to effectively reach the custom state is by editing the issue.
    
    To address this, a new optional parameter $p_status is added to
    bug_resolve(). To make the function call more logical, the signature was
    modified: new parameter inserted in 3rd position after $p_resolution.
    
    The function's phpdoc header has been completed.
    
    Fixes #14443
    dregad committed Jul 3, 2012
    Copy the full SHA
    91a99d9 View commit details
  3. Code cleanup in bug_update.php

    Fixes whitespace, code alignment, typos in comments, long lines
    dregad committed Jul 3, 2012
    Copy the full SHA
    f9b9e2f View commit details
Showing with 42 additions and 25 deletions.
  1. +1 −1 bug_actiongroup.php
  2. +25 −20 bug_update.php
  3. +15 −3 core/bug_api.php
  4. +1 −1 core/html_api.php
2 changes: 1 addition & 1 deletion bug_actiongroup.php
Original file line number Diff line number Diff line change
@@ -154,7 +154,7 @@
$f_resolution = gpc_get_int( 'resolution' );
$f_fixed_in_version = gpc_get_string( 'fixed_in_version', '' );
/** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */
bug_resolve( $t_bug_id, $f_resolution, $f_fixed_in_version, $f_bug_notetext, null, null, $f_bug_noteprivate );
bug_resolve( $t_bug_id, $f_resolution, null, $f_fixed_in_version, null, null, $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' );
45 changes: 25 additions & 20 deletions bug_update.php
Original file line number Diff line number Diff line change
@@ -33,11 +33,12 @@

form_security_validate( 'bug_update' );

$f_bug_id = gpc_get_int( 'bug_id' );
$f_update_mode = gpc_get_bool( 'update_mode', FALSE ); # set if called from generic update page
$f_new_status = gpc_get_int( 'status', bug_get_field( $f_bug_id, 'status' ) );
$f_bug_id = gpc_get_int( 'bug_id' );
$t_bug_data = bug_get( $f_bug_id, true );

$f_update_mode = gpc_get_bool( 'update_mode', FALSE ); # set if called from generic update page
$f_new_status = gpc_get_int( 'status', $t_bug_data->status );

$t_bug_data = bug_get( $f_bug_id, true );
if( $t_bug_data->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.
@@ -73,21 +74,21 @@
$t_bug_data->platform = gpc_get_string( 'platform', $t_bug_data->platform );
$t_bug_data->version = gpc_get_string( 'version', $t_bug_data->version );
$t_bug_data->build = gpc_get_string( 'build', $t_bug_data->build );
$t_bug_data->fixed_in_version = gpc_get_string( 'fixed_in_version', $t_bug_data->fixed_in_version );
$t_bug_data->fixed_in_version = gpc_get_string( 'fixed_in_version', $t_bug_data->fixed_in_version );
$t_bug_data->view_state = gpc_get_int( 'view_state', $t_bug_data->view_state );
$t_bug_data->summary = gpc_get_string( 'summary', $t_bug_data->summary );
$t_due_date = gpc_get_string( 'due_date', null );
$t_due_date = gpc_get_string( 'due_date', null );

if( access_has_project_level( config_get( 'roadmap_update_threshold' ), $t_bug_data->project_id ) ) {
$t_bug_data->target_version = gpc_get_string( 'target_version', $t_bug_data->target_version );
$t_bug_data->target_version = gpc_get_string( 'target_version', $t_bug_data->target_version );
}

if( $t_due_date !== null) {
if ( is_blank ( $t_due_date ) ) {
$t_bug_data->due_date = 1;
} else {
$t_bug_data->due_date = strtotime( $t_due_date );
}
}
}

$t_bug_data->description = gpc_get_string( 'description', $t_bug_data->description );
@@ -96,7 +97,7 @@

$f_private = gpc_get_bool( 'private' );
$f_bugnote_text = gpc_get_string( 'bugnote_text', '' );
$f_time_tracking = gpc_get_string( 'time_tracking', '0:00' );
$f_time_tracking = gpc_get_string( 'time_tracking', '0:00' );
$f_close_now = gpc_get_string( 'close_now', false );

# Handle auto-assigning
@@ -124,7 +125,7 @@
foreach( $t_related_custom_field_ids as $t_id ) {
$t_def = custom_field_get_definition( $t_id );

# Only update the field if it would have been display for editing
# Only update the field if it would have been displayed for editing
if( !( ( !$f_update_mode && $t_def['require_' . $t_custom_status_label] ) ||
( !$f_update_mode && $t_def['display_' . $t_custom_status_label] && in_array( $t_custom_status_label, array( "resolved", "closed" ) ) ) ||
( $f_update_mode && $t_def['display_update'] ) ||
@@ -169,19 +170,22 @@
if ( $t_bug_data->status >= $t_resolved
&& $t_bug_data->status < $t_closed
&& $t_old_bug_status < $t_resolved ) {
# bug_resolve updates the status, fixed_in_version, resolution, handler_id and bugnote and sends message
bug_resolve( $f_bug_id, $t_bug_data->resolution, $t_bug_data->fixed_in_version,
$f_bugnote_text, $t_bug_data->duplicate_id, $t_bug_data->handler_id,
$f_private, $f_time_tracking );
# bug_resolve updates the status, fixed_in_version, resolution,
# handler_id and bugnote and sends message
bug_resolve( $f_bug_id,
$t_bug_data->resolution, $t_bug_data->status,
$t_bug_data->fixed_in_version,
$t_bug_data->duplicate_id, $t_bug_data->handler_id,
$f_bugnote_text, $f_private, $f_time_tracking );
$t_notify = false;
$t_bug_note_set = true;

if ( $f_close_now ) {
bug_set_field( $f_bug_id, 'status', $t_closed );
}

// update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
// in bug_update() call below.
# update bug data with fields that may be updated inside bug_resolve(),
# otherwise changes will be overwritten in bug_update() call below.
$t_bug_data->handler_id = bug_get_field( $f_bug_id, 'handler_id' );
$t_bug_data->status = bug_get_field( $f_bug_id, 'status' );
} else if ( $t_bug_data->status >= $t_closed
@@ -192,14 +196,15 @@
$t_bug_note_set = true;
} else if ( $t_bug_data->status == config_get( 'bug_reopen_status' )
&& $t_old_bug_status >= $t_resolved ) {
bug_set_field( $f_bug_id, 'handler_id', $t_bug_data->handler_id ); # fix: update handler_id before calling bug_reopen
# fix: update handler_id before calling bug_reopen
bug_set_field( $f_bug_id, 'handler_id', $t_bug_data->handler_id );
# bug_reopen updates the status and bugnote and sends message
bug_reopen( $f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private );
$t_notify = false;
$t_bug_note_set = true;

// update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
// in bug_update() call below.
# update bug data with fields that may be updated inside bug_reopen(),
# otherwise changes will be overwritten in bug_update() call below.
$t_bug_data->status = bug_get_field( $f_bug_id, 'status' );
$t_bug_data->resolution = bug_get_field( $f_bug_id, 'resolution' );
}
18 changes: 15 additions & 3 deletions core/bug_api.php
Original file line number Diff line number Diff line change
@@ -1613,11 +1613,23 @@ function bug_close( $p_bug_id, $p_bugnote_text = '', $p_bugnote_private = false,

/**
* resolve the given bug
* @return bool (alawys true)
* @param int p_bug_id
* @param int p_resolution resolution code
* @param int p_status optional custom status (defaults to bug_resolved_status_threshold)
* @param string p_fixed_in_version optional version string in which issue is fixed
* @param int p_duplicate_id optional id of duplicate issue (defaults to null)
* @param int p_handler_id optional id of issue handler
* @param string p_bugnote_text optional bug note to add
* @param bool p_bugnote_private optional true if bug note should be private (defaults to false)
* @param string p_time_tracking optional time spent (defaults to '0:00')
* @return bool (always true)
* @access public
*/
function bug_resolve( $p_bug_id, $p_resolution, $p_fixed_in_version = '', $p_bugnote_text = '', $p_duplicate_id = null, $p_handler_id = null, $p_bugnote_private = false, $p_time_tracking = '0:00' ) {
function bug_resolve( $p_bug_id, $p_resolution, $p_status = null, $p_fixed_in_version = '', $p_duplicate_id = null, $p_handler_id = null, $p_bugnote_text = '', $p_bugnote_private = false, $p_time_tracking = '0:00' ) {
$c_resolution = (int) $p_resolution;
if( null == $p_status ) {
$p_status = config_get( 'bug_resolved_status_threshold' );
}
$p_bugnote_text = trim( $p_bugnote_text );

# Add bugnote if supplied
@@ -1661,7 +1673,7 @@ function bug_resolve( $p_bug_id, $p_resolution, $p_fixed_in_version = '', $p_bug
bug_set_field( $p_bug_id, 'duplicate_id', (int) $p_duplicate_id );
}

bug_set_field( $p_bug_id, 'status', config_get( 'bug_resolved_status_threshold' ) );
bug_set_field( $p_bug_id, 'status', $p_status );
bug_set_field( $p_bug_id, 'fixed_in_version', $p_fixed_in_version );
bug_set_field( $p_bug_id, 'resolution', $c_resolution );

2 changes: 1 addition & 1 deletion core/html_api.php
Original file line number Diff line number Diff line change
@@ -1239,7 +1239,7 @@ function html_status_legend() {
# draw the status bar
$width = (int)( 100 / count( $t_status_array ) );
foreach( $t_status_array as $t_status => $t_name ) {
$t_val = $t_status_names[$t_status];
$t_val = isset( $t_status_names[$t_status] ) ? $t_status_names[$t_status] : $t_status_array[$t_status];
$t_color = get_status_color( $t_status );

echo "<td class=\"small-caption\" width=\"$width%\" bgcolor=\"$t_color\">$t_val</td>";