View Issue Details

IDProjectCategoryView StatusLast Update
0009922mantisbtbugtrackerpublic2014-11-07 16:33
Reportermthibeault Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version1.2.0a2 
Summary0009922: When trying to resolve or close an issue, the duplicate box is available even if the resolution is not duplicate.
Description

When resolving or closing an issue, the duplicate box should only be available when the resolution is duplicate and never otherwise.

Additional Information

Patch added that uses Javascript to hide the box when uneeded. Against the latest GIT commit (a09b9e7c3b9c0cce7ade7c6dba57c8a0d84af669).

TagsNo tags attached.
Attached Files
resolution_for_duplicate.diff (1,692 bytes)   
diff -N -a --unified -r mantisbt/bug_change_status_page.php mantisbt-resolution_for_duplicate/bug_change_status_page.php
--- mantisbt/bug_change_status_page.php	2008-11-30 14:16:41.000000000 -0500
+++ mantisbt-resolution_for_duplicate/bug_change_status_page.php	2008-12-01 13:19:54.198116100 -0500
@@ -125,7 +125,7 @@
 		<?php echo lang_get( 'resolution' ) ?>
 	</td>
 	<td>
-		<select name="resolution">
+		<select id="resolution" name="resolution">
 			<?php 
                 $t_resolution = $t_bug_is_open ? FIXED : $t_current_resolution;
                 print_enum_string_option_list( "resolution", $t_resolution );
@@ -138,7 +138,7 @@
 <?php
 if ( ( $t_resolved <= $f_new_status ) && ( CLOSED > $f_new_status ) ) { ?>
 <!-- Duplicate ID -->
-<tr <?php echo helper_alternate_class() ?>>
+<tr <?php echo helper_alternate_class() ?> id="duplicate_id_row">
 	<td class="category">
 		<?php echo lang_get( 'duplicate_id' ) ?>
 	</td>
@@ -146,6 +146,29 @@
 		<input type="text" name="duplicate_id" maxlength="7" />
 	</td>
 </tr>
+
+<script language="javascript">
+	function is_duplicate_id()
+	{
+		if( document.getElementById("resolution").options[this.selectedIndex].value == <?php echo $g_bug_duplicate_resolution ?> )
+			toggle_control("duplicate_id_row", true);
+		else
+			toggle_control("duplicate_id_row", false);
+	}
+
+	function toggle_control(itemID, enabled)
+	{
+		if (enabled) {
+			document.getElementById(itemID).style.display = 'inline'; 
+		} else { 
+			document.getElementById(itemID).style.display = 'none'; 
+		}
+	}
+	
+	document.getElementById("resolution").onchange = is_duplicate_id;
+	toggle_control("duplicate_id_row", false);
+</script>
+
 <?php } ?>
 
 <?php
resolution_for_duplicate.diff (1,692 bytes)   

Activities