禪道 給禪道缺陷增加缺陷責任人字段


給禪道缺陷增加缺陷責任人字段

by:授客 QQ1033553122

實踐環境

禪道項目管理軟件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];

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM