Modify ↓
Opened 17 years ago
Last modified 5 years ago
#3402 new enhancement
set_field_to_owner?
| Reported by: | J Evan S | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | AdvancedTicketWorkflowPlugin |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: | 0.11 |
Description
How about a set_field_to_owner to complement set_owner_to_field?
fix = inprogress -> needs_review fix.operations = set_field_to_owner fix.set_field_to_owner = fixedby . . . fail = in_testing -> failed fail.operations = set_owner_to_field fail.set_owner_to_field = fixedby
Attachments (0)
Change History (4)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
| Status: | new → assigned |
|---|
The need to hide the field hints at a deeper problem in Trac core which I need to dig into. I'm inclined to postpone adding this feature here until I figure out a good solution for the underlying issue in core, but it is very clearly a good idea.
comment:3 Changed 5 years ago by
| Status: | assigned → new |
|---|
comment:4 Changed 5 years ago by
| Owner: | Eli Carter deleted |
|---|
Note: See
TracTickets for help on using
tickets.



I've achieved this in my local installation by adding the following code to controller.py:
class TicketWorkflowOpFieldOwner(TicketWorkflowOpBase): """Sets the value of a ticket field to the owner <someaction>.operations = set_field_to_owner <someaction>.set_field_to_owner = myfield Don't forget to add the `TicketWorkflowOpFieldOwner` to the workflow option in [ticket]. If there is no workflow option, the line will look like this: workflow = ConfigurableTicketWorkflow,TicketWorkflowOpFieldOwner """ _op_name = 'set_field_to_owner' # ITicketActionController methods def render_ticket_action_control(self, req, ticket, action): """Returns the action control""" actions = ConfigurableTicketWorkflow(self.env).actions label = actions[action]['name'] hint = 'The %s will change to %s' % (self._field_name(action, ticket), ticket['owner']) control = tag('') return (label, control, hint) def get_ticket_changes(self, req, ticket, action): """Returns the change of the field.""" return {self._field_name(action, ticket): ticket['owner']} def _field_name(self, action, ticket): """Determines the new owner""" field = self.config.get('ticket-workflow', action + '.' + self._op_name).strip() return fieldTo get it to work properly, I'm also hiding the field in question using the BlackMagicTicketTweaksPlugin; without that, I was getting complaints about the field being set twice when a user submitted the form.