diff --git a/bug_report.php b/bug_report.php index e451ff8..b3617be 100644 --- a/bug_report.php +++ b/bug_report.php @@ -35,7 +35,10 @@ form_security_validate( 'bug_report' ); $t_project_id = null; + $f_master_bug_id = gpc_get_int( 'm_id', 0 ); + $f_rel_type = gpc_get_int( 'rel_type', BUG_REL_NONE ); + if ( $f_master_bug_id > 0 ) { bug_ensure_exists( $f_master_bug_id ); if ( bug_is_readonly( $f_master_bug_id ) ) { @@ -43,9 +46,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 ); @@ -168,9 +171,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 @@ -181,7 +181,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 ); diff --git a/bug_report_page.php b/bug_report_page.php index 4108ae8..42e9cc6 100644 --- a/bug_report_page.php +++ b/bug_report_page.php @@ -55,9 +55,6 @@ $t_bug = bug_get( $f_master_bug_id, true ); - # the user can at least update the master bug (needed to add the relationship)... - access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_bug->project_id ), $f_master_bug_id ); - #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of # what the current project is set to. if( $t_bug->project_id != helper_get_current_project() ) { @@ -210,7 +207,7 @@ @@ -226,7 +223,7 @@ > @@ -524,7 +521,7 @@ 0 ) { + if( $f_master_bug_id > 0 && access_has_bug_level( config_get( 'update_bug_threshold' ), $f_master_bug_id ) ) { ?> > diff --git a/core/html_api.php b/core/html_api.php index 30347c5..2be87b1 100644 --- a/core/html_api.php +++ b/core/html_api.php @@ -1517,12 +1517,12 @@ function html_button_bug_move( $p_bug_id ) { } /** - * Print a button to move the given bug to a different project + * Print a button to clone the given bug * @param int $p_bug_id * @return null */ function html_button_bug_create_child( $p_bug_id ) { - if( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { + if( access_has_bug_level( config_get( 'report_bug_threshold' ), $p_bug_id ) ) { html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) ); } }