Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 55c53f1

Browse files
committedOct 6, 2011
Merge pull request #14 from dregad/fix-12450-relationship-defaults
Better handling of bug relationship defaults via 2 new options in config_defaults_inc.php
2 parents dd92630 + d20c5af commit 55c53f1

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed
 

‎bug_report_page.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@
498498
<?php echo lang_get( 'relationship_with_parent' ) ?>
499499
</td>
500500
<td>
501-
<?php relationship_list_box( /* none */ -2, "rel_type", false, true ) ?>
501+
<?php relationship_list_box( config_get( 'default_bug_relationship_clone' ), "rel_type", false, true ) ?>
502502
<?php echo '<b>' . lang_get( 'bug' ) . ' ' . bug_format_id( $f_master_bug_id ) . '</b>' ?>
503503
</td>
504504
</tr>

‎config_defaults_inc.php

+16-5
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,18 @@
11581158
*/
11591159
$g_default_bug_eta = ETA_NONE;
11601160

1161+
/**
1162+
* Default for new bug relationships
1163+
* @global int $g_default_bug_relationship
1164+
*/
1165+
$g_default_bug_relationship = BUG_RELATED;
1166+
1167+
/**
1168+
* Default relationship between a new bug and its parent when cloning it
1169+
* @global int $g_default_bug_relationship_clone
1170+
*/
1171+
$g_default_bug_relationship_clone = BUG_REL_NONE;
1172+
11611173
/**
11621174
* Default global category to be used when an issue is moved from a project to another
11631175
* that doesn't have a category with a matching name. The default is 1 which is the "General"
@@ -3671,11 +3683,10 @@
36713683
* @global int $g_manage_plugin_threshold
36723684
*/
36733685
$g_manage_plugin_threshold = ADMINISTRATOR;
3674-
3675-
3686+
36763687
/**
36773688
* A mapping of file extensions to mime types, used when serving resources from plugins
3678-
*
3689+
*
36793690
* @global array $g_plugin_mime_types
36803691
*/
36813692
$g_plugin_mime_types = array(
@@ -3723,7 +3734,7 @@
37233734
* Sub-projects should inherit versions from parent projects.
37243735
*/
37253736
$g_subprojects_inherit_versions = ON;
3726-
3737+
37273738
/**********************************
37283739
* Debugging / Developer Settings *
37293740
**********************************/
@@ -3841,7 +3852,7 @@
38413852
* @global string $g_log_destination
38423853
*/
38433854
$g_log_destination = '';
3844-
3855+
38453856
/**
38463857
* if OFF, will include original javascript files
38473858
* if ON, will include javascript files that have been compressed by yuicompressor if available

‎core/constant_inc.php

+2
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@
200200
define( 'REV_BUGNOTE', 4 );
201201

202202
# bug relationship constants
203+
define( 'BUG_REL_NONE', -2 );
204+
define( 'BUG_REL_ANY', -1 );
203205
define( 'BUG_DUPLICATE', 0 );
204206
define( 'BUG_RELATED', 1 );
205207
define( 'BUG_DEPENDANT', 2 );

‎core/relationship_api.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -772,17 +772,17 @@ function relationship_get_summary_text( $p_bug_id ) {
772772
* @param int $p_bug_id Bug id
773773
* @return null
774774
*/
775-
function relationship_list_box( $p_default_rel_type = -1, $p_select_name = "rel_type", $p_include_any = false, $p_include_none = false ) {
775+
function relationship_list_box( $p_default_rel_type = BUG_REL_ANY, $p_select_name = "rel_type", $p_include_any = false, $p_include_none = false ) {
776776
global $g_relationships;
777777
?>
778778
<select name="<?php echo $p_select_name?>">
779779
<?php if( $p_include_any ) {?>
780-
<option value="-1" <?php echo( $p_default_rel_type == -1 ? ' selected="selected"' : '' )?>>[<?php echo lang_get( 'any' )?>]</option>
780+
<option value="<?php BUG_REL_ANY ?>" <?php echo( $p_default_rel_type == BUG_REL_ANY ? ' selected="selected"' : '' )?>>[<?php echo lang_get( 'any' )?>]</option>
781781
<?php
782782
}
783783

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.