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';
