31 | | There are some significant "warts" in this; such as accepting a ticket sets it to 'assigned' state, and assigning a ticket sets it to 'new' state. Perfectly obvious, right? |
32 | | So you will probably want to migrate to "basic" workflow; [trac:source:trunk/contrib/workflow/migrate_original_to_basic.py contrib/workflow/migrate_original_to_basic.py] may be helpful. |
33 | | |
34 | | === Environments created with 0.11 === |
35 | | When a new environment is created, a default workflow is configured in your trac.ini. This workflow is the basic workflow (described in `basic-workflow.ini`), which is somewhat different from the workflow of the 0.10 releases. |
36 | | |
37 | | Graphically, it looks like this: |
| 32 | There are some significant caveats in this, such as accepting a ticket sets it to 'assigned' state, and assigning a ticket sets it to 'new' state. So you will probably want to migrate to "basic" workflow, see contrib/workflow/migrate_original_to_basic.py. |
| 33 | |
| 34 | === Environments created with 0.11 |
| 35 | |
| 36 | When a new environment is created, a default workflow is configured in your trac.ini. This workflow is the basic workflow, such as specified in `basic-workflow.ini`, which is somewhat different from the workflow of the 0.10 releases: |
95 | | '''Note:''' Specifying conflicting operations (such as `set_owner` and `del_owner`) has unspecified results. |
96 | | |
97 | | In this example, we see the `.name` attribute used. The action here is `resolve_accepted`, but it will be presented to the user as `resolve`. |
| 96 | - **reset_workflow** -- Resets the status of tickets that are in states no longer defined. |
| 97 | '''Note:''' Specifying conflicting operations, such as `set_owner` and `del_owner`, has unspecified results. |
| 98 | |
| 99 | In this example, we see the `.name` attribute used. The action here is `resolve_accepted`, but it will be presented to the user as `resolve`: |
106 | | For actions that should be available in all states, `*` may be used in place of the state. The obvious example is the `leave` action: |
107 | | {{{#!ini |
108 | | leave = * -> * |
109 | | leave.operations = leave_status |
110 | | leave.default = 1 |
111 | | }}} |
112 | | This also shows the use of the `.default` attribute. This value is expected to be an integer, and the order in which the actions are displayed is determined by this value. The action with the highest `.default` value is listed first, and is selected by default. The rest of the actions are listed in order of decreasing `.default` values. |
113 | | If not specified for an action, `.default` is 0. The value may be negative. |
114 | | |
115 | | There are a couple of hard-coded constraints to the workflow. In particular, tickets are created with status `new`, and tickets are expected to have a `closed` state. Further, the default reports/queries treat any state other than `closed` as an open state. |
| 108 | For actions that should be available in all states, `*` may be used in place of the state. The obvious example is the `leave` action: |
| 109 | {{{#!ini |
| 110 | leave = * -> * |
| 111 | leave.operations = leave_status |
| 112 | leave.default = 1 |
| 113 | }}} |
| 114 | |
| 115 | This also shows the use of the `.default` attribute. This value is expected to be an integer, and the order in which the actions are displayed is determined by this value. The action with the highest `.default` value is listed first, and is selected by default. The rest of the actions are listed in order of decreasing `.default` values. |
| 116 | If not specified for an action, `.default` is 0. The value may be negative. |
| 117 | |
| 118 | There are a couple of hard-coded constraints to the workflow. In particular, tickets are created with status `new`, and tickets are expected to have a `closed` state. Further, the default reports/queries treat any state other than `closed` as an open state. |
| 119 | |
| 120 | The special `_reset` action is added by default for tickets that are in states that are no longer defined. This allows tickets to be individually "repaired" after the workflow is changed, although it's recommended that the administrator perform the action by batch modifying the affected tickets. By default the `_reset` action is available to users with the `TICKET_ADMIN` permission and reset tickets are put in the //new// state. The default `_reset` action is equivalent to the following `[ticket-workflow]` action definition: |
| 121 | |
| 122 | {{{#!ini |
| 123 | _reset = -> new |
| 124 | _reset.name = reset |
| 125 | _reset.operations = reset_workflow |
| 126 | _reset.permissions = TICKET_ADMIN |
| 127 | _reset.default = 0 |
| 128 | }}} |
| 129 | |
| 130 | Since [trac:milestone:1.0.3] the `_reset` action can be customized by redefining the implicit action. For example, to allow anyone with `TICKET_MODIFY` to perform the `_reset` action, the workflow action would need to be defined: |
| 131 | |
| 132 | {{{#!ini |
| 133 | _reset = -> new |
| 134 | _reset.name = reset |
| 135 | _reset.operations = reset_workflow |
| 136 | _reset.permissions = TICKET_MODIFY |
| 137 | _reset.default = 0 |
| 138 | }}} |
| 139 | |
| 140 | == Workflow Visualization |
124 | | And then open up the resulting `trac.pdf` file created by the script (it will be in the same directory as the `trac.ini` file). |
125 | | |
126 | | After you have changed a workflow, you need to restart apache for the changes to take effect. This is important, because the changes will still show up when you run your script, but all the old workflow steps will still be there until the server is restarted. |
127 | | |
128 | | == Example: Adding optional Testing with Workflow == |
129 | | |
130 | | By adding the following to your [ticket-workflow] section of trac.ini you get optional testing. When the ticket is in new, accepted or needs_work status you can choose to submit it for testing. When it's in the testing status the user gets the option to reject it and send it back to needs_work, or pass the testing and send it along to closed. If they accept it then it gets automatically marked as closed and the resolution is set to fixed. Since all the old work flow remains, a ticket can skip this entire section. |
| 150 | And then open up the resulting `trac.pdf` file created by the script. It will be in the same directory as the `trac.ini` file. |
| 151 | |
| 152 | After you have changed a workflow, you need to restart your webserver for the changes to take effect. |
| 153 | |
| 154 | == Example: Adding optional Testing with Workflow |
| 155 | |
| 156 | By adding the following to your [ticket-workflow] section of trac.ini you get optional testing. When the ticket has status `new`, `accepted` or `needs_work`, you can choose to submit it for testing. When it's in the testing status the user gets the option to reject it and send it back to `needs_work`, or pass the testing and send it along to `closed`. If they accept it, then it is automatically marked as `closed` and the resolution is set to `fixed`. Since all the old work flow remains, a ticket can skip this entire section. |
229 | | == Advanced Ticket Workflow Customization == |
230 | | |
231 | | If the customization above is not extensive enough for your needs, you can extend the workflow using plugins. These plugins can provide additional operations for the workflow (like code_review), or implement side-effects for an action (such as triggering a build) that may not be merely simple state changes. Look at [trac:source:trunk/sample-plugins/workflow sample-plugins/workflow] for a few simple examples to get started. |
| 255 | == Advanced Ticket Workflow Customization |
| 256 | |
| 257 | If the customizations above do not meet your needs, you can extend the workflow with plugins. Plugins can provide additional operations for the workflow, like code_review, or implement side-effects for an action, such as triggering a build, that may not be merely simple state changes. Look at [trac:source:trunk/sample-plugins/workflow sample-plugins/workflow] for a few examples to get started. |
235 | | == Adding Workflow States to Milestone Progress Bars == |
236 | | |
237 | | If you add additional states to your workflow, you may want to customize your milestone progress bars as well. See [TracIni#milestone-groups-section TracIni]. |
238 | | |
239 | | == Ideas for next steps == |
240 | | |
241 | | New enhancement ideas for the workflow system should be filed as enhancement tickets against the `ticket system` component. You can also document ideas on the [trac:TracIdeas/TracWorkflow TracIdeas/TracWorkflow] page. Also look at the [http://trac-hacks.org/wiki/AdvancedTicketWorkflowPlugin AdvancedTicketWorkflowPlugin] as it provides experimental operations. |
| 261 | == Adding Workflow States to Milestone Progress Bars |
| 262 | |
| 263 | If you add additional states to your workflow, you may want to customize your milestone progress bars as well. See [TracIni#milestone-groups-section TracIni]. |
| 264 | |
| 265 | == Ideas for next steps |
| 266 | |
| 267 | New enhancement ideas for the workflow system should be filed as enhancement tickets against the `ticket system` component. You can also document ideas on the [trac:TracIdeas/TracWorkflow TracIdeas/TracWorkflow] page. Also look at the [http://trac-hacks.org/wiki/AdvancedTicketWorkflowPlugin AdvancedTicketWorkflowPlugin] as it provides experimental operations. |
| 268 | |
| 269 | Some of the ideas described here are originally proposed in [trac:NewWorkflow]. |