给禅道缺陷增加缺陷责任人字段
by:授客
禅道项目管理软件9.2.1 、8.0开源Linux版
ALTER TABLE `zt_bug` ADD COLUMN personLiable VARCHAR(50) AFTER resolvedBy;
如下图,新增图示选框Bug字段,即在合适的位置插入以下代码
$lang->bug->personLiable = '责任人';

注意:笔者使用的禅道,语言设置的是中文,所以仅修改zh-cn.php,不修改英文en.php和tw.php
如下图,在合适的位置插入以下代码
<tr>
<th><nobr><?php echo $lang->bug->personLiable;?></nobr></th>
<td>
<div class='input-group'>
<?php echo html::select('personLiable',
<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>


如下图,在合适的位置插入以下代码
js::set('personLiable' , $bug->personLiable);

如下图,在合适的位置插入以下代码
<tr>
<th><?php echo $lang->bug->personLiable;?></th>
<td><?php echo html::select('personLiable',
</tr>


如下图,在合适的位置插入以下代码
<tr>
<th><?php echo $lang->bug->personLiable;?></th>
<td>
<?php if($bug->personLiable):?>
<?php echo html::select('personLiable',
<?php endif;?>
<?php if(!$bug->personLiable):?>
<?php echo html::select('personLiable',
<?php endif;?>
</td>
</tr>

说明:如果解决Bug时,当前“责任人”为空,则当前责任人初始值设置为当前“指派给”

在合适位置插入以下代码
<tr>
<th><?php echo $lang->bug->personLiable;?></th>
<td><?php if(
</tr>


给config->bug->create->requiredFields 增加personLiable字段(创建Bug时,“指派给”,“责任人”必填)
config->bug->create->requiredFields = 'title,openedBuild,assignedTo;
修改
config->bug->edit->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'] =

在合适的位置增加以下代码(设置“责任人”搜索字段可选值,即责任人可选列表)
$config->bug->search['params']['personLiable'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');

修改public function export(productID, orderBy)函数代码,如下,在合适位置增加以下代码,解决导出报表,新增字段列的值不为设置的枚举选项值,而是为索引值问题。
if(isset(users[bug->personLiable])) bug->personLiable =
