Modify

Opened 2 years ago

Closed 7 days ago

#9951 closed defect (duplicate)

[patch] set type

Reported by: Srl295 Owned by: retracile
Priority: normal Component: AdvancedTicketWorkflowPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Index: controller.py
===================================================================
--- controller.py	(revision 11468)
+++ controller.py	(working copy)
@@ -83,7 +83,42 @@
         """Returns the change of owner."""
         return {'owner': ticket['reporter']}
 
+class TicketWorkflowOpTypechange(TicketWorkflowOpBase):
+    """Changes the ticket type.
 
+    <someaction>.operations = set_type
+
+    Don't forget to add the `TicketWorkflowOpTypechange` to the workflow
+    option in [ticket].
+    If there is no workflow option, the line will look like this:
+
+    workflow = ConfigurableTicketWorkflow,TicketWorkflowOpTypechange
+    """
+
+    _op_name = 'set_type'
+
+    # 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 type will change to %s' % self._new_type(action)
+        control = tag('')
+        return (label, control, hint)
+
+    def get_ticket_changes(self, req, ticket, action):
+        """Returns the change of type."""
+        return {'type': self._new_type(action)}
+
+    def _new_type(self,action):
+        """Determines the new type"""
+        # Should probably do some sanity checking...
+        field = self.config.get('ticket-workflow',
+                                action + '.' + self._op_name).strip()
+        return field
+
+

Attachments (0)

Change History (1)

comment:1 Changed 7 days ago by rjollos

  • Resolution set to duplicate
  • Status changed from new to closed

This is one of many tickets requesting the ability to add, delete, append to or remove from a field. I'd like to implement that feature in this plugin and then integrate it to the Trac core (​trac:#11452). I'm closing these tickets as duplicates so that we can have the discussion in a single ticket. Duplicate of #9502.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.