ALL_PROJECTS)
$f_query = "SELECT f.id, f.name, f.possible_values
FROM $t_mantis_custom_field_table AS f
INNER JOIN $t_mantis_custom_field_project_table AS p
ON f.id = p.field_id
WHERE p.project_id = $t_project_id
ORDER BY f.name";
else
$f_query = "SELECT id, name, possible_values
FROM $t_mantis_custom_field_table
ORDER BY name";
$f_result = db_query($f_query);
// -------------------------------------------------------------------------------------------
// ii) For each custom field, display a table giving summary details for that field.
// Achieved using following while loop.
// -------------------------------------------------------------------------------------------
while($f_row = db_fetch_array($f_result))
{
?>
" . $f_row['name']; ?>
|
ALL_PROJECTS)
{
$b_query_header .= " " . "WHERE b.project_id = $t_project_id";
$b_query_header .= " " . "AND s.field_id =" . " " . $f_row['id'];
}
else
$b_query_header .= " " . "WHERE s.field_id =" . " " . $f_row['id'];
// -----------------------------------------------------------------------------------------
// All possible values of the custom field will be held in an array, $possible_values.
// $f_row['possible_values'] contains these values as a string with the values divided by
// '|', e.g.:
// | Enhancement request | User Requirements error | Functional specification error |
//
// Use explode() to turn this into an array.
//
//
// NOTE: Do not trim any leading or trailing blank spaces from $possible_value. This is
// because when we do:
// $b_query .= " " . "AND s.value LIKE \"%|" . $possible_value . "|%\"";
//
// we want to match $possible_value exactly, including blank spaces.
//
// E.g. if we had a custom field with possible values:
// | x | xx | xxx |
//
// then if we pattern matched '%x%' rather than '%| x |%' then confusion could
// result!
// -----------------------------------------------------------------------------------------
$possible_values = explode('|', $f_row['possible_values']);
foreach ($possible_values as $possible_value)
{
// Initialise
$label = string_display_line( $possible_value );
$t_bugs_open = 0;
$t_bugs_resolved = 0;
$t_bugs_closed = 0;
$t_bugs_total = 0;
// See comments below.
$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
$t_closed_val = config_get( 'bug_closed_status_threshold' );
$b_query = $b_query_header; // See above for value of $b_query_header
$b_query .= " " . "AND s.value LIKE \"%|" . $possible_value . "|%\"";
$b_result = db_query($b_query);
// -----------------------------------------------------------------------------------------
// iii) For each table count the number of open, resolved or closed bugs associated with
// this $possible_value.
//
// Determine if a job is open, resolved or closed using $t_resolved_val and $t_closed_val
// to determine what range of values the bug status lies within.
// E.g. if status < $t_resolved_val then bug is open. See config_defaults_inc.php for
// further details.
// -----------------------------------------------------------------------------------------
while( $b_row = db_fetch_array( $b_result ) )
{
$t_bugs_total++;
if ($b_row['status'] < $t_resolved_val)
$t_bugs_open++;
elseif (($b_row['status'] >= $t_resolved_val) AND ($b_row['status'] < $t_closed_val))
$t_bugs_resolved++;
else
$t_bugs_closed++;
}
summary_helper_print_row($label, $t_bugs_open, $t_bugs_resolved, $t_bugs_closed, $t_bugs_total );
}
?>