How to customise Status per Project

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
peterus
Posts: 5
Joined: 12 May 2009, 16:20

How to customise Status per Project

Post by peterus »

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

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 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
ronzzkee
Posts: 1
Joined: 16 May 2009, 14:36

Re: How to customise Status per Project

Post by ronzzkee »

thanks a lot for teaching about how to customise Status per Project, i think this is my first steps..




_________________
Vinyl Banners | My Sports
fralaw
Posts: 12
Joined: 22 Jul 2008, 07:19

Re: How to customise Status per Project

Post by fralaw »

Dear Peterus,

Why would you want to have different status for each project?

Regards,
Francis
dyawlak
Posts: 66
Joined: 07 Dec 2007, 16:42

Re: How to customise Status per Project

Post by dyawlak »

I use different statuses for projects. But I use the workflow as a method to bypass the ones I don't need
fralaw
Posts: 12
Joined: 22 Jul 2008, 07:19

Re: How to customise Status per Project

Post by fralaw »

Dear dyawlak,

Are they the same type of projects? Can you give some example? I don't understand why each project would have different status. Thank you.

Regards,
Francis
dyawlak
Posts: 66
Joined: 07 Dec 2007, 16:42

Re: How to customise Status per Project

Post by dyawlak »

They're different projects - we don't use mantis for bug tracking but for task assignments. One project deals with support, one with procurement and so on. The procurement project has additional statuses to the support one. I've used the workflow to ignore these addtional ones.
tdr
Posts: 2
Joined: 29 Oct 2010, 07:34

Re: How to customise Status per Project

Post by tdr »

Dear all
Since this post has anybody managed to document a complete procedure on the possibilities of defining a specific workflow with new statuses for one specific project under mantis?
Best Regards
tdr
legatek
Posts: 3
Joined: 12 Nov 2010, 18:29

Re: How to customise Status per Project

Post by legatek »

tdr wrote:Dear all
Since this post has anybody managed to document a complete procedure on the possibilities of defining a specific workflow with new statuses for one specific project under mantis?
Best Regards
tdr
I did so recently for a project I'm working on. We're switching from an old task tracker, and one of the requirements is that it needs to support both a customer support issue workflow and a bug tracking workflow.

Customer suppport:
New -> In Progress -> Closed

Bug tracking workflow (happy path): New -> Reviewed -> Assigned -> In Progress -> Resolved -> Pushed to QA -> Verified QA -> Closed

For a happy upgrade path, I did everything I try to do everything in custom php files instead of tweaking the base installation itself. My inspiration stems mostly from this part of the Mantis manual: http://manual.mantisbt.org/manual.custo ... values.php

custom_constant_inc.php (created this file). Defines the enumerations for states I needed that aren't included in Mantis by default.

Code: Select all

/* Customized workflow states */
define ( 'OPEN', 15 );
define ( 'REVIEWED', 21);
define ( 'FAILED QA', 45);
define ( 'IN PROGRESS', 60);
define ( 'PUSHED TO QA', 85);
define ( 'VERIFIED QA', 86);
custom_strings_inc.php (created this file). Re-defines the s_status_enum string. I think this is used for the workflow statuses. Also used for setting the status change screen title/button text/email notification text.

Code: Select all

$s_status_enum_string = '10:new,15:open,21:reviewed,45:failed QA,50:assigned,60:in progress,80:resolved,85:pushed to qa,86:verified qa,90:closed';

/* Strings for state changes */
$s_open_bug_title = "Mark Issue as 'Open'";
$s_open_bug_button = "Mark Issue as Open";     
$s_email_notification_title_for_status_bug_open = "The following issue has been set to OPEN";

$s_reviewed_bug_title = "Mark Bug as 'Reviewed'";
$s_reviewed_bug_button = "I have reviewed this bug, and it's ready to be assigned";     
$s_email_notification_title_for_status_bug_reviewed = "The following bug has been set to REVIEWED";

$s_in_progress_bug_title = "Mark Bug/Issue as 'In Progress'";
$s_in_progress_bug_button = "I'm working on a fix";     
$s_email_notification_title_for_status_bug_in_progress = "The following bug/issue has been set to IN PROGRESS";

