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: 9c71d4f
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1c7180f
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 10, 2011

  1. Allow clearing fixed in/target version for multiple bugs

    Prior to this, trying to set the "Fixed in version" or "Target version"
    fields to blank for multiple bugs at once (from the "View Issues" page)
    failed with error "You did not have appropriate permissions to perform
    that action", even when executed as admin. Problem does not occur when
    changing to a non-empty value.
    
    Fixes #11801
    dregad committed Dec 10, 2011
    Copy the full SHA
    6afa5f7 View commit details

Commits on Dec 11, 2011

  1. Improve messages when errors occur in bug group actions

    Displays differentiated messages, specific to the actual error that
    occured instead of always printing "You did not have appropriate
    permissions to perform that action"
    
    Thanks to mattmccutchen for the original patch.
    
    Fixes #13661
    dregad committed Dec 11, 2011
    Copy the full SHA
    1c7180f View commit details
Showing with 37 additions and 40 deletions.
  1. +35 −40 bug_actiongroup.php
  2. +2 −0 lang/strings_english.txt
75 changes: 35 additions & 40 deletions bug_actiongroup.php
Original file line number Diff line number Diff line change
@@ -72,19 +72,18 @@

case 'CLOSE':
$t_closed = config_get( 'bug_closed_status_threshold' );
if ( access_can_close_bug( $t_bug_id ) &&
( $t_status < $t_closed ) &&
if ( access_can_close_bug( $t_bug_id ) ) {
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 {
if ( !access_can_close_bug( $t_bug_id ) ) {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
/** @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;

@@ -129,38 +128,38 @@
# check that new handler has rights to handle the issue, and
# that current user has rights to assign the issue
$t_threshold = access_get_status_threshold( $t_assign_status, bug_get_field( $t_bug_id, 'project_id' ) );
if ( access_has_bug_level( $t_threshold , $t_bug_id, $f_assign ) &&
access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ), $t_bug_id ) &&
bug_check_workflow($t_status, $t_assign_status ) ) {
/** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */
bug_assign( $t_bug_id, $f_assign, $f_bug_notetext, $f_bug_noteprivate );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
if ( bug_check_workflow($t_status, $t_assign_status ) ) {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
if ( access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ), $t_bug_id ) ) {
if ( access_has_bug_level( $t_threshold , $t_bug_id, $f_assign ) ) {
if ( bug_check_workflow($t_status, $t_assign_status ) ) {
/** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */
bug_assign( $t_bug_id, $f_assign, $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_status' );
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_handler' );
}
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
break;

case 'RESOLVE':
$t_resolved_status = config_get( 'bug_resolved_status_threshold' );
if ( access_has_bug_level( access_get_status_threshold( $t_resolved_status, bug_get_field( $t_bug_id, 'project_id' ) ), $t_bug_id ) &&
( $t_status < $t_resolved_status ) &&
bug_check_workflow($t_status, $t_resolved_status ) ) {
$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 );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
if ( access_has_bug_level( access_get_status_threshold( $t_resolved_status, bug_get_field( $t_bug_id, 'project_id' ) ), $t_bug_id ) ) {
if ( ( $t_status < $t_resolved_status ) &&
bug_check_workflow($t_status, $t_resolved_status ) ) {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
$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 );
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;

@@ -215,37 +214,33 @@
case 'UP_FIXED_IN_VERSION':
$f_fixed_in_version = gpc_get_string( 'fixed_in_version' );
$t_project_id = bug_get_field( $t_bug_id, 'project_id' );
$t_success = false;

if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {
if ( version_get_id( $f_fixed_in_version, $t_project_id ) !== false ) {
if ( $f_fixed_in_version === '' || version_get_id( $f_fixed_in_version, $t_project_id ) !== false ) {
/** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */
bug_set_field( $t_bug_id, 'fixed_in_version', $f_fixed_in_version );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
$t_success = true;
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_version' );
}
}

if ( !$t_success ) {
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
break;

case 'UP_TARGET_VERSION':
$f_target_version = gpc_get_string( 'target_version' );
$t_project_id = bug_get_field( $t_bug_id, 'project_id' );
$t_success = false;

if ( access_has_bug_level( config_get( 'roadmap_update_threshold' ), $t_bug_id ) ) {
if ( version_get_id( $f_target_version, $t_project_id ) !== false ) {
if ( $f_target_version === '' || version_get_id( $f_target_version, $t_project_id ) !== false ) {
/** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */
bug_set_field( $t_bug_id, 'target_version', $f_target_version );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
$t_success = true;
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_version' );
}
}

if ( !$t_success ) {
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
break;
2 changes: 2 additions & 0 deletions lang/strings_english.txt
Original file line number Diff line number Diff line change
@@ -139,6 +139,8 @@ $s_select_option = '(select)'; # comboboxes default to this to instruct user to
$s_bug_actiongroup_access = 'You did not have appropriate permissions to perform that action.';
$s_bug_actiongroup_status = 'This issue cannot be changed to the requested status';
$s_bug_actiongroup_category = 'This issue cannot be changed to the requested category';
$s_bug_actiongroup_handler = 'The requested user is not allowed to handle this issue';
$s_bug_actiongroup_version = 'The requested version does not exist in this issue\'s project';
$s_close_bugs_conf_msg = 'Are you sure you wish to close these issues?';
$s_delete_bugs_conf_msg = 'Are you sure you wish to delete these issues?';
$s_move_bugs_conf_msg = 'Move issues to';