Page 1 of 1

Add custom field column to View Issues screen

Posted: 05 Oct 2006, 21:06
by obriend
I would like to add a column to the View Issues result table on view_all_bug_page.php. I already added the reporter data by modifying the function below. Can anyone tell me what needs to be in place of 'MY CUSTOM FIELD' in order to show the data from a custom enumeration field?


function custom_function_override_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
$t_columns = array();

if ( $p_columns_target == COLUMNS_TARGET_CSV_PAGE ) {
$t_columns[] = 'id'; // localized: 'id',
$t_columns[] = 'project_id'; // 'email_project'
$t_columns[] = 'reporter_id'; // 'reporter'
$t_columns[] = 'handler_id'; // 'assigned_to'
$t_columns[] = 'priority'; // 'priority'
$t_columns[] = 'severity'; // 'severity'
$t_columns[] = 'reproducibility'; // 'reproducibility'
$t_columns[] = 'version'; // 'version'
$t_columns[] = 'projection'; // 'projection'
$t_columns[] = 'category'; // 'category'
$t_columns[] = 'date_submitted'; // 'date_submitted'
$t_columns[] = 'eta'; // 'eta'
$t_columns[] = 'os'; // 'os'
$t_columns[] = 'os_build'; // 'os_version'
$t_columns[] = 'platform'; // 'platform'
$t_columns[] = 'view_state'; // 'view_status'
$t_columns[] = 'last_updated'; // 'last_update'
$t_columns[] = 'summary'; // 'summary'
$t_columns[] = 'status'; // 'status'
$t_columns[] = 'resolution'; // 'resolution'
$t_columns[] = 'fixed_in_version'; // 'fixed_in_version';

if ( OFF == config_get( 'enable_relationship' ) ) {
$t_columns[] = 'duplicate_id'; // 'duplicate_id'
}
} else {
$t_columns[] = 'selection';

if ( $p_columns_target == COLUMNS_TARGET_VIEW_PAGE ) {
$t_columns[] = 'edit';
}

$t_columns[] = 'priority';
$t_columns[] = 'id';

$t_enable_sponsorship = config_get( 'enable_sponsorship' );
if ( ON == $t_enable_sponsorship ) {
$t_columns[] = 'sponsorship_total';
}

$t_columns[] = 'bugnotes_count';

$t_show_attachments = config_get( 'show_attachment_indicator' );
if ( ON == $t_show_attachments ) {
$t_columns[] = 'attachment';
}

$t_columns[] = 'category';
$t_columns[] = 'severity';
$t_columns[] = 'status';
$t_columns[] = 'last_updated';
$t_columns[] = 'summary';
#added reporter_id to table
$t_columns[] = 'reporter_id';
#want to add custom field column
#$t_columns[] = 'MY CUSTOM FIELD'; }

return $t_columns;
}

Posted: 05 Oct 2006, 23:58
by vboctor

Posted: 06 Oct 2006, 02:47
by obriend
Thanks for the help, that was perfect.

Posted: 20 Dec 2006, 09:54
by cemper
hum - that link is broken

Adding CUSTOM FIELDS to the View Issue screen

Posted: 20 Dec 2006, 09:58
by cemper
Hey, I think the initial problem is not yet addressed

I have a custom field "Batch_name"
and I want to add that field to the "View Issues Screen"

Specifying an array of column names works to modifiy the view issues for those standard names, but when I specify 'batch_name' in the list I just get a list of

@batch_name@
@batch_name@
@batch_name@
@batch_name@
@batch_name@

in the view issues screen

Posted: 20 Dec 2006, 10:03
by vboctor
Try using the same case (i.e. assume it's case sensitive).

FOUND IT!

Posted: 20 Dec 2006, 10:11
by cemper
no , that wasn't about the case

this page http://www.futureware.biz/blog/index.ph ... &tb=1&pb=1

gave me the idea to use the custom_ prefix

so I specified 'custom_batch_name' instead of 'batch_name'

ie
array (
0 => 'selection',
1 => 'edit',
2 => 'priority',
3 => 'id',
4 => 'sponsorship_total',
5 => 'bugnotes_count',
6 => 'attachment',
7 => 'category',
8 => 'severity',
9 => 'summary',
10 => 'status',
11 => 'custom_batch_name',
12 => 'last_updated',
)

Posted: 20 Dec 2006, 10:18
by vboctor
I updated the above link to the correct one. Sorry, I assumed you already had the custom_ prefix. Check the article in the wiki if you need more details. It should be more up-to-date than the blog.

Posted: 20 Dec 2006, 10:41
by cemper
thanks!