Adding custom resolution values to MantisBT

Recently, one of our MantisBT users asked us for a custom resolution value. The MantisBT admin guide . In the last paragraph of the suggests this is possible, but doesn’t tell you how. The closest we get is a description on implementing custom status values, plus some questionable google results that require some interpretation. I’ve done the interpretation for you, so you don’t have to. There are two existing variables in the MantisBT code that define the default status values, $g_resolution_enum_string and $s_resolution_enum_string. I’ve shortened the output to just the lines we care about:

[rnelson0@mantis ~]$ grep -R resolution_enum_string /srv/www/mantis/config_defaults_inc.php /srv/www/mantis/lang/*english*
/srv/www/mantis/config_defaults_inc.php:        $g_resolution_enum_string                       = '10:open,20:fixed,30:reopened,40:unable to duplicate,50:not fixable,60:duplicate,70:not a bug,80:suspended,90:wont fix';
/srv/www/mantis/lang/strings_english.txt:$s_resolution_enum_string = '10:open,20:fixed,30:reopened,40:unable to reproduce,50:not fixable,60:duplicate,70:no change required,80:suspended,90:won\'t fix';

You may notice a slight difference – the global var says “unable to duplicate” and the other var says “unable to reproduce”. Without any modifications, “unable to reproduce” is seen by users so we’ll take the value of $s_resolution_enum_string and use it for both.

When you customize the strings, you usually want to add to the list, rather than remove existing items – especially if you have any tickets that already use one of those values – though this is your choice. The ID number attached to each value is what is stored in the database; they need to be unique and not change over time, but do not need to be spaced out by units of 10 (that’s more helpful when modifying the status values, as that’s used in a workflow). The description string is displayed to the user in the web front-end but is not stored in the database.

I chose to add a new value and settled on an ID and description pair of “91:project completed”. Add the modified global $g_resolution_enum_string to config_inc.php and $s_resolution_enum_string to custom_strings_inc.php. Here are the two new strings:

$g_resolution_enum_string = '10:open,20:fixed,30:reopened,40:unable to reproduce,50:not fixable,60:duplicate,70:no change required,80:suspended,90:won\'t fix,91:project completed';

$s_resolution_enum_string = '10:open,20:fixed,30:reopened,40:unable to reproduce,50:not fixable,60:duplicate,70:no change required,80:suspended,90:won\'t fix,91:project completed';

Push these two files to the root of your MantisBT install (no need to restart any services) and you will now see the new resolution value when closing a ticket.

MantisBT New Resolution Value

You could also choose to rename a value – the number is stored in the database, so you could change all tickets with a resolution value of “suspended” to “no funding available” by only changing the string value – or remove unused values. There is no cleanup, though, so removing a default or custom resolution value won’t modify existing tickets that have that value. In that case, the resolution value will display as @91@ instead of project completed. Be sure to add the files config_inc.php and custom_strings_inc.php to revision control and deploy them with any MantisBT upgrades to avoid these problems.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s