Permalink
Browse files

Code cleanup in bug_report.php

- Move $f_rel_type init to where others form vars are set
- Remove duplicate initialization of form variable $f_master_bug_id
- Use defined $t_project_id instead of $t_master_bug->project_id
- Replace hardcoded numbers with relationship constants
  • Loading branch information...
1 parent cbc9382 commit a0ae5ce04f16570a7fa45ca5af623b28798a820d @dregad dregad committed Feb 5, 2014
Showing with 4 additions and 6 deletions.
  1. +4 −6 bug_report.php
View
@@ -87,9 +87,9 @@
trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
}
$t_master_bug = bug_get( $f_master_bug_id, true );
- project_ensure_exists( $t_master_bug->project_id );
- access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_master_bug->project_id ), $f_master_bug_id );
$t_project_id = $t_master_bug->project_id;
+ project_ensure_exists( $t_project_id );
+ access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $f_master_bug_id );
} else {
$f_project_id = gpc_get_int( 'project_id' );
project_ensure_exists( $f_project_id );
@@ -129,6 +129,7 @@
$t_bug_data->due_date = date_get_null();
}
+$f_rel_type = gpc_get_int( 'rel_type', BUG_REL_NONE );
$f_files = gpc_get_file( 'ufile', null ); /** @todo (thraxisp) Note that this always returns a structure */
$f_report_stay = gpc_get_bool( 'report_stay', false );
$f_copy_notes_from_parent = gpc_get_bool( 'copy_notes_from_parent', false);
@@ -214,9 +215,6 @@
}
}
-$f_master_bug_id = gpc_get_int( 'm_id', 0 );
-$f_rel_type = gpc_get_int( 'rel_type', -1 );
-
if ( $f_master_bug_id > 0 ) {
# it's a child generation... let's create the relationship and add some lines in the history
@@ -227,7 +225,7 @@
history_log_event_special( $t_bug_id, BUG_CREATED_FROM, '', $f_master_bug_id );
history_log_event_special( $f_master_bug_id, BUG_CLONED_TO, '', $t_bug_id );
- if ( $f_rel_type >= 0 ) {
+ if ( $f_rel_type >= BUG_REL_ANY ) {
# Add the relationship
relationship_add( $t_bug_id, $f_master_bug_id, $f_rel_type );

0 comments on commit a0ae5ce

Please sign in to comment.