Customizing Status Values

This section describes how to add a custom status.

  1. Define a constant to map the new status to.

    In the main MantisBT directory, locate and edit file custom_constants_inc.php; (create it if it does not exist)

    <?php
    	# Custom status code
    	define( 'TESTING', 60 );

  2. Define the new status in the enumeration, as well as the corresponding color code.

    In the main mantisbt directory, edit your config_inc.php

    # Revised enum string with new 'testing' status
    $g_status_enum_string = '10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,60:testing,80:resolved,90:closed';
    
    # Status color additions
    $g_status_colors['testing'] = '#ACE7AE';
    Note that the key in the $g_status_colors array must be equal to the value defined for the new status code in $g_status_enum_string.

  3. Define the required translation strings for the new status, for each language used in the installation.

    • s_status_enum_string: status codes translation (refer to the original language strings for standard values)

    • s_XXXX_bug_title: title displayed in the change status page

    • s_XXXX_bug_button: label for the submit button in the change status page

    • s_email_notification_title_for_status_bug_XXXX: title for notification e-mails

    where XXXX is the name of the new status as it was defined in g_status_enum_string above. If XXXX contains spaces, they should be replaced by underscores in the language strings names (e.g. for '35:pending user', use '$s_pending_user_bug_button')

    In the main mantisbt directory, locate and edit file custom_strings_inc.php; (create it if it does not exist)

    <?php
    # Translation for Custom Status Code: testing
    switch( $g_active_language ) {
    
    	case 'french':
    		$s_status_enum_string = '10:nouveau,20:commentaire,30:accepté,40:confirmé,50:affecté,60:à tester,80:résolu,90:fermé';
    
    		$s_testing_bug_title = 'Mettre le bogue en test';
    		$s_testing_bug_button = 'A tester';
    
    		$s_email_notification_title_for_status_bug_testing = 'Le bogue suivant est prêt à être TESTE.';
    		break;
    
    	default: # english
    		$s_status_enum_string = '10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,60:testing,80:resolved,90:closed';
    
    		$s_testing_bug_title = 'Mark issue Ready for Testing';
    		$s_testing_bug_button = 'Ready for Testing';
    
    		$s_email_notification_title_for_status_bug_testing = 'The following issue is ready for TESTING.';
    		break;
    }

    Warning

    Do NOT call lang_get_current() from custom_strings_inc.php, as doing so will reset the active_language, causing the code to return incorrect translations if the default language is different from English. Always use the $g_active_language global variable instead.

  4. Add the new status to the workflow as required.

    This can either be done from the Manage Workflow Transitions page or by manually editing config_inc.php as per the example below:

    $g_status_enum_workflow[NEW_]         ='30:acknowledged,20:feedback,40:confirmed,50:assigned,80:resolved';
    $g_status_enum_workflow[FEEDBACK]     ='30:acknowledged,40:confirmed,50:assigned,80:resolved';
    $g_status_enum_workflow[ACKNOWLEDGED] ='40:confirmed,20:feedback,50:assigned,80:resolved';
    $g_status_enum_workflow[CONFIRMED]    ='50:assigned,20:feedback,30:acknowledged,80:resolved';
    $g_status_enum_workflow[ASSIGNED]     ='60:testing,20:feedback,30:acknowledged,40:confirmed,80:resolved';
    $g_status_enum_workflow[TESTING]      ='80:resolved,20:feedback,50:assigned';
    $g_status_enum_workflow[RESOLVED]     ='90:closed,20:feedback,50:assigned';
    $g_status_enum_workflow[CLOSED]       ='20:feedback,50:assigned';

  5. Check and update existing workflow configurations

    If you do not perform this step and have existing workflow definitions, it will not be possible to transition to and from your new status.

    Go to the Workflow Transitions page (manage_config_workflow_page.php), and update the workflow as appropriate. Make sure that you have picked the correct Project in the selection list).

    Hint: to identify whether you have any workflows that should be updated, open the Manage Configuration Report page (adm_config_report.php) and filter on 'All Users', [any] project and config option = 'status_enum_workflow'. All of the listed projects should be reviewed to eventually include transitions to and from the newly added states.