Priority field behavior customization

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
Asura
Posts: 8
Joined: 08 Jan 2019, 14:00

Priority field behavior customization

Post by Asura »

Hi,

I've noticed that Priority is sometimes updated automatically from the bug report depending on Severity & Reproductibility.
I wanted to know if there is a way to modify that behavior to fit a custom algorithm ?
I've searched a bit about that and found nothing about a such function in the code so i'm asking here.
MantisBT Version 2.8.0.209
PHP Version 7.0.24
MySQL Version 5.7.20
Running on Windows Server 2012 R2
Asura
Posts: 8
Joined: 08 Jan 2019, 14:00

Re: Priority field behavior customization

Post by Asura »

Nevermind,

I just found a solution, had to add something like this :

Code: Select all

//Priority field behavior customization
if ( $t_bug_data->severity == 50)
{
	if ( $t_bug_data->reproducibility == 100 ) { $t_bug_data->priority = 10; }
	if ( $t_bug_data->reproducibility == 90 ) { $t_bug_data->priority = 10; }
	if ( $t_bug_data->reproducibility == 70 ) { $t_bug_data->priority = 20; }
	if ( $t_bug_data->reproducibility == 50 ) { $t_bug_data->priority = 20; }
	if ( $t_bug_data->reproducibility == 30 ) { $t_bug_data->priority = 30; }
	if ( $t_bug_data->reproducibility == 10 ) { $t_bug_data->priority = 30; }
}
if ( $t_bug_data->severity == 60)
{
	if ( $t_bug_data->reproducibility == 100 ) { $t_bug_data->priority = 10; }
	if ( $t_bug_data->reproducibility == 90 ) { $t_bug_data->priority = 20; }
	if ( $t_bug_data->reproducibility == 70 ) { $t_bug_data->priority = 30; }
	if ( $t_bug_data->reproducibility == 50 ) { $t_bug_data->priority = 40; }
	if ( $t_bug_data->reproducibility == 30 ) { $t_bug_data->priority = 40; }
	if ( $t_bug_data->reproducibility == 10 ) { $t_bug_data->priority = 40; }
}
if ( $t_bug_data->severity == 80)
{
	if ( $t_bug_data->reproducibility == 100 ) { $t_bug_data->priority = 20; }
	if ( $t_bug_data->reproducibility == 90 ) { $t_bug_data->priority = 30; }
	if ( $t_bug_data->reproducibility == 70 ) { $t_bug_data->priority = 40; }
	if ( $t_bug_data->reproducibility == 50 ) { $t_bug_data->priority = 40; }
	if ( $t_bug_data->reproducibility == 30 ) { $t_bug_data->priority = 50; }
	if ( $t_bug_data->reproducibility == 10 ) { $t_bug_data->priority = 60; }
}
Just after all the gpc_get_int functions of all standard fields in bug_report.php, i bet it can be optimized but for my part i'm sticking with this as i'm not needed to have something safe for upgrades.
MantisBT Version 2.8.0.209
PHP Version 7.0.24
MySQL Version 5.7.20
Running on Windows Server 2012 R2
Post Reply