Edgewall Software
Modify

Opened 19 years ago

Last modified 4 years ago

#2463 new enhancement

Mandatory fields in tickets

Reported by: johan.regnell@… Owned by:
Priority: high Milestone: next-major-releases
Component: ticket system Version: 0.9.2
Severity: normal Keywords:
Cc: kantrn@…, mark.mcmahon@…, kirean@…, leho@…, trac@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

It would be great with ability to set some ticket fields as mandatory. These fields should be verified before allowing submit when creating a new ticket.

Attachments (4)

preliminary_required_fields_change.patch (2.3 KB ) - added by Mark Mc Mahon <mark.mcmahon@…> 14 years ago.
Very first attempt at implementing required ticket fields
add_required_fields_inclde_new_ticket.patch (3.2 KB ) - added by Mark Mc Mahon <mark.mcmahon@…> 14 years ago.
Add
ticketvalidation_original.zip (10.8 KB ) - added by anonymous 4 years ago.
Plugin by Matt Booth that was downloaded eons ago.
ticketvalidation_new.zip (12.1 KB ) - added by anonymous 4 years ago.
Plugin by Matt Booth mentioned on this ticket, which was recently updated by me. I'm not an expert, but seems to work with Jinja on 1.4.2.

Download all attachments as: .zip

Change History (28)

comment:1 by anonymous, 18 years ago

Hi,

is anyone actively working on this?

If so, is there a guess, when this enhancement might be available, without defining a whole new Workflow?

TIA Max

comment:2 by Noah Kantrowitz (coderanger) <coderanger@…>, 18 years ago

Cc: kantrn@… added

This is indeed possible in 0.10. I will see about coding it up later this week.

comment:3 by Christian Boos, 18 years ago

Milestone: 1.0

Hey that week is over, where's the patch? :-)

See also the antonym ticket #2464

comment:4 by osimons, 17 years ago

Milestone: 1.00.12

#6248 closed as duplicate. It requests making standard and custom fields mandatory, or at least marking them visually in a special way (related to #899, #925, #1748).

Rescheduling according to #6248 value recently updated by cboos.

comment:5 by Remy Blank, 16 years ago

Closed #5567 as a duplicate.

comment:6 by Remy Blank, 15 years ago

#8464 was closed as a duplicate.

comment:7 by anonymous, 15 years ago

What's happening with this ticket

comment:8 by velappanv@…, 15 years ago

Hi All,

This would be great future if we implemented this? Did any have any idea to work on this please share with us so we iwe can work on the same and release it as soon as possible.

~vela

comment:9 by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

I tried to throw something together for this.

It currently is a very basic patch that works in the following way:

  • You define in the trac.ini file which fields are required for which workflow actions e.g.
      accept.required_fields = component,version
    
  • When validating the ticket on submission these fields are checked not to be empty.

