Edgewall Software
Modify

Ticket #2463 (new enhancement)

Opened 6 years ago

Last modified 12 months ago

Mandatory fields in tickets

Reported by: johan.regnell@… Owned by: rblank
Priority: high Milestone: next-major-0.1X
Component: ticket system Version: 0.9.2
Severity: normal Keywords:
Cc: kantrn@…, mark.mcmahon@…, kirean@…, leho@…, trac@…
Release Notes:
API 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

preliminary_required_fields_change.patch (2.3 KB) - added by Mark Mc Mahon <mark.mcmahon@…> 17 months 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@…> 17 months ago.
Add

Download all attachments as: .zip

Change History

comment:1 Changed 5 years ago by anonymous

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 Changed 5 years ago by Noah Kantrowitz (coderanger) <coderanger@…>

  • Cc kantrn@… added

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

comment:3 Changed 5 years ago by cboos

  • Milestone set to 1.0

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

See also the antonym ticket #2464

comment:4 Changed 4 years ago by osimons

  • Milestone changed from 1.0 to 0.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 Changed 3 years ago by rblank

Closed #5567 as a duplicate.

comment:6 Changed 3 years ago by rblank

#8464 was closed as a duplicate.

comment:7 Changed 22 months ago by anonymous

What's happening with this ticket

comment:8 Changed 22 months ago by velappanv@…

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 Changed 17 months ago by Mark Mc Mahon <mark.mcmahon@…>

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?

Changed 17 months ago by Mark Mc Mahon <mark.mcmahon@…>

Very first attempt at implementing required ticket fields

comment:10 Changed 17 months ago by Mark Mc Mahon <mark.mcmahon@…>

  • Cc mark.mcmahon@… added

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

comment:11 Changed 17 months ago by rblank

  • Milestone changed from next-major-0.1X to 0.13
  • Owner changed from jonas to rblank
  • Priority changed from normal to high

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.

Changed 17 months ago by Mark Mc Mahon <mark.mcmahon@…>

Add

comment:12 Changed 17 months ago by Mark Mc Mahon <mark.mcmahon@…>

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 Changed 17 months ago by Erik Andersson <kirean@…>

  • Cc kirean@… added

comment:14 Changed 17 months ago by lkraav <leho@…>

  • Cc leho@… added

comment:15 Changed 17 months ago by Mark Mc Mahon <mark.m.mcmahon@…>

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 follow-up: Changed 16 months ago by 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.

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).

comment:17 in reply to: ↑ 16 Changed 16 months ago by trac@…

  • 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 Changed 16 months ago by rblank

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 Changed 12 months ago by rblank

  • Milestone changed from 0.13 to next-major-0.1X
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from rblank. Next status will be 'new'
The owner will be changed from rblank to anonymous. Next status will be 'assigned'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.