Different Field Name Aliases per Project?

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
sachintha81
Posts: 20
Joined: 07 Mar 2019, 20:59

Different Field Name Aliases per Project?

Post 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.
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Different Field Name Aliases per Project?

Post 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:
sachintha81
Posts: 20
Joined: 07 Mar 2019, 20:59

Re: Different Field Name Aliases per Project?

Post 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.
tet-com@freemail.hu
Posts: 22
Joined: 07 Feb 2019, 11:44

Re: Different Field Name Aliases per Project?

Post 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"?
rondezo
Posts: 85
Joined: 09 Feb 2021, 09:18

Re: Different Field Name Aliases per Project?

Post 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?
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Different Field Name Aliases per Project?

Post 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.
rondezo
Posts: 85
Joined: 09 Feb 2021, 09:18

Re: Different Field Name Aliases per Project?

Post 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.
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Different Field Name Aliases per Project?

Post 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.
Post Reply