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

Post about your customizations to share with others.

Moderators: Developer, Contributor

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

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

Post by mshahzad »

how to remove [All Project] from categories of report issue
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post by atrol »

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: 22 Dec 2015, 11:47

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

Post by mshahzad »

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: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post by atrol »

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: 09 Jan 2018, 21:57

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

Post by nshah »

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: 09 May 2018, 13:48

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

Post by jeromedl »

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