Blame Extras/Mantis/1.1.2-1.fc9/bug_change_status_page.php

4c79b5
4c79b5
# Mantis - a php based bugtracking system
4c79b5
4c79b5
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
4c79b5
# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
4c79b5
4c79b5
# Mantis is free software: you can redistribute it and/or modify
4c79b5
# it under the terms of the GNU General Public License as published by
4c79b5
# the Free Software Foundation, either version 2 of the License, or
4c79b5
# (at your option) any later version.
4c79b5
#
4c79b5
# Mantis is distributed in the hope that it will be useful,
4c79b5
# but WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4c79b5
# GNU General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
4c79b5
4c79b5
	#------------------------------
4c79b5
	#   $Revision: 2643 $
4c79b5
	#     $Author: al $    
4c79b5
	#       $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $  
4c79b5
	#------------------------------
4c79b5
4c79b5
	require_once( 'core.php' );
4c79b5
4c79b5
	$t_core_path = config_get( 'core_path' );
4c79b5
4c79b5
	require_once( $t_core_path.'bug_api.php' );
4c79b5
	require_once( $t_core_path.'custom_field_api.php' );
4c79b5
4c79b5
	require_once( $t_core_path.'relationship_api.php' );
4c79b5
4c79b5
	$f_bug_id = gpc_get_int( 'bug_id' );
4c79b5
	$t_bug = bug_get( $f_bug_id );
4c79b5
	
4c79b5
	if( $t_bug->project_id != helper_get_current_project() ) {
4c79b5
		# in case the current project is not the same project of the bug we are viewing...
4c79b5
		# ... override the current project. This to avoid problems with categories and handlers lists etc.
4c79b5
		$g_project_override = $t_bug->project_id;
4c79b5
	}
4c79b5
	
4c79b5
	$f_new_status = gpc_get_int( 'new_status' );
4c79b5
	$f_reopen_flag = gpc_get_int( 'reopen_flag', OFF );
4c79b5
4c79b5
	if ( ! ( ( access_has_bug_level( access_get_status_threshold( $f_new_status, bug_get_field( $f_bug_id, 'project_id' ) ), $f_bug_id ) ) ||
4c79b5
				( ( bug_get_field( $f_bug_id, 'reporter_id' ) == auth_get_current_user_id() ) &&
4c79b5
						( ( ON == config_get( 'allow_reporter_reopen' ) ) ||
4c79b5
								( ON == config_get( 'allow_reporter_close' ) ) ) ) ||
4c79b5
				( ( ON == $f_reopen_flag ) && ( access_has_bug_level( config_get( 'reopen_bug_threshold' ), $f_bug_id ) ) )
4c79b5
			) ) {
4c79b5
		access_denied();
4c79b5
	}
4c79b5
4c79b5
	# get new issue handler if set, otherwise default to original handler
4c79b5
	$f_handler_id = gpc_get_int( 'handler_id', bug_get_field( $f_bug_id, 'handler_id' ) );
4c79b5
4c79b5
	if ( ASSIGNED == $f_new_status ) {
4c79b5
		$t_bug_sponsored = sponsorship_get_amount( sponsorship_get_all_ids( $f_bug_id ) ) > 0;
4c79b5
		if ( $t_bug_sponsored ) {
4c79b5
			if ( !access_has_bug_level( config_get( 'assign_sponsored_bugs_threshold' ), $f_bug_id ) ) {
4c79b5
				trigger_error( ERROR_SPONSORSHIP_ASSIGNER_ACCESS_LEVEL_TOO_LOW, ERROR );
4c79b5
			}
4c79b5
		}
4c79b5
4c79b5
		if ( $f_handler_id != NO_USER ) {
4c79b5
            if ( !access_has_bug_level( config_get( 'handle_bug_threshold' ), $f_bug_id, $f_handler_id ) ) {
4c79b5
				trigger_error( ERROR_HANDLER_ACCESS_TOO_LOW, ERROR );
4c79b5
			}
4c79b5
4c79b5
			if ( $t_bug_sponsored ) {
4c79b5
				if ( !access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id, $f_handler_id ) ) {
4c79b5
					trigger_error( ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, ERROR );
4c79b5
				}
4c79b5
			}
4c79b5
		}
