how to remove [All Project] from categories of report issue

Post about your customizations to share with others.

Moderators: Contributor, Developer

Post Reply
mshahzad
Posts: 10
Joined: Dec 22, 2015 6:47 am

how to remove [All Project] from categories of report issue

Post by mshahzad » Dec 22, 2015 6:49 am

how to remove [All Project] from categories of report issue

atrol
Site Admin
Posts: 7301
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: how to remove [All Project] from categories of report is

Post by atrol » Dec 22, 2015 9:07 am

Seems you didn't read or didn't understand what I wrote at https://www.mantisbt.org/bugs/view.php?id=20410#c52160

You can create categories per project and deactivate global categories.
There is a check box "Inherit Global Categories" on page Manage > Manage projects after clicking the link for the project you want to configure.
There is a section "Categories" on the same page to add project specific categories.
Please use Search before posting and read the Manual

mshahzad
Posts: 10
Joined: Dec 22, 2015 6:47 am

Re: how to remove [All Project] from categories of report is

Post by mshahzad » Dec 23, 2015 12:46 am

we can deactivate the global categories very easily. but the problem is that I have used all these global categories in already reported bugs and if now i deactivate these global categories then what will be happened with categories of those already reported bugs. i have almost 1800 bugs. will i changed their category one by one.
so, please tell me how can i change the code to remove [All Project] from categories.

atrol
Site Admin
Posts: 7301
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: how to remove [All Project] from categories of report is

Post by atrol » Dec 28, 2015 8:51 am

Remove or comment these lines in file core/category_api.php

Code: Select all

		if( $p_show_project && $t_project_id != $t_current_project ) {
			return '[' . project_get_name( $t_project_id ) . '] ' . $t_row['name'];
		}
Please use Search before posting and read the Manual

nshah
Posts: 1
Joined: Jan 09, 2018 4:57 pm

Re: how to remove [All Project] from categories of report is

Post by nshah » Jan 09, 2018 5:03 pm

I am new to PHP, but I think overriding the default will be better idea. This way we will not override, if someone is sending this field explicitly.

/**
* Retrieves category name (including project name if required)
* @param string $p_category_id Category identifier.
* @param boolean $p_show_project Show project details.
* @param integer $p_current_project Current project id override.
* @return string category full name
* @access public
*/
function category_full_name( $p_category_id, $p_show_project = false, $p_current_project = null ) {
if( 0 == $p_category_id ) {
# No Category
return lang_get( 'no_category' );
} else if( !category_exists( $p_category_id ) ) {

jeromedl
Posts: 6
Joined: May 09, 2018 8:48 am

Re: how to remove [All Project] from categories of report issue

Post by jeromedl » May 09, 2018 9:55 am

Hi @atrol

May I share my point of view on this issue? (It happens I have the same request!)

Indeed, Mantis, as currently designed, offers a way to suppress the "[All Project]" mention by having for each project its own categories.
However, if using Mantis for multiple customers (each of them seeing only one project), it perfectly make sense to define globally categories (in fact, most of the settings are often global: categories, workflow, resolution status, etc.) and from a user/customer perspective, what is the added value of seeing this mention? Except diluting the key information, I can't see. It is only useful when it's not [All projects] but [project XXX] in case you can see several projects.
This is more an admin/manager information required on Project's management page.

I was hoping that $g_summary_category_include_project = OFF will permit to reach the expected result but it works in a subtle different way!

While awaiting a built-in feature (should I create a request?), I've patched the code this way:

Code: Select all

		if( $p_show_project && /* HACK START */ $t_project_id != 0 && /* HACK END */ $t_project_id != $t_current_project ) {
			return '[' . project_get_name( $t_project_id ) . '] ' . $t_row['name'];
		}

Post Reply