Hi all,
I am working with my client who is using QC 9.2 and we are having difficulties with users being able to edit/delete previous Defect comments. I can see that this has come up loads and i have the following code and found my way to the workflow script editor, but i am unsure exactly where to put this.. was wondering if anybody could advise?
Sub Defects_DialogBox(DialogBoxName, IsOpen)
'Use ActiveModule and ActiveDialogName to get
'the current context.
if DialogBoxName = "Details" then
if (Actions.Action("BugAddDevCommentsAction1").Visible = True) then
Actions.Action("BugAddDevCommentsAction1").Visible = False 'Hide "Add Comment" Button
end if
end if
On Error Resume Next
On Error GoTo 0
End Sub
Function Defects_ActionCanExecute(ActionName)
'Use ActiveModule and ActiveDialogName to get
'the current context.
if ActionName = "BugAddDevCommentsAction1" then
Defects_ActionCanExecute = false 'Do not allow the function for button "Add Comment"
end if
On Error Resume Next
On Error GoTo 0
End Function
Sub Defects_Bug_New
Bug_Fields.Field("BG_USER_25").IsVisible = false
Bug_Fields.Field("BG_USER_25").IsReadOnly = true
End Sub
Sub Defects_Bug_MoveTo
SetFieldBugVisReadRequire true 'set the requriement of the fields, paramerter is used for distinguishing of from
where it is called
End Sub
Sub Defects_Bug_FieldChange(FieldName)
if FieldName = "BG_STATUS" then
SetFieldBugVisReadRequire false 'set the requirement of the fields, parameter is used for distinguishing of from
where it is called
end if
End Sub
Sub SetFieldBugVisReadRequire(ParMoveTo)
Bug_Fields.Field("BG_USER_25").isVisible = true
Bug_Fields.Field("BG_User_25").IsReadOnly = true
Bug_Fields.Field("BG_DEV_COMMENTS").IsRequired = false
if Bug_Fields.Field("BG_STATUS").Value = "Fixed" then
if not parMoveTo then Bug_Fields.Field("BG_DEV_COMMENTS").IsRequired = true 'set the field Add comment mandatory
only when the user changes the status from xxx to Fixed
end if
End Sub
Function Defects_Bug_CanPost
AddCommentScript 'add comments script
End Function
sub AddCommentScript
dim hcuprava 'variable for the result of history comment
dim hchttp 'variable for comment html tags like <body>
dim newcomment 'variable for new comment taken from "BG_DEV_COMMENTS"
dim commenthistory 'variable for comment history "BG_DEV_COMMENTS" - the name of the add comment field that is used
for new comment, "BG_USER_25" - the name of the memo field that is used for Comment history
newcomment = Bug_Fields.Field("BG_DEV_COMMENTS").Value
commenthistory = Bug_Fields.Field("BG_USER_25").Value
if newcomment <> "" then
hchttp = left(newcomment,12) 'take first 12 chars from html comment "<html><body>"
if hchttp = "<html><body>" then
hcuprava = right(newcomment,len(newcomment)-12)
else
hcuprava = newcomment
end if
hcuprava = "<html><body>" & "<font color=""#000080""><b>" & fullname & " - " & username & " - " & now &
":</b></font><br>" & hcuprava
hchttp = right(hcuprava,14)
if hchttp = "</body></html>" then
hcuprava = left(hcuprava,len(hcuprava)-14)
end if
if commenthistory <> "" then hcuprava = hcuprava & "<br><font color=""#000080""><b>_________________</b></font><?br>"
hchttp = left(commenthistory,12)
if hchttp = "<html><body>" then
hcuprava = hcuprava & right(commenthistory,len(commenthistory)-12)
else
hcuprava = hcuprava & commenthistory
end if
if right(commenthistory,14) <> "</body></html>" then
hcuprava = hcuprava & "</body></html>"
end if
Bug_Fields.Field("BG_USER_25").IsReadOnly = false
Bug_Fields.Field("BG_USER_25").Value = hcuprava
Bug_Fields.Field("BG_USER_25").IsReadOnly = true
Bug_Fields.Field("BG_DEV_COMMENTS").Value = ""
end if
End Sub
Many thanks