4c79b5
	}
4c79b5
4c79b5
	$t_status_label = str_replace( " ", "_", get_enum_to_string( config_get( 'status_enum_string' ), $f_new_status ) );
4c79b5
	$t_resolved = config_get( 'bug_resolved_status_threshold' );
4c79b5
4c79b5
	$t_bug = bug_get( $f_bug_id );
4c79b5
4c79b5
	html_page_top1( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) );
4c79b5
	html_page_top2();
4c79b5
4c79b5
?>
4c79b5
4c79b5

4c79b5
4c79b5
<form method="post" action="bug_update.php">
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	
4c79b5
		<input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
4c79b5
		<input type="hidden" name="status" value="<?php echo $f_new_status ?>" />
4c79b5
		
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
# relationship warnings
4c79b5
if ( ON == config_get( 'enable_relationship' ) ) {
4c79b5
	if ( $t_resolved <= $f_new_status ) {
4c79b5
		if ( relationship_can_resolve_bug( $f_bug_id ) == false ) {
4c79b5
			echo "" . lang_get( 'relationship_warning_blocking_bugs_not_resolved_2' ) . "";
4c79b5
		}
4c79b5
	}
4c79b5
}
4c79b5
?>
4c79b5
4c79b5
4c79b5
$t_current_resolution = $t_bug->resolution;
4c79b5
$t_bug_is_open = in_array( $t_current_resolution, array( OPEN, REOPENED ) );
4c79b5
if ( ( $t_resolved <= $f_new_status ) && ( ( CLOSED > $f_new_status ) || ( $t_bug_is_open ) ) ) { ?>
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		<select name="resolution">
4c79b5
			
4c79b5
                $t_resolution = $t_bug_is_open ? FIXED : $t_current_resolution;
4c79b5
                print_enum_string_option_list( "resolution", $t_resolution );
4c79b5
            ?>
4c79b5
		</select>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
if ( ( $t_resolved <= $f_new_status ) && ( CLOSED > $f_new_status ) ) { ?>
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		<input type="text" name="duplicate_id" maxlength="7" />
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
if ( ( $t_resolved > $f_new_status ) &&
4c79b5
		access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold')), $f_bug_id) ) { ?>
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		<select name="handler_id">
4c79b5
			<option value="0"></option>
4c79b5
			handler_id, $t_bug->project_id ) ?>
4c79b5
		</select>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
# @@@ thraxisp - I undid part of the change for #5068 for #5527
4c79b5
#  We really need to say what fields are shown in which statusses. For now,
4c79b5
#  this page will show required custom fields in update mode, or 
4c79b5
#  display or required fields on resolve or close
4c79b5
$t_custom_status_label = "update"; # Don't show custom fields by default
4c79b5
if ( ( $f_new_status == $t_resolved ) &&
4c79b5
			( CLOSED > $f_new_status ) ) {
4c79b5
	$t_custom_status_label = "resolved";
4c79b5
}
4c79b5
if ( CLOSED == $f_new_status ) {
4c79b5
	$t_custom_status_label = "closed";
4c79b5
}
4c79b5
4c79b5
$t_related_custom_field_ids = custom_field_get_linked_ids( bug_get_field( $f_bug_id, 'project_id' ) );
4c79b5
4c79b5
foreach( $t_related_custom_field_ids as $t_id ) {
4c79b5
	$t_def = custom_field_get_definition( $t_id );
4c79b5
	$t_display = $t_def['display_' . $t_custom_status_label];
4c79b5
	$t_require = $t_def['require_' . $t_custom_status_label];
4c79b5
	
4c79b5
	if ( ( "update" == $t_custom_status_label ) && ( ! $t_require ) ) {
4c79b5
        continue;
4c79b5
	}
4c79b5
	if ( in_array( $t_custom_status_label, array( "resolved", "closed" ) ) && ! ( $t_display || $t_require ) ) {
4c79b5
        continue;
4c79b5
	}
4c79b5
	if ( custom_field_has_write_access( $t_id, $f_bug_id ) ) {
4c79b5
?>
4c79b5
>
4c79b5
	
4c79b5
		*
4c79b5
	
4c79b5
	
4c79b5
		
4c79b5
			print_custom_field_input( $t_def, $f_bug_id );
4c79b5
		?>
4c79b5
	
4c79b5
4c79b5
4c79b5
	} #  custom_field_has_write_access( $t_id, $f_bug_id ) )
4c79b5
	else if ( custom_field_has_read_access( $t_id, $f_bug_id ) ) {
4c79b5
?>
4c79b5
	>
4c79b5
		
4c79b5
			
4c79b5
		
4c79b5
		
4c79b5
			
4c79b5
		
4c79b5
	
4c79b5
4c79b5
	} # custom_field_has_read_access( $t_id, $f_bug_id ) )
4c79b5
} # foreach( $t_related_custom_field_ids as $t_id )
4c79b5
?>
4c79b5
4c79b5
4c79b5
if ( ( $f_new_status >= $t_resolved ) && access_has_bug_level( config_get( 'handle_bug_threshold' ), $f_bug_id ) ) {
4c79b5
	$t_show_version = ( ON == config_get( 'show_product_version' ) )
4c79b5
		|| ( ( AUTO == config_get( 'show_product_version' ) )
4c79b5
					&& ( count( version_get_all_rows( $t_bug->project_id ) ) > 0 ) );
4c79b5
	if ( $t_show_version ) {
4c79b5
?>
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		<select name="fixed_in_version">
4c79b5
			
4c79b5
							bug_get_field( $f_bug_id, 'project_id' ), VERSION_ALL ) ?>
4c79b5
		</select>
4c79b5
	
4c79b5
4c79b5
4c79b5
	} ?>
4c79b5
4c79b5
4c79b5
if ( ( $f_new_status >= $t_resolved ) && ( CLOSED > $f_new_status ) ) { ?>
4c79b5
4c79b5
4c79b5
				&& ( access_has_bug_level( access_get_status_threshold( CLOSED ), $f_bug_id ) ) ) { ?>
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		<input type="checkbox" name="close_now" />
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	if ( ON == $f_reopen_flag ) {
4c79b5
		# bug was re-opened
4c79b5
		printf("	<input type=\"hidden\" name=\"resolution\" value=\"%s\" />\n",  config_get( 'bug_reopen_resolution' ) );
4c79b5
	}
4c79b5
?>
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		<textarea name="bugnote_text" cols="80" rows="10"></textarea>
4c79b5
	
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
4c79b5
		$t_default_bugnote_view_status = config_get( 'default_bugnote_view_status' );
4c79b5
		if ( access_has_bug_level( config_get( 'set_view_status_threshold' ), $f_bug_id ) ) {
4c79b5
?>
4c79b5
			<label title="<?php echo lang_get( 'private' )?>">
4c79b5
			<input type="checkbox" name="private" <?php check_checked( $t_default_bugnote_view_status, VS_PRIVATE ); ?> />
4c79b5
4c79b5
			echo lang_get( 'private' );
4c79b5
			echo '</label>';
4c79b5
		} else {
4c79b5
			echo get_enum_element( 'project_view_state', $t_default_bugnote_view_status );
4c79b5
		}
4c79b5
?>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		<input type="text" name="time_tracking" size="5" value="0:00" />
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	
4c79b5
		<input type="submit" class="button" value="<?php echo lang_get( $t_status_label . '_bug_button' ) ?>" />
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
</form>
4c79b5
4c79b5
4c79b5

4c79b5
4c79b5
	include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'bug_view_inc.php' );
4c79b5
	include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'bugnote_view_inc.php' );
4c79b5
?>
4c79b5
4c79b5