How to customise Status per Project
Posted: 12 May 2009, 21:42
I followed the various customization posts on the forum. They all lead to changing the status strings for all projects using global definitions.
Not what I wanted.
There are two things going on in this:
1) The status values (numeric) defined for a project
2) The status labels (strings) that match those values
The problem I found when customizing status was relabeling the strings for each status value per project.
It's easy to setup the status enumeration through the Configuration Report.
What happens next is the status values are mapped to global status strings.
For new status that don't exist globally you will see @75@ in the status dropdown and workflows.
If you define it globally it will affect all projects. If you rename a status globally it affects all projects.
I used custom_strings_inc.php which is intended to allow customisation of strings based on language.
Instead I put in code to customise the string based on the project id. Here's how to do it.
Define the status for the project (and sub-projects)
Manage -> Manage Configuration -> Configuration Report
Set Configuration Option
Username = All Users
Project Name = Select the parent project to apply the new Status values
Configuration Option = status_enum_string
Type = String
Value = 10:new,20:client to provide more information,30:support investigating,35:further investigation,40:escalated to development,45:fixed in release,80:client to test/confirm,90:closed
The default status_enum_string is
10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,80:resolved,90:closed
For my projects I have removed status, renamed status and added status.
Status 20 has been renamed and status 35 was not defined previously.
When I view the status for my project (BTW project_id = 1) I will see global strings for the status (not the new strings) and place holders for undefined status strings like @35@.
Rather than changing the strings for all projects and adding new string globally I'll use the custom_strings_inc.php
I now get status strings based on project as defined in custom_strings_inc.php
I need to write some code to handle all child projects for project 1.
This may look horrible to the makers of Mantis. I started learning PHP last week for a new job where Mantis is the incumbent.
This has just saved the bacon
Comments on how to make this better appreciated.
Cheers,
Peterus
Not what I wanted.
There are two things going on in this:
1) The status values (numeric) defined for a project
2) The status labels (strings) that match those values
The problem I found when customizing status was relabeling the strings for each status value per project.
It's easy to setup the status enumeration through the Configuration Report.
What happens next is the status values are mapped to global status strings.
For new status that don't exist globally you will see @75@ in the status dropdown and workflows.
If you define it globally it will affect all projects. If you rename a status globally it affects all projects.
I used custom_strings_inc.php which is intended to allow customisation of strings based on language.
Instead I put in code to customise the string based on the project id. Here's how to do it.
Define the status for the project (and sub-projects)
Manage -> Manage Configuration -> Configuration Report
Set Configuration Option
Username = All Users
Project Name = Select the parent project to apply the new Status values
Configuration Option = status_enum_string
Type = String
Value = 10:new,20:client to provide more information,30:support investigating,35:further investigation,40:escalated to development,45:fixed in release,80:client to test/confirm,90:closed
The default status_enum_string is
10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,80:resolved,90:closed
For my projects I have removed status, renamed status and added status.
Status 20 has been renamed and status 35 was not defined previously.
When I view the status for my project (BTW project_id = 1) I will see global strings for the status (not the new strings) and place holders for undefined status strings like @35@.
Rather than changing the strings for all projects and adding new string globally I'll use the custom_strings_inc.php
Code: Select all
<?php
# After defining the status_enum_string for the project in Configuration Report those status are available to the project and its sub-projects.
# The issue next is associating strings with the new or project specific status values
# Using custom_strings_inc.php will set the strings for for status based on language.
# The problem with this is the change is global (i.e. for all projects)
# I put in some code to get the current project ID (same code used in the Project selection from helper_api)
require_once( 'core.php' );
# Get the current project id from the project_cookie
$t_cookie_name = config_get( 'project_cookie' );
$t_project_id = gpc_get_cookie( $t_cookie_name, null );
if ( $t_project_id == 1 ) {
# Customize status strings
$s_status_enum_string = '10:new,20:client to provide more information,30:support investigating,35:further investigation,40:escalated to development,45:fixed in release,80:client to test/confirm,90:closed';
}
# You should now put in the various button and notification strings for each status.
I need to write some code to handle all child projects for project 1.
This may look horrible to the makers of Mantis. I started learning PHP last week for a new job where Mantis is the incumbent.
This has just saved the bacon
Comments on how to make this better appreciated.
Cheers,
Peterus