查看完整版本: 在改变BUG的状态为Fixed的时候,如何要求强制添加注释信息

joshfang 2008-4-24 15:44

在改变BUG的状态为Fixed的时候,如何要求强制添加注释信息

注意:
1. 代码是在自定义->set up workflow中定义的,
2. 请找到相关的function进行修改。需要具备一定vb代码基础。
3. 不光是Fixed状态,大家可以灵活运用,根据自己的需要
4. 我本人已经试过没有问题.
最后,代码是一行一行整理的,大家要珍惜啊:lol


' variable global to defect module
dim CommentFieldFlag

Function Defects_Bug_CanPost  
On Error Resume Next
' checks for Status of "Fixed" and comments flag = true else allows the user post defect
    If Not Bug_Fields("BG_BUG_ID").IsNull AND Bug_Fields("BG_STATUS").Value = "Fixed" Then
        If CommentFieldFlag = True then
          Defects_Bug_CanPost = True
        Else           
          Defects_Bug_CanPost = False
          MsgBox "Please add a comment (using the Add Comments button) with information about the fix.",VbInformation  ,"No Comment Warning"      
        End If
     Else      
         Defects_Bug_CanPost = True  
     End If
'comment out or delete this next line if there by default
'Defects_Bug_CanPost = Project_DefaultRes
On Error GoTo 0
End Function


Sub Defects_Bug_AfterPost  
   On Error Resume Next
  ' resets the flag after each defect is posted
   CommentFieldFlag = False
   On Error GoTo 0
End Sub



Sub Defects_EnterModule  
    On Error Resume Next
  ' initialises flag   
   CommentFieldFlag = False
  On Error GoTo 0
End Sub



Sub Defects_Bug_FieldChange(FieldName)  
On Error Resume Next
' sets flag for comments when comments updated
   If FieldName = "BG_DEV_COMMENTS" then
          CommentFieldFlag = True
   End If
  On Error GoTo 0
End Sub

[[i] 本帖最后由 joshfang 于 2008-4-25 13:20 编辑 [/i]]

kakamissyou 2008-4-25 20:55

好,高手!

好,高手!

呵呵,路径挺全的!

偶不会VB。不过看懂了。谢谢楼主!

[[i] 本帖最后由 kakamissyou 于 2008-5-5 15:24 编辑 [/i]]
页: [1]
查看完整版本: 在改变BUG的状态为Fixed的时候,如何要求强制添加注释信息