I have two ticket types 'new' and 'update' each with different workflows. How do I implement in the trac.ini file that if a ticket type is modified the workflow is also changed to match the type. It should be modified to the first stage in the workflow when updated regardless of the current stage in the 'wrong' workflow. Using trac version 0.12.3
1 Answers
Preamble: Naming a ticket type 'new' is not the brightest idea, because this is rather confusing because its clashes with ticket status 'new' - bound to be confusing, you see?
Your request sounds reasonable, still I don't know of any configuration, that could make that happen. By default Trac offers to leave an invalid ticket state as it is or fix it. So without altering existing Trac core code, or install a Trac plugin, what is almost equivalent to the former, this can't be done.
Trac's modular component architecture is great for doing this with rather small effort. All in all it sounds like an implementation of the ITicketManipulator interface would be the right choice. You don't need to care about the timing - it's get triggered on each ticket change - just decide on interesting conditions and appropriate actions, and implementing "set Workflow start on type change" should be rather easy.
Hint: Each 'ticket' instance should be a Ticket
class object and have current (possibly changed) as well as old (last stored) values inside. Don't look any further than inside trac.ticket.model
to find out how/where to find it inside that object.