Modify

Opened 13 years ago

Closed 10 years ago

#9951 closed defect (duplicate)

[patch] set type

Reported by: Steven R. Loomis Owned by: Eli Carter
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 10 years ago by Ryan J Ollos

Resolution: duplicate
Status: newclosed

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Eli Carter.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.