Control ticket submission policy based on field information

= control ticket submission policy based on field information =
== Description ==
The TicketSubmitPolicyPlugin allows control of ticket submission based on fields and their values.  Actions are configurable via an extension point, ITicketSubmitPolicy.  Javascript is used to enforce the policy without leaving the page.
Each policy has a condition, which controls when the policy is
applied, and actions that are applied when the condition is met.
The condition is in the form of "field" "comparitor" "field value".
The field is a field of the ticket (e.g. 'type'),
the field value is its value (e.g. 'defect'),
the comparitor is some
rule that is applied to the field and its value (e.g. 'is not').
The following comparitors have been implemented:
 * is
 * is not
 * is in : the field is one of a list
 * is not in
This should probably become an extension point so that these are
easily pluggable.
''"is in" and 'is not in' have NOT been tested are PROBABLY CONTAIN
BUGS!  only use these if you want to test them or can contribute
debugging data regarding them''
Policy actions are an ExtensionPoint of components fulfilling the
ITicketSubmitPolicy interface.  Bundled with the
TicketSubmitPolicyPlugin are two such actions:
* requires : require fields before allowing form submission
* excludes : exclude fields from form display and submission
Each of these, and currently actions in general, take multiple
arguments in the form of ticket fields.
== Example ==
The following section in trac.ini excludes the version field excludes the version field if the type is not a defect and requires a version that is not blank if the type is a defect:
policy1.condition = type is not defect
policy1.excludes = version
policy2.condition = type is defect
policy2.requires = version
{{{&&}}}s may be used to join multiple conditions together, and
multiple arguments may be supplied to requires and excludes as well:
policy1.condition = type is defect && component is not component2
policy1.requires = version, milestone
policy2.condition = type is not defect
policy2.excludes = version, priority

The webadmin interface, available at /admin/ticket/submit, may also be used to configure the plugin:

the webamin interface for the TicketSubmitPolicyPlugin

Bugs/Feature Requests

Existing bugs and feature requests for TicketSubmitPolicyPlugin are here.

If you have any issues, create a new ticket.


11 / 19


3 / 7


1 / 1


Download the zipped source from here.


You can check out TicketSubmitPolicyPlugin from here using Subversion, or browse the source with Trac.


This plugin requires Python version 2.4 or greater. General instructions on installing Trac plugins can be found on the TracPlugins page.

Recent Changes

12712 by rjollos on 2013-03-13 00:00:58
Code formatting changes.
12711 by rjollos on 2013-03-12 23:51:39
Refs #10898: onsubmit event was not firing. This appeared to be due to the callback function having the same name as the event.

The dialog now appears, but does not block form submission.

12710 by rjollos on 2013-03-12 23:11:56
Modified entry point and limited imports.


Originally developed at The Open Planning Project

Author: k0s
Maintainer: none (needsadoption)

Last modified 16 months ago Last modified on Nov 9, 2015, 1:55:25 PM

Attachments (1)

Download all attachments as: .zip