51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 8883|回复: 6
打印 上一主题 下一主题

[求助] mantis:如何导出自定义字段?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-8-17 15:29:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
请教高手,mantis,我在“报告问题”中添加的字段,如何导出EXCLE报表????
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2006-8-27 17:51:30 | 只看该作者
我也想知道?
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2006-8-27 17:52:26 | 只看该作者
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2008-5-27 16:47:10 | 只看该作者
如何导阿?
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2008-8-27 08:43:39 | 只看该作者
明如何导出自定义字段的值,这会让你觉得使用起来会很简单。
1.         首先当然是根据你的需要自定义字段。
在菜单[ 管理 ]à[ 自定义字段管理 ]
进入自定义字段管理页面,新增所需的新字段,可选择其字段类型,默认值以及一些条件等等,点击确认就OK。
2.         进入[ 管理 ]à[ 项目管理 ],将所需的自定义字段添加到该项目里。
3.         这时候需要进入正题了,默认情况下,自定义字段是不会被导出的,据说是在Mantis1.1版本会增加这样的修改。现在我们要做的就是:
打开Mantis目录下的Core目录里面的custom_function_api.php,找个合适的地方(可添至原来代码最后)将以下的代码添加到里面就OK了。
#
-----------------------------------------------------------------------------------------------
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 viewing only one Project, Add all custom fields linked to this project
if ( helper_get_current_project() != ALL_PROJECTS ) {
$t_custom_fields = custom_field_get_linked_ids(helper_get_current_project());

foreach( $t_custom_fields as $t_field_id ) {
$t_desc = custom_field_get_definition( $t_field_id );

$t_columns[] = 'custom_' . $t_desc['name'];
}
}


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';
}

$t_columns[] = 'bugnotes_count';

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

$t_columns[] = 'reporter_id';

$t_columns[] = 'category';
$t_columns[] = 'severity';
$t_columns[] = 'status';
$t_columns[] = 'last_updated';
$t_columns[] = 'summary';
}

return $t_columns;
}
4.         添加以上代码之后,保存就OK了。这时候,你可以来检验一下,提交一个包含自定义字段的报告,然后在issue view页面里,点击[
CSV导出 ]/[ CSV Export ] ,将导出的CSV文档保存到本地,然后打开看看,是不是自定义字段及其值就在里面呢,呵呵,All Done!!!


已经找到了,把配置项修改成gb2312,例如$g_default_language = 'chinese_simplified_gb2312';
在config_inc.php和config_default_inc.php都修改。
回复 支持 反对

使用道具 举报

该用户从未签到

6#
发表于 2008-8-29 15:03:13 | 只看该作者

回复 5# 的帖子

非常感谢,我正好要做这方面的东西。谢谢了,太谢谢了。
回复 支持 反对

使用道具 举报

该用户从未签到

7#
发表于 2012-7-13 16:15:01 | 只看该作者
回复 5# musicbeast


    朋友你好按照你的代码粘了,出现如图情况求解

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-9-20 14:49 , Processed in 0.071549 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表