View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0004270 | mantisbt | bugtracker | public | 2004-08-04 16:24 | 2004-08-29 01:53 |
| Reporter | Assigned To | thraxisp | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | Any | OS | Any | OS Version | Any |
| Product Version | git trunk | ||||
| Fixed in Version | 0.19.0rc1 | ||||
| Summary | 0004270: Change status in mass treatment ignore defined workflow rules | ||||
| Description | Update status on view_all allow assign to issue any status and jump over workflow | ||||
| Steps To Reproduce | Define workflow, and use "Update status" from combo | ||||
| Tags | No tags attached. | ||||
| Attached Files | group.diff (7,172 bytes)
Index: bug_actiongroup.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_actiongroup.php,v
retrieving revision 1.33
diff -u -r1.33 bug_actiongroup.php
--- bug_actiongroup.php 5 Aug 2004 10:22:38 -0000 1.33
+++ bug_actiongroup.php 8 Aug 2004 14:32:10 -0000
@@ -28,14 +28,21 @@
foreach( $f_bug_arr as $t_bug_id ) {
bug_ensure_exists( $t_bug_id );
+ $t_status = bug_get_field( $t_bug_id, 'status' );
switch ( $f_action ) {
case 'CLOSE':
- if ( access_can_close_bug( $t_bug_id ) ) {
+ if ( access_can_close_bug( $t_bug_id ) &&
+ ( $t_status < CLOSED ) &&
+ bug_check_workflow($t_status, CLOSED) ) {
bug_close( $t_bug_id );
} else {
- $t_failed_ids[] = $t_bug_id;
+ 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;
@@ -43,7 +50,7 @@
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;
+ $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
break;
@@ -52,7 +59,7 @@
$f_project_id = gpc_get_int( 'project_id' );
bug_set_field( $t_bug_id, 'project_id', $f_project_id );
} else {
- $t_failed_ids[] = $t_bug_id;
+ $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
break;
@@ -62,28 +69,46 @@
if ( access_has_project_level( config_get( 'report_bug_threshold' ), $f_project_id ) ) {
bug_copy( $t_bug_id, $f_project_id, true, true, true, true, true, true );
} else {
- $t_failed_ids[] = $t_bug_id;
+ $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
break;
case 'ASSIGN':
- if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {
- // @@@ Check that $f_assign has access to handle a bug.
- $f_assign = gpc_get_int( 'assign' );
+ $f_assign = gpc_get_int( 'assign' );
+ if ( ON == config_get( 'auto_set_status_to_assigned' ) ) {
+ $t_ass_val = config_get( 'bug_assigned_status' );
+ } else {
+ $t_ass_val = $t_status;
+ }
+ if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) &&
+ access_has_bug_level( config_get( 'handle_bug_threshold' ), $t_bug_id, $f_assign ) &&
+ bug_check_workflow($t_status, $t_ass_val ) ) {
bug_assign( $t_bug_id, $f_assign );
} else {
- $t_failed_ids[] = $t_bug_id;
+ if ( bug_check_workflow($t_status, $t_ass_val ) ) {
+ $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 'RESOLVE':
+ $t_resolved_status = config_get( 'bug_resolved_status_threshold' );
if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) &&
- access_has_bug_level( config_get( 'handle_bug_threshold' ), $t_bug_id )) {
+ access_has_bug_level( config_get( 'handle_bug_threshold' ), $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', '' );
bug_resolve( $t_bug_id, $f_resolution, $f_fixed_in_version );
} else {
- $t_failed_ids[] = $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' );
+ } else {
+ $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_status' );
+ }
}
break;
@@ -92,7 +117,7 @@
$f_priority = gpc_get_int( 'priority' );
bug_set_field( $t_bug_id, 'priority', $f_priority );
} else {
- $t_failed_ids[] = $t_bug_id;
+ $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
break;
@@ -101,7 +126,7 @@
$f_status = gpc_get_int( 'status' );
bug_set_field( $t_bug_id, 'status', $f_status );
} else {
- $t_failed_ids[] = $t_bug_id;
+ $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
break;
@@ -110,7 +135,7 @@
$f_view_status = gpc_get_int( 'view_status' );
bug_set_field( $t_bug_id, 'view_state', $f_view_status );
} else {
- $t_failed_ids[] = $t_bug_id;
+ $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
break;
@@ -125,13 +150,10 @@
html_page_top1();
html_page_top2();
- $t_links = array();
- foreach( $t_failed_ids as $t_id ) {
- $t_links[] = string_get_bug_view_link( $t_id );
- }
-
echo '<div align="center">';
- echo lang_get( 'bug_actiongroup_failed' ) . implode( ', ', $t_links ) . '<br />';
+ foreach( $t_failed_ids as $t_id => $t_reason ) {
+ printf("<p> %s: %s </p>\n", string_get_bug_view_link( $t_id ), $t_reason);
+ }
print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
echo '</div>';
Index: bug_actiongroup_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_actiongroup_page.php,v
retrieving revision 1.40
diff -u -r1.40 bug_actiongroup_page.php
--- bug_actiongroup_page.php 24 Jul 2004 11:48:33 -0000 1.40
+++ bug_actiongroup_page.php 8 Aug 2004 14:32:11 -0000
@@ -153,6 +153,12 @@
</tr>
<?php
if ( isset( $t_question_title2 ) ) {
+ switch ( $f_action ) {
+ case 'RESOLVE':
+ $t_show_version = ( ON == config_get( 'show_product_version' ) )
+ || ( ( AUTO == config_get( 'show_product_version' ) )
+ && ( count( version_get_all_rows( $t_bug->project_id ) ) > 0 ) );
+ if ( $t_show_version ) {
?>
<tr class="row-2">
<td class="category">
@@ -160,17 +166,14 @@
</td>
<td>
<select name="<?php echo $t_form2 ?>">
- <?php
- switch ( $f_action ) {
- case 'RESOLVE':
- print_version_option_list( '', null, VERSION_ALL );
- break;
- }
- ?>
+ <?php print_version_option_list( '', null, VERSION_ALL );?>
</select>
</td>
</tr>
<?php
+ }
+ break;
+ }
}
?>
<?php
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.197
diff -u -r1.197 strings_english.txt
--- lang/strings_english.txt 8 Aug 2004 11:39:15 -0000 1.197
+++ lang/strings_english.txt 8 Aug 2004 14:32:12 -0000
@@ -98,6 +98,8 @@
# bug_actiongroup_page.php : mass treatment
$s_bug_actiongroup_failed = 'You did not have appropriate permissions to perform that action on the following issues: ';
+$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_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';
| ||||
|
When dealing with a group of issues, each issue may be in a different state and hence for some of the issues the new state may not be legal. I think we should probably apply the new status for the issues where it is legal and provide a summary at the end that new status has been applied to N out of M issues. Or just show operation successfull when the status was applied to all successfully. What do you think? |
|
|
The current implementation trys to apply the changes selected, then shows an error for those that fail (with a link to the issue). The feedback may need to be tuned a bit as it only gives one reason for all of the failures. We can expand this to one line per failure with a more detailed reason. For rc1, I can easily add the workflow testing (already coded). I can add the reasons before final release. edited on: 08-05-04 17:29 |
|
|
thraxisp, you think, that Mantis work this way... I SEE, that I can assign any status (if mass treatment applied to single message, no test for bundle) without errors and warnings. Try my demo :-) |
|
|
The current implementation only checks for access level before trying to do the change of status. The defaults allow an UPDATER to change and close a bug. You can't really see any failures. If you chage the close threshold to MANAGER, you should see errors. |
|
|
I spoke not about access rights - about workflow |
|
|
You are correct. I have made half of the changes required. I need input on how to present the failures. Currently, the message is "You did not have appropriate permissions to perform that action on the following issues: xxx, xxx, xxx". I'd like to change it to:
Comments? |
|
|
Diffs and modules attached. I can commit them if you agree. |
|
|
Yes, I see at at and can complaint about nothing (at least - yet) |
|
|
Yes, looks good. Go ahead and commit. Sorry for the late reply, I somehow missed this issue. |
|
|
fixed in cvs |
|