Page 1 of 1

Remove Relationships field from view/update bug pages

Posted: 07 Mar 2010, 23:57
by qatester
I want to remove the Relationships field from the View and Update bug pages. I tried to find the enumeration that responsible for turning on/off the Relationships field in config_defaults_inc.php but I couldn't find it. Does anyone know how to hide the Relationships field?

Re: Remove Relationships field from view/update bug pages

Posted: 11 May 2010, 07:16
by vida
I would like to ask the same question. How to hide relationships section from view/update bug page?

Re: Remove Relationships field from view/update bug pages

Posted: 11 May 2010, 07:34
by atrol
There is no way to disable this by normal customization, so you would have to change the code.
If you use MantisBt version 1.2.1 this can be done by changing the file bug_view_inc.php
Just comment out line 696 by adding at # at the beginning of the line
# relationship_view_box ( $tpl_bug->id );

Re: Remove Relationships field from view/update bug pages

Posted: 11 May 2010, 07:47
by vida
Thank you!

Our Mantis will be clear and simple soon, just the last question about hiding something (I promise!): we have only one project (it won't change) and I would like to hide obselete buttons "clone", "move" and also "stick". Is there any trick?

Re: Remove Relationships field from view/update bug pages

Posted: 12 May 2010, 07:12
by atrol
I agree that "move" is obsolet if you have just one project.
"clone" is a nice convenience feature if you have an issue which is nearly the same as an existing one,I would not remove it.
"stick" is also not dependant on having one or more project

Nethertheless if you want it, comment out the following lines in file core/html_api.php

Code: Select all

	# STICK/UNSTICK button
	if ( access_has_bug_level( $t_sticky, $p_bug_id ) ) {
		echo '<td class="center">';
		if ( !bug_get_field( $p_bug_id, 'sticky' ) ) {
			html_button_bug_stick( $p_bug_id );
		} else {
			html_button_bug_unstick( $p_bug_id );
		}
		echo '</td>';
	}

	if( !$t_readonly ) {
		# CREATE CHILD button
		echo '<td class="center">';
		html_button_bug_create_child( $p_bug_id );
		echo '</td>';
	}

	
			# MOVE button
		echo '<td class="center">';
		html_button_bug_move( $p_bug_id );
		echo '</td>';
Ok, now you have a MantisBT with modifications of sourcecode.
Be aware, that all your changes will be lost, if you will update to a newer version.
You have to change the code again manually, especially if the files you changed are also changed in standard MantisBT.

Re: Remove Relationships field from view/update bug pages

Posted: 12 May 2010, 08:35
by Phileas
Following Flag will hide the Sticky Button.
$g_set_bug_sticky_threshold = NOBODY;

But how can I hide the Clone Button?

Re: Remove Relationships field from view/update bug pages

Posted: 12 May 2010, 11:30
by atrol
Phileas, thank you for providing this information, I overlooked this

@vida
to get what you want, ignore my previous post, you have to add the following lines to your config_inc.php

Code: Select all

$g_move_bug_threshold = NOBODY;
$g_set_bug_sticky_threshold = NOBODY;
To remove the clone button, there you have to change sourcecode of core/html_api.php
from

Code: Select all

   if( !$t_readonly ) {
      # CREATE CHILD button
      echo '<td class="center">';
      html_button_bug_create_child( $p_bug_id );
      echo '</td>';
   }
to

Code: Select all

#   if( !$t_readonly ) {
#      # CREATE CHILD button
#      echo '<td class="center">';
#      html_button_bug_create_child( $p_bug_id );
#      echo '</td>';
#   }

Re: Remove Relationships field from view/update bug pages

Posted: 27 Apr 2022, 12:43
by Soumaya
Just thought i would post an update to removing the clone button,
It's no longer located in core/html_api.php, instead it's in the bug_view_inc.php file.

So now you have to make these changes in the bug_view_inc.php file:
from

Code: Select all

# CLONE button
if( $p_flags['can_clone'] ) {
	echo '<div class="pull-left padding-right-2">';
	html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) );
	echo '</div>';
}
to

Code: Select all

# CLONE button
#if( $p_flags['can_clone'] ) {
#	echo '<div class="pull-left padding-right-2">';
#	html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) );
#	echo '</div>';
#}