禅道 给禅道缺陷增加缺陷责任人字段
给禅道缺陷增加缺陷责任人字段
by:授客 QQ:1033553122
实践环境
禅道项目管理软件9.2.1 、8.0开源Linux版
给数据库表zt_bug新增自定义字段
ALTER TABLE `zt_bug` ADD COLUMN personLiable VARCHAR(50) AFTER resolvedBy;
修改zentaopms/module/bug/lang/zh-cn.php
如下图,新增图示选框Bug字段,即在合适的位置插入以下代码
$lang->bug->personLiable = '责任人';
注意:笔者使用的禅道,语言设置的是中文,所以仅修改zh-cn.php,不修改英文en.php和tw.php
修改zentaopms/module/bug/view/create.html.php
如下图,在合适的位置插入以下代码
<tr>
<th><nobr><?php echo $lang->bug->personLiable;?></nobr></th>
<td>
<div class='input-group'>
<?php echo html::select('personLiable', $projectMembers, $personLiable, "class='from-control chosen'");?>
<span class='input-group-btn'><?php echo html::commonButton($lang->bug->allUsers, "class='btn btn-default' onclick='loadAllUsers()' data-toggle='tooltip'");?></span>
</div>
</td>
</tr>
修改效果
修改zentaopms/module/bug/view/edit.html.php
如下图,在合适的位置插入以下代码
js::set('personLiable' , $bug->personLiable);
如下图,在合适的位置插入以下代码
<tr>
<th><?php echo $lang->bug->personLiable;?></th>
<td><?php echo html::select('personLiable', $users, $bug->personLiable, "class='form-control chosen'");?></td>
</tr>
修改效果
修改zentaopms/module/bug/view/resolve.html.php
如下图,在合适的位置插入以下代码
<tr>
<th><?php echo $lang->bug->personLiable;?></th>
<td>
<?php if($bug->personLiable):?>
<?php echo html::select('personLiable', $users, $bug->personLiable, "class='form-control chosen'");?>
<?php endif;?>
<?php if(!$bug->personLiable):?>
<?php echo html::select('personLiable', $users, $bug->assignedTo, "class='form-control chosen'");?>
<?php endif;?>
</td>
</tr>
说明:如果解决Bug时,当前“责任人”为空,则当前责任人初始值设置为当前“指派给”
修改效果
修改zentaopms/module/bug/view/view.html.php
在合适位置插入以下代码
<tr>
<th><?php echo $lang->bug->personLiable;?></th>
<td><?php if($bug->personLiable) echo $users[$bug->personLiable];?></td>
</tr>
修改效果
修改zentaopms/module/bug/config.php
给config->bug->create->requiredFields 增加personLiable字段(创建Bug时,“指派给”,“责任人”必填)
config->bug->create->requiredFields = 'title,openedBuild,assignedTo;
修改
$config->bug->edit->requiredFields = $config->bug->create->requiredFields;
为
$config->bug->edit->requiredFields = 'title,openedBuild,assignedTo,personLiable';
说明:编辑页面相关字段的必填设置,按原始代码设置的话,同创建页面,但是创建Bug时,我并不想让责任人字段必填,所以做了如上更改。
为$config->bug->resolve->requiredFields增加personLiable字段(解决Bug时,“责任人”必填)
$config->bug->resolve->requiredFields = 'resolution,source,personLiable';
在合适的位置增加以下代码(增加“责任人”搜索字段)
$config->bug->search['fields']['personLiable'] = $lang->bug->personLiable;
在合适的位置增加以下代码(设置“责任人”搜索字段可选值,即责任人可选列表)
$config->bug->search['params']['personLiable'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
修改zentaopms/module/bug/control.php
修改public function export($productID, $orderBy)函数代码,如下,在合适位置增加以下代码,解决导出报表,新增字段列的值不为设置的枚举选项值,而是为索引值问题。
if(isset($users[$bug->personLiable])) $bug->personLiable = $users[$bug->personLiable];
作者:授客
微信/QQ:1033553122
全国软件测试QQ交流群:7156436
Git地址:https://gitee.com/ishouke
友情提示:限于时间仓促,文中可能存在错误,欢迎指正、评论!
作者五行缺钱,如果觉得文章对您有帮助,请扫描下边的二维码打赏作者,金额随意,您的支持将是我继续创作的源动力,打赏后如有任何疑问,请联系我!!!
微信打赏
支付宝打赏 全国软件测试交流QQ群
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库