Problems with this patch:

  • No tests
  • No documentation
  • No handling of required fields when creating a new ticket (my proposal here is to have a list of required fields in the [ticket] configuration section which would always be required (so new and every other state)

I would appreciate feedback as to whether this is the right approach before doing much more work on it. (for example - the code to retrieve the workflow actions in _validate_ticket() seem over complicated - maybe there is an easier way?

by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

Very first attempt at implementing required ticket fields

comment:10 by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

Cc: mark.mcmahon@… added

(adding comment so that "Add to Cc" is not flagged as spam.

comment:11 by Remy Blank, 14 years ago

Milestone: next-major-0.1X0.13
Owner: changed from Jonas Borgström to Remy Blank
Priority: normalhigh

Required fields dependent on the workflow? Interesting idea! There would indeed need to be an additional list for ticket creation, as that was the original request. Making that list apply to all workflow transitions makes sense to me.

by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

Add

comment:12 by Mark Mc Mahon <mark.mcmahon@…>, 14 years ago

This latest patch adds required fields when creating a ticket also.

I had a look at the Genshi template 'ticket.html' and when the required fields are passed in the data to the template it should be easy enough to add '*' or change the format to the required fields.

<span py:if="'description' in required_fields">* </span> 
    Description:</label></th>

Any input appreciated.

comment:13 by Erik Andersson <kirean@…>, 14 years ago

Cc: kirean@… added

comment:14 by lkraav <leho@…>, 14 years ago

Cc: leho@… added

comment:15 by Mark Mc Mahon <mark.m.mcmahon@…>, 14 years ago

In the meantime while this is being discussed there is already hack that implements this: http://www.matbooth.co.uk/trac/wiki/TicketValidationStart (author Matt Booth)

comment:16 by Remy Blank, 14 years ago

The TicketValidationStart plugin looks really nice. The idea of associating required fields with status transitions, while elegant and quite simple to implement, doesn't capture the real need. Indeed, a field is required not for a transition, but for the end status. If the check is only performed on transitions, it would be possible to clear a required field after the transition.

So I would rather go with an implementation specifying required fields based on (at least) the status. Arbitrary boolean expressions are a nice addition, but I wouldn't want to add a new dependency on pyparsing just for parsing boolean expressions. Such a simple parser could probably be implemented relatively easily "by hand", though.

We could even have multiple expressions per field, and associate a message to be displayed to the user if the expression is false. This could all be defined in the [ticket-custom] section in trac.ini, with message translations (see #9648).

in reply to:  16 comment:17 by trac@…, 14 years ago

Cc: trac@… added

Replying to rblank:

The TicketValidationStart plugin looks really nice. The idea of associating required fields with status transitions, while elegant and quite simple to implement, doesn't capture the real need. Indeed, a field is required not for a transition, but for the end status. If the check is only performed on transitions, it would be possible to clear a required field after the transition.

A state transition occurs only when the user chooses to change the state by using a work flow action. The rules in the TicketValidation are run every time you submit the ticket whether a state transition occurs or not. So, if you want a field to be mandatory when the "state == closed" then that field will be mandatory until the ticket is reopened.

So I would rather go with an implementation specifying required fields based on (at least) the status. Arbitrary boolean expressions are a nice addition, but I wouldn't want to add a new dependency on pyparsing just for parsing boolean expressions. Such a simple parser could probably be implemented relatively easily "by hand", though.

You are probably right, but we wanted to get a plug-in working as soon as possible, and using a library helped us with that.

comment:18 by Remy Blank, 14 years ago

Oh, my comment about pyparsing wasn't meant to be criticism of your plugin: if it works for you, great! It was meant to define a requirement if something similar should be included in Trac core.

comment:19 by Remy Blank, 14 years ago

Milestone: 0.13next-major-0.1X

comment:20 by Remy Blank, 13 years ago

Owner: Remy Blank removed

Refocusing.

by anonymous, 4 years ago

Plugin by Matt Booth that was downloaded eons ago.

by anonymous, 4 years ago

Attachment: ticketvalidation_new.zip added

Plugin by Matt Booth mentioned on this ticket, which was recently updated by me. I'm not an expert, but seems to work with Jinja on 1.4.2.

comment:21 by anonymous, 4 years ago

Sorry for the late addition, but I just attached the plugin mentioned in the comments section which was done by Matt Booth. I don't know if it is being maintained, but I just updated it to work with my new installation. I am attaching it here just in case it can be of help to someone. This page came up when I searched for the URL listed as the plugin's home page.

comment:22 by Ryan J Ollos, 4 years ago

Several plugins on trac-hacks provide the feature: https://trac-hacks.org/tags/validation?wiki=on.

comment:23 by anonymous, 4 years ago

Additionally … for hiding (which ticketvalidation also implements): https://trac-hacks.org/tags/hide?wiki=on

for example:

[ticket-validation]
nondefecthidden = ((type == enhancement) or (type == task))
nondefecthidden.enabled = True
nondefecthidden.hidden = root_cause
rootcauserequired = (type == defect) and ((status == reviewing) or (status == closed))
rootcauserequired.enabled = True
rootcauserequired.required = root_cause

comment:24 by anonymous, 4 years ago

While I no longer use Trac, I would happily merge PRs for this plugin over at github: https://github.com/trac-hacks/trac-ticketvalidation

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.