Unofficial way to customize Severity & Priority

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
fralaw
Posts: 12
Joined: 22 Jul 2008, 07:19

Unofficial way to customize Severity & Priority

Post by fralaw »

Dear all,

I have worked out a way to customize the severity and priority and would like to share and hopefully some comments from the Mantis developers.

Mantis version:
Tried on versions 1.0.3 and 1.1.2

Assumptions:
1. It is assumed to be English language and no consideration of other languages. However, people who need to use it in other languages can apply the same way with another language. I try to avoid the effort in internationalization. :D
2. I have a quick scan on php files and found no logic directly hard code with severity and priority constants. Therefore, it is assumed that there is no hard coded logic in Mantis depends on the default set of severity and priority.

Customization steps:
1. Create the file "custom_strings_inc.php" in the main "mantis" directory.
<?php
$s_severity_enum_string = '10:tweak,20:minor,30:major,40:crash';
$s_priority_enum_string = '10:low,20:normal,30:high,40:urgent';
?>

2. Rename "config_inc.php" to "custom_config_inc.php" in the main "mantis" directory.
> mv config_inc.php custom_config_inc.php

3. Add the following lines to the end of "custom_config_inc.php".
# Customize severity and default when reporting a new bug
$g_severity_enum_string = '10:tweak,20:minor,30:major,40:crash';
$g_default_bug_severity = 20;

# Customize priority and default when reporting a new bug
$g_priority_enum_string = 10:low,20:normal,30:high,40:urgent';
$g_default_bug_priority = 10;

# Customize icon associative arrays
$g_status_icon_arr = array (
LOW => 'prority_low_1.gif',
NORMAL => 'priority_1.gif',
HIGH => 'priority_2.gif',
URGENT => 'priority_3.gif');

4. Create a new "config_inc.php" in the main "mantis" directory. It should contain the following lines only.
<?php
require_once('custom_config_inc.php');
?>

Notes:
1. The severity and priority are purposely chosen to use a continuous part of the default set. This is to reduce the any potential (unknown) impacts to the system.
2. Customization of configuration file renamed so that all customization are contained in files started "custom_*".
3. Default severity and priority must be set with the associated number instead of constant such as MINOR or NORMAL. This is because constant in PHP5 cannot be redefined.
3. Association of priority and icon were also customized to meet my selected priority.

If the assumptions are not voided, this customization could possibly work with future upgrades.

Regards,
Francis
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Re: Unofficial way to customize Severity & Priority

Post by vboctor »

Looks good. However, the creation of "custom_config_inc.php" is not needed. "config_inc.php" is created on initial installation and is not overwritten on upgrades.
Migrate your MantisBT to the MantisHub Cloud
thegisguy
Posts: 13
Joined: 09 Sep 2008, 19:22

Re: Unofficial way to customize Severity & Priority

Post by thegisguy »

I followed your directions. The issues is I now see the constant values which were created for Severity & Priority. However I also get values of @@50@@, @@60@@, @@60@@ in the drop down list. Any idea why this would be?
thegisguy
Posts: 13
Joined: 09 Sep 2008, 19:22

Re: Unofficial way to customize Severity & Priority

Post by thegisguy »

Never mind... I figured it out. I needed to change the values in the config_defaults_inc.php file. Once I did that life was good.
autra
Posts: 21
Joined: 25 Aug 2008, 09:40

Re: Unofficial way to customize Severity & Priority

Post by autra »

If you have some @@, it is because the $s variable in your lang files aren't set, I believe.

Create them in custom_strings_inc.php...
vzw614
Posts: 143
Joined: 15 May 2008, 14:59

Re: Unofficial way to customize Severity & Priority

Post by vzw614 »

You shouldn't make changes to config_default_inc.php because that file gets over-written when you upgrade to a new version of mantis. Copy/paste any sections you need to change into config_inc.php and make your changes there. That file is not over-written during an upgrade.
thegisguy
Posts: 13
Joined: 09 Sep 2008, 19:22

Re: Unofficial way to customize Severity & Priority

Post by thegisguy »

If I add the Enum Strings to the Config_inc.php file, do I still need to have them in the Custom_String_inc.php file as well?

Thanks in advance
vzw614
Posts: 143
Joined: 15 May 2008, 14:59

Re: Unofficial way to customize Severity & Priority

Post by vzw614 »

Yes. The custom_string_inc.php file is where Mantis gets the actual text for the strings.
Eva Xu
Posts: 10
Joined: 25 Aug 2009, 01:40

Re: Unofficial way to customize Severity & Priority

Post by Eva Xu »

I followed your directions, but I didn't succeed with version 1.1.8.
Customization steps:
1. Create the file "custom_strings_inc.php" in the main "mantis" directory.
<?php
$s_severity_enum_string = '10:low,20:medium,30:high';
$s_priority_enum_string = '10:minor,20:major,30:critical,40:showstopper';
?>

2. Rename "config_inc.php" to "custom_config_inc.php" in the main "mantis" directory.

3. Add the following lines to the end of "custom_config_inc.php".
# Customize severity and default when reporting a new bug
$g_severity_enum_string = '10:low,20:medium,30:high';
$g_default_bug_severity = 20;

# Customize priority and default when reporting a new bug
$g_priority_enum_string = '10:minor,20:major,30:critical,40:showstopper';
$g_default_bug_priority = 10;


4. Create a new "config_inc.php" in the main "mantis" directory. It should contain the following lines only.
<?php
require_once('custom_config_inc.php');
?>
The severity dropdown list still display feature,trivial,text. and priority dropdown list display none,low,normal,high.
Can you help me why the value didn't change as to customize?
Thanks!
Phani
Posts: 1
Joined: 04 Apr 2015, 21:16

Re: Unofficial way to customize Severity & Priority

Post by Phani »

I face same situation here but finally got solution for this.

made two changes for add more option for Priority in Mantis issue.

before look like this
$s_priority_enum_string = '10:none,20:low,30:normal,40:high,50:urgent,60:immediate'; in Mantis\lang\strings_english.txt
$g_priority_enum_string = '10:none,20:low,30:normal,40:high,50:urgent,60:immediate'; in Mantis\config_defaults_inc.php

after i made change
$s_priority_enum_string = '10:priority-1,20:priority-2,30:priority-3,40:priority-4,50:priority-5,60:priority-6,70:priority-7,80:priority-8,90:priority-9,100:priority-10'; in Mantis\lang\strings_english.txt
$g_priority_enum_string= '10:priority-1,20:priority-2,30:priority-3,40:priority-4,50:priority-5,60:priority-6,70:priority-7,80:priority-8,90:priority-9,100:priority-10'; in Mantis\config_defaults_inc.php

It is working fine in my system.
Post Reply