Product SiteDocumentation Site

7.3. Enumerations

Enumerations are used in MantisBT to represent a set of possible values for an attribute. Enumerations are used for access levels, severities, priorities, project statuses, project view state, reproducibility, resolution, ETA, and projection. MantisBT provides the administrator with the flexibility of altering the values in these enumerations. The rest of this topic explains how enumerations work, and then how they can be customised.
How do enumerations work?
core/constant_inc.php defines the constants that correspond to those in the enumeration. These are useful to refer to these enumerations in the configs and the code.
define( 'VIEWER', 10 );
define( 'REPORTER', 25 );
define( 'UPDATER',  40 );
define( 'DEVELOPER', 55 );
define( 'MANAGER', 70 );
define( 'ADMINISTRATOR', 90 );
config_defaults_inc.php includes the defaults for the enumerations. The configuration options that are defaulted here are used in specifying which enumerations are active and should be used in MantisBT.
$g_access_levels_enum_string =
	'10:viewer,25:reporter,40:updater,55:developer,70:manager,90:administrator';

Note

The strings included in the enumerations here are just for documentation purposes, they are not actually shown to the user (due to the need for localisation). Hence, if an entry in this enumeration is not found in the corresponding localised string (i.e. 70:manager), then it will be printed to the user as @70@.
The Language Files (e.g. lang/strings_german.txt) provide the localised strings (German in this case) for enumerations. But again, the master list is the enumeration in the configs themselves, the ones in the language files are just used for finding the localised equivalent for an entry. Hence, if a user changes the config to have only two types of users developers and administrators, then only those will be prompted to the users even if the enumerations in the language files still includes the full list.
$s_access_levels_enum_string =
	'10:Betrachter,25:Reporter,40:Updater,55:Entwickler,70:Manager,90:Administrator';
How can they be customised?
Let say we want to remove access level "Updater" and add access level "Senior Developer".
The file config/custom_constants_inc.php is supported for the exclusive purpose of allowing administrators to define their own constants while maintaining a simple upgrade path for future releases of MantisBT. Note that this file is not distributed with MantisBT and you will need to create it if you need such customisation. In our example, we need to define a constant for the new access level.
define( 'SENIOR_DEVELOPER', 60 );
In config/config_inc.php
// Remove Updater and add Senior Developer
$g_access_levels_enum_string =
	'10:viewer,25:reporter,55:developer,60:senior_developer,70:manager,90:administrator';

// Give access to Senior developers to create/delete custom field.
$g_manage_custom_fields_threshold = SENIOR_DEVELOPER;
Update custom_strings_inc.php (see Section 7.1, “Strings / Translations”)
$s_access_levels_enum_string =
	'10:Betrachter,25:Reporter,40:Updater,55:Entwickler,60:Senior Developer,70:Manager,90:Administrator';

Note

We don't need to remove the Updater entry from the localisation file if the current language is 'English'.
Conclusion
We have covered how enumerations work in general, and how to customise one of them. If you are interested in customising other enumerations, a good starting point would be to go to MantisBT Enum Strings section in config_defaults_inc.php. This section defines all enumerations that are used by MantisBT.