View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012450 | mantisbt | bugtracker | public | 2010-10-15 06:07 | 2014-09-23 18:05 |
| Reporter | cproensa | Assigned To | dregad | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.2.3 | ||||
| Target Version | 1.2.9 | Fixed in Version | 1.2.9 | ||
| Summary | 0012450: default relation type is hardcoded on bug_report_page.php | ||||
| Description | it calls: it would be nice to have it defined on configuration its v1.2.3 but also in current git | ||||
| Tags | No tags attached. | ||||
| Attached Files | fix-12450.patch (3,479 bytes)
diff --git a/bug_report_page.php b/bug_report_page.php
index eb3a180..95d3ec7 100644
--- a/bug_report_page.php
+++ b/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>
diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index 59b4764..8b8dceb 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -1159,6 +1159,12 @@
$g_default_bug_eta = ETA_NONE;
/**
+ * 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.
diff --git a/core/constant_inc.php b/core/constant_inc.php
index 982fcf0..2db57f9 100644
--- a/core/constant_inc.php
+++ b/core/constant_inc.php
@@ -200,6 +200,8 @@ define( 'REV_ADDITIONAL_INFO', 3 );
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 );
diff --git a/core/relationship_api.php b/core/relationship_api.php
index b0949ea..0f33222 100644
--- a/core/relationship_api.php
+++ b/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( BUG_REL_ANY )?>
<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>
| ||||
|
I agree. I added a setting: $g_default_relation_on_clone = BUG_RELATED; And changed the code in bug_report_page.api to: <?php relationship_list_box( config_get( 'default_relation_on_clone' ), "rel_type", false, true ) ?> |
|
|
Please try the attached patch, let me know if that works for you. I'll bounce it off the rest of the dev team [1], to see how they feel about adding a new config option, before committing. |
|
|
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
|
|
MantisBT: master-1.2.x 93bbb36c 2011-09-18 22:35 Details Diff |
Use constants not hardcoded values for relationship lists Defines 2 new constants BUG_REL_NONE and BUG_REL_ANY referenced when building relationship selection lists, instead of using hardcoded values -2 and -1 respectively. Affects issue 0012450 |
Affected Issues 0012450 |
|
| mod - bug_report_page.php | Diff File | ||
| mod - core/constant_inc.php | Diff File | ||
| mod - core/relationship_api.php | Diff File | ||
|
MantisBT: master 47d35580 2011-09-18 22:35 Details Diff |
Use constants not hardcoded values for relationship lists Defines 2 new constants BUG_REL_NONE and BUG_REL_ANY referenced when building relationship selection lists, instead of using hardcoded values -2 and -1 respectively. Affects issue 0012450 |
Affected Issues 0012450 |
|
| mod - bug_report_page.php | Diff File | ||
| mod - core/constant_inc.php | Diff File | ||
| mod - core/relationship_api.php | Diff File | ||
|
MantisBT: master-1.2.x b8b8da14 2011-09-18 23:11 Details Diff |
Add config for default relationship when cloning a bug Introduce a new global config $g_default_bug_relationship_clone, used to preset the selection list relationship of a cloned bug with its parent. Defaults to BUG_REL_NONE. Fix 0012450 |
Affected Issues 0012450 |
|
| mod - bug_report_page.php | Diff File | ||
| mod - config_defaults_inc.php | Diff File | ||
|
MantisBT: master 1f9c4bd1 2011-09-18 23:11 Details Diff |
Add config for default relationship when cloning a bug Introduce a new global config $g_default_bug_relationship_clone, used to preset the selection list relationship of a cloned bug with its parent. Defaults to BUG_REL_NONE. Fix 0012450 |
Affected Issues 0012450 |
|
| mod - bug_report_page.php | Diff File | ||
| mod - config_defaults_inc.php | Diff File | ||