Skip to content

Commit

Permalink
Merge pull request #14 from dregad/fix-12450-relationship-defaults
Browse files Browse the repository at this point in the history
Better handling of bug relationship defaults via 2 new options in config_defaults_inc.php
  • Loading branch information
dregad committed Oct 6, 2011
2 parents dd92630 + d20c5af commit 55c53f1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bug_report_page.php
Expand Up @@ -498,7 +498,7 @@
<?php echo lang_get( 'relationship_with_parent' ) ?>
</td>
<td>
<?php relationship_list_box( /* none */ -2, "rel_type", false, true ) ?>
<?php relationship_list_box( config_get( 'default_bug_relationship_clone' ), "rel_type", false, true ) ?>
<?php echo '<b>' . lang_get( 'bug' ) . ' ' . bug_format_id( $f_master_bug_id ) . '</b>' ?>
</td>
</tr>
Expand Down
21 changes: 16 additions & 5 deletions config_defaults_inc.php
Expand Up @@ -1158,6 +1158,18 @@
*/
$g_default_bug_eta = ETA_NONE;

/**
* Default for new bug relationships
* @global int $g_default_bug_relationship
*/
$g_default_bug_relationship = BUG_RELATED;

/**
* Default relationship between a new bug and its parent when cloning it
* @global int $g_default_bug_relationship_clone
*/
$g_default_bug_relationship_clone = BUG_REL_NONE;

/**
* Default global category to be used when an issue is moved from a project to another
* that doesn't have a category with a matching name. The default is 1 which is the "General"
Expand Down Expand Up @@ -3671,11 +3683,10 @@
* @global int $g_manage_plugin_threshold
*/
$g_manage_plugin_threshold = ADMINISTRATOR;



/**
* A mapping of file extensions to mime types, used when serving resources from plugins
*
*
* @global array $g_plugin_mime_types
*/
$g_plugin_mime_types = array(
Expand Down Expand Up @@ -3723,7 +3734,7 @@
* Sub-projects should inherit versions from parent projects.
*/
$g_subprojects_inherit_versions = ON;

/**********************************
* Debugging / Developer Settings *
**********************************/
Expand Down Expand Up @@ -3841,7 +3852,7 @@
* @global string $g_log_destination
*/
$g_log_destination = '';

/**
* if OFF, will include original javascript files
* if ON, will include javascript files that have been compressed by yuicompressor if available
Expand Down
2 changes: 2 additions & 0 deletions core/constant_inc.php
Expand Up @@ -200,6 +200,8 @@
define( 'REV_BUGNOTE', 4 );

# bug relationship constants
define( 'BUG_REL_NONE', -2 );
define( 'BUG_REL_ANY', -1 );
define( 'BUG_DUPLICATE', 0 );
define( 'BUG_RELATED', 1 );
define( 'BUG_DEPENDANT', 2 );
Expand Down
8 changes: 4 additions & 4 deletions core/relationship_api.php
Expand Up @@ -772,17 +772,17 @@ function relationship_get_summary_text( $p_bug_id ) {
* @param int $p_bug_id Bug id
* @return null
*/
function relationship_list_box( $p_default_rel_type = -1, $p_select_name = "rel_type", $p_include_any = false, $p_include_none = false ) {
function relationship_list_box( $p_default_rel_type = BUG_REL_ANY, $p_select_name = "rel_type", $p_include_any = false, $p_include_none = false ) {
global $g_relationships;
?>
<select name="<?php echo $p_select_name?>">
<?php if( $p_include_any ) {?>
<option value="-1" <?php echo( $p_default_rel_type == -1 ? ' selected="selected"' : '' )?>>[<?php echo lang_get( 'any' )?>]</option>
<option value="<?php BUG_REL_ANY ?>" <?php echo( $p_default_rel_type == BUG_REL_ANY ? ' selected="selected"' : '' )?>>[<?php echo lang_get( 'any' )?>]</option>
<?php
}

if( $p_include_none ) {?>
<option value="-2" <?php echo( $p_default_rel_type == -2 ? ' selected="selected"' : '' )?>>[<?php echo lang_get( 'none' )?>]</option>
<option value="<?php BUG_REL_NONE ?>" <?php echo( $p_default_rel_type == BUG_REL_NONE ? ' selected="selected"' : '' )?>>[<?php echo lang_get( 'none' )?>]</option>
<?php
}

Expand Down Expand Up @@ -833,7 +833,7 @@ function relationship_view_box( $p_bug_id ) {
<form method="post" action="bug_relationship_add.php">
<?php echo form_security_field( 'bug_relationship_add' ) ?>
<input type="hidden" name="src_bug_id" value="<?php echo $p_bug_id?>" size="4" />
<?php relationship_list_box( -1 )?>
<?php relationship_list_box( config_get( 'default_bug_relationship' ) )?>
<input type="text" name="dest_bug_id" value="" />
<input type="submit" name="add_relationship" class="button" value="<?php echo lang_get( 'add_new_relationship_button' )?>" />
</form>
Expand Down

0 comments on commit 55c53f1

Please sign in to comment.