Mantis-如何导出自定义字段的值
2006-11-28 14:54
295 查看
西西的博客
Mantis-如何导出自定义字段的值
关键词: 自定义字段导出
大家在使用mantis提供的通用report报表的时候,有时候就会使用自定义字段的功能,使得表单的功能更符合实际,可是使用自定义字段,却有害怕在数据导出的时候会出现这些字段值得丢失,这让人感觉比较矛盾。没关系,以下篇章说明如何导出自定义字段的值,这会让你觉得使用起来会很简单。
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!!!
【作者: 西西】
你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=5562718
Mantis-如何导出自定义字段的值
关键词: 自定义字段导出
大家在使用mantis提供的通用report报表的时候,有时候就会使用自定义字段的功能,使得表单的功能更符合实际,可是使用自定义字段,却有害怕在数据导出的时候会出现这些字段值得丢失,这让人感觉比较矛盾。没关系,以下篇章说明如何导出自定义字段的值,这会让你觉得使用起来会很简单。
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!!!
【作者: 西西】
你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=5562718
相关文章推荐
- 如何导出自定义字段的值
- NO.166 禅道的自定义功能:导出字段和后台的自定义
- cocos2d-x-lua如何导出自定义类到lua脚本环境
- SD-如何在SAP标准IDOC中增加自定义字段传输
- [转]SharePoint 2007 如何创建自定义字段类型
- 帝国cms调用栏目自定义字段(栏目简介)如何操作
- Hive表中四种不同数据导出方式以及如何自定义导出列分隔符
- 如何在mantis中设置日期字段的默认值
- 如何导出存储过程和自定义函数?
- gridview 自定义按钮 如何取得当前行的得数据,或者关键字段的方法
- 如何删除dede中自定义的字段
- 如何用VS2010在SharePoint中创建自定义字段类型(以eWebEditor为例)
- DedeCMS likearticle 如何调用自定义字段?
- hibernate处理如何上传的大文件字段(用户自定义的字段)
- List<T>集合导出csv方法参考,通过增加自定义的属性控制输出的字段。
- FineReport中JS如何自定义按钮导出
- highcharts在导出时如何自定义图表的表头
- Liferay如何自定义字段设计不同用户的默认布局
- 如何在AndroidStudio中导出Jar包,并且自定义Exclude文件
- 如何解决数据库中的字符型字段值中包含'0A'时,导出的文件用EXECEL打开时行数变多或者将结果导入数据库出错