39 | | For using it you should have in the trac.ini file the [ticket-workflow] session because when a section for a ticket type doesn't exist trac uses the [ticket-workflow] for the actions to do. |
40 | | If you want to define different workflows than you should create in trac.ini sections called [ticket-workflow-ticket_type] where ticket_type is the type of ticket you want to use this section,you can create all the sections you want and trac will use them when that kind of ticket is being used,you can create ticket type in the admin pannel under ticket types. |
| 41 | == Example == |
| 42 | For using it you should have the {{{[ticket-workflow]}}} section in your ''trac.ini'' file because when a custom section for a ticket type doesn't exist that one is used. |
| 43 | |
| 44 | To define a different workflow for a ticket with type {{{Requirement}}} create a section in ''trac.ini'' called {{{[ticket-workflow-Requirement]}}} and add your workflow items: |
| 45 | |
| 46 | {{{ |
| 47 | [ticket-workflow-Requirement] |
| 48 | leave = * -> * |
| 49 | leave.default = 1 |
| 50 | leave.operations = leave_status |
| 51 | |
| 52 | approve = new, reopened -> approved |
| 53 | approve.operations = del_resolution |
| 54 | approve.permissions = TICKET_MODIFY |
| 55 | |
| 56 | reopen_verified = closed -> reopened |
| 57 | reopen_verified.name= Reopen |
| 58 | reopen_verified.operations = set_resolution |
| 59 | reopen_verified.set_resolution=from verified |
| 60 | reopen_verified.permissions = TICKET_MODIFY |
| 61 | |
| 62 | reopen_approved = approved -> reopened |
| 63 | reopen_approved.name = Reopen |
| 64 | reopen_approved.operations = set_resolution |
| 65 | reopen_approved.set_resolution=from approved |
| 66 | reopen_approved.permissions = TICKET_CREATE |
| 67 | |
| 68 | remove = new, reopened, approved, closed -> removed |
| 69 | remove.name=Remove this Requirement permanently |
| 70 | remove.operations = set_resolution |
| 71 | remove.set_resolution= removed |
| 72 | remove.permissions = TICKET_MODIFY |
| 73 | |
| 74 | verify = approved -> closed |
| 75 | verify.name=Verifiy the Requirement and mark |
| 76 | verify.operations = set_resolution |
| 77 | verify.set_resolution=verified |
| 78 | verify.permissions = TICKET_MODIFY |
| 79 | }}} |
| 80 | |
| 81 | This results in the following workflow: |
| 82 | |
| 83 | {{{ |
| 84 | #!Workflow width=900 height=400 |
| 85 | leave = * -> * |
| 86 | leave.default = 1 |
| 87 | leave.operations = leave_status |
| 88 | |
| 89 | approve = new, reopened -> approved |
| 90 | approve.operations = del_resolution |
| 91 | approve.permissions = TICKET_MODIFY |
| 92 | |
| 93 | reopen_verified = closed -> reopened |
| 94 | reopen_verified.name= Reopen |
| 95 | reopen_verified.operations = set_resolution |
| 96 | reopen_verified.set_resolution=from verified |
| 97 | reopen_verified.permissions = TICKET_MODIFY |
| 98 | |
| 99 | reopen_approved = approved -> reopened |
| 100 | reopen_approved.name = Reopen |
| 101 | reopen_approved.operations = set_resolution |
| 102 | reopen_approved.set_resolution=from approved |
| 103 | reopen_approved.permissions = TICKET_CREATE |
| 104 | |
| 105 | remove = new, reopened, approved, closed -> removed |
| 106 | remove.name=Remove this Requirement permanently |
| 107 | remove.operations = set_resolution |
| 108 | remove.set_resolution= removed |
| 109 | remove.permissions = TICKET_MODIFY |
| 110 | |
| 111 | verify = approved -> closed |
| 112 | verify.name=Verifiy the Requirement and mark |
| 113 | verify.operations = set_resolution |
| 114 | verify.set_resolution=verified |
| 115 | verify.permissions = TICKET_MODIFY |
| 116 | }}} |
| 117 | |
| 118 | == Add Custom Statuses to Query Page == |
| 119 | Your custom statuses are normally not available on the Trac query page for filtering tickets. |
| 120 | |
| 121 | Trac core only looks at the default workflow when gathering the statuses (for obvious reasons since it doesn't know about your private workflow). |
| 122 | |
| 123 | To have your custom status appear which is defined in {{{[ticket-workflow-my_type]}}} add it to the default section {{{[ticket-workflow]}}} like this: |
| 124 | |
| 125 | {{{ |
| 126 | [ticket-workflow] |
| 127 | [...] |
| 128 | # The following are from other workflows. By including them here they will show up |
| 129 | # as a selectable item on the ticket query page. |
| 130 | approve = approved -> approved |
| 131 | remove = removed -> removed |
| 132 | [...] |
| 133 | }}} |
| 134 | |
| 135 | Because there is no transition to the statuses {{{approved}}} and {{{removed}}} in the default workflow these items will never show up as a selectable item on the ticket page of standard tickets, yet you see them on the query page. |