From: <gi...@ma...> - 2010-08-14 04:51:34
|
The branch, master has been updated via b6a272191422308102d4b25f34a49088b2aa46a4 (commit) from 596097f32c98b772412e6c3edfe72df6db7bfa27 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b6a272191422308102d4b25f34a49088b2aa46a4 Author: David Hicks <hic...@op...> Date: Sat Aug 14 14:44:55 2010 +1000 Fix #11758: Improve handling of reassign on feedback feature The bugnote_add() function in bugnote_api.php is currently the only way (using the API) to add a bugnote into the database. This function was also attempting to handle the reassign on feedback feature. This posed a problem because there are times that the bugnote_add() function needs to be called without considering the reassign on feedback feature. For example, importing issues from an XML file. The bugnote_add() function has been changed to no longer handle the reassign on feedback feature. The resposibility for handling this feature now belongs within the scripts calling the bugnote_add() function. The caller scripts are in a much better position to determine how the reassign on feedback issue will be handled. ----------------------------------------------------------------------- Summary of changes: bug_update.php | 1 + bugnote_add.php | 27 +++++++++++++++++++++------ core/bugnote_api.php | 12 ------------ 3 files changed, 22 insertions(+), 18 deletions(-) ----------------------------------------------------------------------- commit b6a272191422308102d4b25f34a49088b2aa46a4 Author: David Hicks <hic...@op...> Date: Sat Aug 14 14:44:55 2010 +1000 Fix #11758: Improve handling of reassign on feedback feature The bugnote_add() function in bugnote_api.php is currently the only way (using the API) to add a bugnote into the database. This function was also attempting to handle the reassign on feedback feature. This posed a problem because there are times that the bugnote_add() function needs to be called without considering the reassign on feedback feature. For example, importing issues from an XML file. The bugnote_add() function has been changed to no longer handle the reassign on feedback feature. The resposibility for handling this feature now belongs within the scripts calling the bugnote_add() function. The caller scripts are in a much better position to determine how the reassign on feedback issue will be handled. diff --git a/bug_update.php b/bug_update.php index 6d0fd71..d8fbc9f 100644 --- a/bug_update.php +++ b/bug_update.php @@ -311,6 +311,7 @@ if ( $t_bug_note->note || if ( $t_bug_note->note && config_get( 'reassign_on_feedback' ) && $t_existing_bug->status === config_get( 'bug_feedback_status' ) && + $t_updated_bug->status <= config_get( 'bug_feedback_status' ) && $t_updated_bug->reporter_id === auth_get_current_user_id() ) { if ( $t_updated_bug->handler_id !== NO_USER ) { $t_updated_bug->status = config_get( 'bug_assigned_status' ); diff --git a/bugnote_add.php b/bugnote_add.php index 377c915..6c2dd32 100644 --- a/bugnote_add.php +++ b/bugnote_add.php @@ -63,25 +63,40 @@ if( $t_bug->project_id != helper_get_current_project() ) { $g_project_override = $t_bug->project_id; } -if ( bug_is_readonly( $f_bug_id ) ) { - error_parameters( $f_bug_id ); +if ( bug_is_readonly( $t_bug->id ) ) { + error_parameters( $t_bug->id ); trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); } -access_ensure_bug_level( config_get( 'add_bugnote_threshold' ), $f_bug_id ); +access_ensure_bug_level( config_get( 'add_bugnote_threshold' ), $t_bug->id ); if ( $f_private ) { - access_ensure_bug_level( config_get( 'set_view_status_threshold' ), $f_bug_id ); + access_ensure_bug_level( config_get( 'set_view_status_threshold' ), $t_bug->id ); } // We always set the note time to BUGNOTE, and the API will overwrite it with TIME_TRACKING // if $f_time_tracking is not 0 and the time tracking feature is enabled. -$t_bugnote_id = bugnote_add( $f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, BUGNOTE ); +$t_bugnote_id = bugnote_add( $t_bug->id, $f_bugnote_text, $f_time_tracking, $f_private, BUGNOTE ); if ( !$t_bugnote_id ) { error_parameters( lang_get( 'bugnote' ) ); trigger_error( ERROR_EMPTY_FIELD, ERROR ); } +# Handle the reassign on feedback feature. Note that this feature generally +# won't work very well with custom workflows as it makes a lot of assumptions +# that may not be true. It assumes you don't have any statuses in the workflow +# between 'bug_submit_status' and 'bug_feedback_status'. It assumes you only +# have one feedback, assigned and submitted status. +if ( config_get( 'reassign_on_feedback' ) && + $t_bug->status === config_get( 'bug_feedback_status' ) && + $t_bug->reporter_id === auth_get_current_user_id() ) { + if ( $t_bug->handler_id !== NO_USER ) { + bug_set_field( $t_bug->id, 'status', config_get( 'bug_assigned_status' ) ); + } else { + bug_set_field( $t_bug->id, 'status', config_get( 'bug_submit_status' ) ); + } +} + form_security_purge( 'bugnote_add' ); -print_successful_redirect_to_bug( $f_bug_id ); +print_successful_redirect_to_bug( $t_bug->id ); diff --git a/core/bugnote_api.php b/core/bugnote_api.php index 2b046a7..4f90004 100644 --- a/core/bugnote_api.php +++ b/core/bugnote_api.php @@ -210,18 +210,6 @@ function bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_ # log new bug history_log_event_special( $p_bug_id, BUGNOTE_ADDED, bugnote_format_id( $t_bugnote_id ) ); - # if it was FEEDBACK its NEW_ now - if ( config_get( 'reassign_on_feedback' ) && - bug_get_field( $p_bug_id, 'status' ) == config_get( 'bug_feedback_status' ) && - bug_get_field( $p_bug_id, 'reporter_id' ) == $c_user_id ) { - - if ( bug_get_field( $p_bug_id, 'handler_id') == 0 ) { - bug_set_field( $p_bug_id, 'status', config_get( 'bug_submit_status' ) ); - } else { - bug_set_field( $p_bug_id, 'status', config_get( 'bug_assigned_status' ) ); - } - } - # Event integration event_signal( 'EVENT_BUGNOTE_ADD', array( $p_bug_id, $t_bugnote_id ) ); ----------------------------------------------------------------------- -- Mantis Bug Tracker |