$s_pushed_to_qa_bug_title = "Mark Bug as 'Pushed to QA'";
$s_pushed_to_qa_bug_button = "Push this bug to QA";     
$s_email_notification_title_for_status_bug_pushed_to_qa = "The following bug has been set to PUSHED TO QA";

$s_failed_QA_bug_title = "Mark Bug as 'Failed QA'";
$s_failed_QA_bug_button = "Fail this bug";     
$s_email_notification_title_for_status_bug_failed_qa = "The following bug has been set to FAILED QA";

$s_verified_qa_bug_title = "Mark Bug as 'Verified QA'";
$s_verified_qa_bug_button = "This bug passes QA";     
$s_email_notification_title_for_status_bug_verified_qa = "The following bug has been set to VERIFIED QA";
config_inc.php. Added status colors for the new statuses, and updated the g_status_enum_string.

Code: Select all

  $g_status_enum_string = '10:new,15:open,21:reviewed,45:failed QA,50:assigned,60:in progress,80:resolved,85:pushed to qa,86:verified qa,90:closed';
  
  /* Status color additions */
  $g_status_colors['open'] = '#fcbdbd';
  $g_status_colors['reviewed'] = '#ffff66';
  $g_status_colors['failed QA'] = '#FC0000';
  $g_status_colors['in progress'] = '#82bfff';
  $g_status_colors['pushed to qa'] = '#90ff90';
  $g_status_colors['verified qa'] = '#60ff40';
It's true that these workflow states are global, so the workflow transitions need to be set accordingly. Mantis will warn you when you can't put an issue in or out of a particular status, and that gives you a clue that you've set the workflow properly. Also, if you want to start a status in anything other than new, make sure to the 'Status to which a new issue is set' in the Workflow threshold screen to your initial state for that project.

For sanity, I used GraphViz to diagram my workflow states. This was particularly helpful for showing pictures to management of the flow, while giving me simple workflow transitions. Here are the contents of my GraphViz files for code defects and customer support issues.

Code defects:

Code: Select all

digraph G {

/* Nodes */
null [shape = plaintext label="New code change"]
New [shape=ellipse];
Reviewed [shape=ellipse];
Assigned [shape=ellipse];
InProgress [shape=ellipse];
Resolved [shape=ellipse];
PushedToQA [shape=ellipse];
VerifiedQA [shape=ellipse];
Closed [shape=ellipse];
FailedQA [shape=ellipse];

/* Edges */
null -> New

New -> Reviewed
New -> Assigned

Reviewed -> Assigned
Reviewed -> InProgress

Assigned -> InProgress
Assigned -> Resolved

InProgress -> Resolved
InProgress -> Assigned

Resolved -> PushedToQA
Resolved -> InProgress

PushedToQA -> VerifiedQA
PushedToQA -> FailedQA

FailedQA -> Assigned

VerifiedQA -> Closed

Closed -> InProgress
}
And for customer support workflows:

Code: Select all

digraph G {
rankdir=LR;

/* Nodes */
null [shape = plaintext label="New issue"]
Open [shape=ellipse];
InProgress [shape=ellipse];
Closed [shape=ellipse];

/* Edges */
null -> Open

Open -> InProgress
Open -> Closed

InProgress -> Open
InProgress -> Closed

Closed -> InProgress
}
Cheers,
Rob
tdr
Posts: 2
Joined: 29 Oct 2010, 07:34

Re: How to customise Status per Project

Post by tdr »

Hi Rob and thanks for this detailed explanation.

Indeed this confirms what I imagined : Once we have created all required statuses, we need to define specific workflows per project by modifying the workflow configuration value

This is a bit annoying for us because only one project needs the couple of missing statuses which means that for each new project created in mantis we need to redefine its workflow so that the unneeded statuses do not appear.

Ah well, better than nothing!

Thanks again

tdr
jhoannalasuas
Posts: 1
Joined: 17 Feb 2011, 00:04

Re: How to customise Status per Project

Post by jhoannalasuas »

Hi,

I'm a newbie.. And quite confused... Is there any video uploaded for the customization process? :)
Post Reply