Add custom field column to View Issues screen

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
obriend
Posts: 6
Joined: 10 Nov 2005, 20:12

Add custom field column to View Issues screen

Post 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;
}
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Last edited by vboctor on 20 Dec 2006, 10:17, edited 1 time in total.
obriend
Posts: 6
Joined: 10 Nov 2005, 20:12

Post by obriend »

Thanks for the help, that was perfect.
cemper
Posts: 14
Joined: 19 Dec 2006, 17:09

Post by cemper »

hum - that link is broken
cemper
Posts: 14
Joined: 19 Dec 2006, 17:09

Adding CUSTOM FIELDS to the View Issue screen

Post 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
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Try using the same case (i.e. assume it's case sensitive).
cemper
Posts: 14
Joined: 19 Dec 2006, 17:09

FOUND IT!

Post 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',
)
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post 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.
cemper
Posts: 14
Joined: 19 Dec 2006, 17:09

Post by cemper »

thanks!
Post Reply