Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 55c53f1d507f2e62ad44da507d0c70eecc2c964b 2 parents dd92630 + d20c5af
@dregad dregad authored
View
2  bug_report_page.php
@@ -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>
View
21 config_defaults_inc.php
@@ -1159,6 +1159,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"
* category that is created in the default database.
@@ -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(
@@ -3723,7 +3734,7 @@
* Sub-projects should inherit versions from parent projects.
*/
$g_subprojects_inherit_versions = ON;
-
+
/**********************************
* Debugging / Developer Settings *
**********************************/
@@ -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
View
2  core/constant_inc.php
@@ -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 );
View
8 core/relationship_api.php
@@ -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
}
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.