From: Glenn H. <thr...@us...> - 2004-08-24 13:30:45
|
Update of /cvsroot/mantisbt/mantisbt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1982 Modified Files: bug_actiongroup.php bug_update.php bug_update_advanced_page.php bug_update_page.php Log Message: fix for " 0004378: "Update Issue" doesn't work when status is CLOSED, RESOLVED, etc" by handling all generic changes through bug_api:bug_update instead of more specific status change routines Index: bug_update_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_update_page.php,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- bug_update_page.php 3 Aug 2004 13:47:47 -0000 1.79 +++ bug_update_page.php 24 Aug 2004 13:30:20 -0000 1.80 @@ -49,6 +49,7 @@ <tr> <td class="form-title" colspan="3"> <input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" /> + <input type="hidden" name="update_mode" value="1" /> <?php echo lang_get( 'updating_bug_simple_title' ) ?> </td> <td class="right" colspan="3"> Index: bug_update_advanced_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_update_advanced_page.php,v retrieving revision 1.75 retrieving revision 1.76 diff -u -d -r1.75 -r1.76 --- bug_update_advanced_page.php 3 Aug 2004 13:47:47 -0000 1.75 +++ bug_update_advanced_page.php 24 Aug 2004 13:30:20 -0000 1.76 @@ -46,6 +46,7 @@ <tr> <td class="form-title" colspan="3"> <input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" /> + <input type="hidden" name="update_mode" value="1" /> <?php echo lang_get( 'updating_bug_advanced_title' ) ?> </td> <td class="right" colspan="3"> Index: bug_update.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_update.php,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- bug_update.php 18 Aug 2004 17:13:01 -0000 1.68 +++ bug_update.php 24 Aug 2004 13:30:20 -0000 1.69 @@ -23,6 +23,7 @@ ?> <?php $f_bug_id = gpc_get_int( 'bug_id' ); + $f_update_mode = gpc_get_bool( 'update_mode', FALSE ); # set if called from generic update page access_ensure_bug_level( config_get( 'update_bug_threshold' ), $f_bug_id ); @@ -101,36 +102,54 @@ } } - switch ( $t_bug_data->status ) { - case config_get( 'bug_resolved_status_threshold' ): - bug_resolve( $f_bug_id, $t_bug_data->resolution, $t_bug_data->fixed_in_version, + if ( ( $t_old_bug_status != $t_bug_data->status ) && ( FALSE == $f_update_mode ) ) { + # handle status transitions that come from pages other than bug_*update_page.php + # this does the minimum to act on the bug and sends a specific message + switch ( $t_bug_data->status ) { + case config_get( 'bug_resolved_status_threshold' ): + # bug_resolve updates the status 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); - if ( $f_close_now ) { - bug_set_field( $f_bug_id, 'status', CLOSED ); - } - break; - - case CLOSED: - bug_close( $f_bug_id, $f_bugnote_text ); - break; + if ( $f_close_now ) { + bug_set_field( $f_bug_id, 'status', CLOSED ); + } + break; - case config_get( 'bug_reopen_status' ): - if ( $t_old_bug_status >= config_get( 'bug_resolved_status_threshold' ) ) { - bug_reopen( $f_bug_id, $f_bugnote_text ); + case CLOSED: + # bug_close updates the status and bugnote and sends message + bug_close( $f_bug_id, $f_bugnote_text ); break; - } # else fall through to default - default: - # Add a bugnote if there is one - if ( !is_blank( $f_bugnote_text ) ) { - bugnote_add( $f_bug_id, $f_bugnote_text, $f_private ); - } + case config_get( 'bug_reopen_status' ): + if ( $t_old_bug_status >= config_get( 'bug_resolved_status_threshold' ) ) { + # bug_reopen updates the status and bugnote and sends message + bug_reopen( $f_bug_id, $f_bugnote_text ); + break; + } # else fall through to default - # Update the bug entry - bug_update( $f_bug_id, $t_bug_data, true ); - break; - } + default: + # Add a bugnote if there is one + if ( !is_blank( $f_bugnote_text ) ) { + bugnote_add( $f_bug_id, $f_bugnote_text, $f_private ); + } + + # Update the bug entry + # bug_update sends a generic message + bug_update( $f_bug_id, $t_bug_data, true ); + break; + } + }else{ + # handle other updates that come from bug_*update_page.php or where status has not changed + + # Add a bugnote if there is one + if ( !is_blank( $f_bugnote_text ) ) { + bugnote_add( $f_bug_id, $f_bugnote_text, $f_private ); + } + + # Update the bug entry + bug_update( $f_bug_id, $t_bug_data, true ); + } helper_call_custom_function( 'issue_update_notify', array( $f_bug_id ) ); Index: bug_actiongroup.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_actiongroup.php,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- bug_actiongroup.php 24 Aug 2004 01:44:16 -0000 1.35 +++ bug_actiongroup.php 24 Aug 2004 13:30:19 -0000 1.36 @@ -76,17 +76,17 @@ case 'ASSIGN': $f_assign = gpc_get_int( 'assign' ); if ( ON == config_get( 'auto_set_status_to_assigned' ) ) { - $t_ass_val = config_get( 'bug_assigned_status' ); + $t_assign_status = config_get( 'bug_assigned_status' ); } else { - $t_ass_val = $t_status; + $t_assign_status = $t_status; } - $t_threshold = access_get_status_threshold( $t_ass_val, bug_get_field( $t_bug_id, 'project_id' ) ); + $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( 'handle_bug_threshold' ), $t_bug_id ) && - bug_check_workflow($t_status, $t_ass_val ) ) { + bug_check_workflow($t_status, $t_assign_status ) ) { bug_assign( $t_bug_id, $f_assign ); } else { - if ( bug_check_workflow($t_status, $t_ass_val ) ) { + if ( bug_check_workflow($t_status, $t_assign_status ) ) { $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); } else { $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_status' ); @@ -96,7 +96,7 @@ case 'RESOLVE': $t_resolved_status = config_get( 'bug_resolved_status_threshold' ); - if ( access_has_bug_level( access_get_status_threshold( $t_ass_val, bug_get_field( $t_bug_id, 'project_id' ) ), $t_bug_id ) && + 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' ); |