Page 1 of 1

Different Field Name Aliases per Project?

Posted: 15 May 2019, 20:42
by sachintha81
Is there a way to give different aliases for the same fields, based on project.

My requirement is to have different projects with different set of fields, and I know I can use custom fields for this, and then hide the unwanted fields by using the bug_report_page_fields configuration option.

But there are few primary fields, such as 'summary' and 'description' which cannot be hidden using the above mentioned option. So I'm wondering if there's a way for me to at least rename them.

For example, say I have two projects, one BUG TRACKER, and another named KNOWLEDGEBASE.

I want the summary field to be named:
'Alarm' in BUG TRACKER
'Item' in KNOWLEDGEBASE

Is this possible?

I know I can change the aliases from lang/strings_english.txt file by setting '$s_summary = 'Alarm' etc, but that is a global change and is inherited by all projects.

Re: Different Field Name Aliases per Project?

Posted: 16 May 2019, 11:34
by cas
No, is not available as far as I know.
What you could do, is use 2 instances of mantis, each having dedicated titles for those fields.
You could arrange access to both instances via a simple portal page :mrgreen:

Re: Different Field Name Aliases per Project?

Posted: 16 May 2019, 18:04
by sachintha81
That's a bummer.

Well what you could is possible I guess, but would have been so much nicer if we had this feature.

Re: Different Field Name Aliases per Project?

Posted: 12 Feb 2022, 22:29
by tet-com@freemail.hu
Hi I am looking for exactly the same feature as sachintha81, to rename Description in different in a project.
Alternativ solution: How can I hide Description, and make it "NOT Required", and make a Searchable "Custom Field"?

Re: Different Field Name Aliases per Project?

Posted: 16 Feb 2022, 05:35
by rondezo
cas wrote: 16 May 2019, 11:34 No, is not available as far as I know.
What you could do, is use 2 instances of mantis, each having dedicated titles for those fields.
You could arrange access to both instances via a simple portal page :mrgreen:
can I tell you in more detail which portal you are talking about?

Re: Different Field Name Aliases per Project?

Posted: 16 Feb 2022, 13:01
by cas
You can do this writing some code in core/custom_strings_inc.php

Code: Select all

if (function_exists('helper_get_current_project')) {
	$t_current_project = helper_get_current_project();
	if ($t_current_project === 11){
		$s_summary = 'BullshitStory';
	}
}
So first is to check if the correct function is available
Then retrieve the project_id
Next check if this is the correct project
If so, provide the correct name.

Of course you also can use the switch statement in case you need changes for multiple project.

The correct screen field names you can find in the corresponding language text file.

Re: Different Field Name Aliases per Project?

Posted: 02 Mar 2022, 08:24
by rondezo
I have version 2.24.4 and I don't have such a file. Is it necessary to create a new file?
cas wrote: 16 Feb 2022, 13:01 You can do this writing some code in core/custom_strings_inc.php

Code: Select all

if (function_exists('helper_get_current_project')) {
	$t_current_project = helper_get_current_project();
	if ($t_current_project === 11){
		$s_summary = 'BullshitStory';
	}
}
So first is to check if the correct function is available
Then retrieve the project_id
Next check if this is the correct project
If so, provide the correct name.

Of course you also can use the switch statement in case you need changes for multiple project.

The correct screen field names you can find in the corresponding language text file.

Re: Different Field Name Aliases per Project?

Posted: 02 Mar 2022, 08:48
by cas
sorry, you need to create the file in the config directory if it does not exists.
Also reviewed the code, which needs to be:

Code: Select all

$t_cookie_name = config_get_global( 'project_cookie' );
$t_project_id = $_COOKIE[$t_cookie_name];
if ($t_project_id === '11'){
	$s_summary = 'BullshitStory';
}
So first is to retrieve the project_id
Next check if this is the correct project
If so, provide the correct name.
Of course you also can use the switch statement in case you need changes for multiple project.
The correct screen field names you can find in the corresponding language text file.