SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Oct 2006
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How can I prevent defect edits in the grid view?

    In QC Defects, some people are inadvertantly changing values in the grid view.
    Is there a way to turn off grid view editing?

  2. #2
    Senior Member
    Join Date
    Jul 2008
    Posts
    160
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can I prevent defect edits in the grid view?

    Hi Steve,

    One way of doing this could be as follows:

    1. In Defects_ActionCanExecute put a line of code saying msgbox ActionName
    2. Double click on a defect and note the action name. It should be act_bug_details (or something similare).
    3. Now you can do the following coing:
    Define some public variables

    Function Defects_ActionCanExecute(ActionName)
    On Error Resume Next
    if ActionName="Act_bug_details" then
    executed=1
    else
    executed=0
    End if
    On Error GoTO 0
    End Function

    Function Defects_Bug_FieldCanChange(FieldName, NewValue)
    On Error Resume Next
    OldStatus=Bug_Fields.Field("BG_STATUS").Value
    On Error GoTo 0
    End Function

    Sub Defects_Bug_FieldChange(FieldName)
    On Error Resume Next
    if FieldName="BG_Status" then
    if executed=0 then
    msgbox "You are not permitted to change the status here"
    Bug_Fields.Field("BG_STATUS").Value=OldSatatus
    Defects_Bug_FieldChange(FieldName)=false
    else
    Defects_Bug_FieldChange(FieldName)=true
    end if
    end if
    On Error GoTo 0
    End Sub

    Please note the end part when executed is 0 then defects_fieldchange should be false. Towards the end if you make it true, the code will be meaningless.

    Let me know if you have questions.

    Regards,
    Richa.

  3. #3
    Junior Member
    Join Date
    Oct 2006
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can I prevent defect edits in the grid view?

    Richa,

    Thanks for your ideas.

    I was looking more for a way to make the entire grid Read-only?

    Regards,
    Steve

  4. #4
    Junior Member
    Join Date
    Oct 2006
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can I prevent defect edits in the grid view?

    Using your code as a start, I was able to affect the whole grid with one exception.
    That small exception is, if a user executes a defect and then cancels it without changes, the value of executed = 1 so that defect can still be grid edited.
    I need to trap the cancel action to set executed = 0 but how?

    Any ideas appreciated.

    Regards,

    Steve

    Here are my changes;
    [Common]
    Dim OldValue
    executed = 0

    Function ActionCanExecute(ActionName)
    'Use ActiveModule and ActiveDialogName to get
    'the current context.
    On Error Resume Next
    If ActionName = "actBugDetails" then
    executed=1
    Else
    executed=0
    End If

    ActionCanExecute = DefaultRes
    On Error GoTo 0
    End Function

    [Defects]

    Function Defects_Bug_FieldCanChange(FieldName, NewValue)
    On Error Resume Next
    OldValue=Bug_Fields.Field(FieldName).Value 'save the value of the field being changed
    On Error GoTo 0
    End Function


    Sub Defects_Bug_FieldChange(FieldName)
    On Error Resume Next
    If executed = 0 then
    Bug_Fields.Field(FieldName).Value=OldValue
    Defects_Bug_FieldChange(FieldName)=False
    Else
    Defects_Bug_FieldChange(FieldName)=True
    End If
    On Error GoTo 0
    End Sub

    Sub Defects_Bug_New
    On Error Resume Next
    executed = 1 'need to allow editing new bugs
    On Error GoTo 0
    End Sub

  5. #5
    Senior Member
    Join Date
    Jul 2008
    Posts
    160
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can I prevent defect edits in the grid view?

    Hi Steve,

    I am not sure if this will work, but I am quite hopeful, this will be of some help [img]/images/graemlins/smile.gif[/img]

    Go to Setup Workflow -> Script Editor

    Here add a new function

    Function Defects_Bug_ActionExecuted(ActionName)
    On Error Resume Next
    If ActionName = "actBugDetails" then
    executed=0
    else
    executed=1
    End If
    On Error GoTo 0
    End Function

    Basically, once that bug detail window is closed (either by clicking on Ok or Cancel), the executed value is set to 0.

    Please try this and let me know how it works [img]/images/graemlins/smile.gif[/img] I shall be looking forward to a feedback [img]/images/graemlins/smile.gif[/img]

    Regards,
    Richa

  6. #6
    Junior Member
    Join Date
    Oct 2006
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can I prevent defect edits in the grid view?

    Richa,

    I added this function but no msgbox ever appears?

    Function Defects_Bug_ActionExecuted(ActionName)
    On Error Resume Next
    msgbox ActionName
    On Error GoTo 0
    End Function

    Regards,

    Steve

  7. #7
    Senior Member
    Join Date
    Jul 2008
    Posts
    160
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can I prevent defect edits in the grid view?

    Hi Steve,

    Just modify the msgbox to msgbox"Test". See if you get the message displayed. I think ActionName will not appear in the message box.

    Regards,
    Richa

  8. #8
    Junior Member
    Join Date
    Oct 2006
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can I prevent defect edits in the grid view?

    Hi Richa,

    Still no msgbox appears.
    It's working for the most part. The only anomaly now is that th euser can grid edit one defect right after returning to the grid view.

    We'll live with that.

    Thanks,

    Steve

  9. #9
    Senior Member
    Join Date
    Jul 2008
    Posts
    160
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can I prevent defect edits in the grid view?

    Hi Steve,

    Sorry completely my mistake and a very small and silly one [img]/images/graemlins/smile.gif[/img]

    Function Defects_ActionExecuted(ActionName)
    On Error Resume Next
    If ActionName = "actBugDetails" then
    executed=0
    else
    executed=1
    End If
    On Error GoTo 0
    End Function

    This will work. Sorry I gave you an incorrect name for the function. Please try this and let me know ifthis works.

    Regards,
    Richa

  10. #10
    Junior Member
    Join Date
    Oct 2006
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can I prevent defect edits in the grid view?

    YES!

    That did it thanks.

    Here are all the changes required to make editing in the grid disabled.

    Steve

    [Common Script]

    Dim OldValue
    executed = 0

    Function ActionCanExecute(ActionName)
    'Use ActiveModule and ActiveDialogName to get
    'the current context.
    On Error Resume Next

    'need to also check if we are creating a new defect or
    'scrolling through defect details using next or previous defect buttons
    If ActionName = "actBugDetails" OR "actPrevDefect" OR "actNextDefect" OR "BugAddAction1" then
    executed=1 'we are not in grid
    Else
    executed=0
    End If

    ActionCanExecute = DefaultRes
    On Error GoTo 0
    End Function


    [Defects module script]

    Function Defects_ActionExecuted(ActionName)
    On Error Resume Next
    If ActionName = "actBugDetails" then
    executed=0 'The OK or Cancel button was pressed so we are back to the grid
    else
    executed=1
    End If
    On Error GoTo 0
    End Function

    Sub Defects_Bug_FieldChange(FieldName)
    On Error Resume Next
    If executed = 0 then
    Bug_Fields.Field(FieldName).Value=OldValue 'revert back to the old value in the grid
    Defects_Bug_FieldChange(FieldName)=False
    Else
    Defects_Bug_FieldChange(FieldName)=True
    End If

    On Error GoTo 0
    End Sub

    Function Defects_Bug_FieldCanChange(FieldName, NewValue)
    On Error Resume Next
    OldValue=Bug_Fields.Field(FieldName).Value 'save the old value to be able to revert back
    Defects_Bug_FieldCanChange = Project_DefaultRes
    On Error GoTo 0
    End Function

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:30 AM.

Copyright BetaSoft Inc.