You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
diff --git a/tracsubtickets/api.py b/tracsubtickets/api.py
index 71f2d67..9ad2674 100644
--- a/tracsubtickets/api.py
+++ b/tracsubtickets/api.py
@@ -181,6 +181,19 @@ class SubTicketsSystem(Component):
errors += _check_parents(x, all_parents)
return errors
+ def _check_types(ticket, parent):
+ if not self.config.getbool('subtickets',
+ '%s.allow_child_tickets' %
+ parent['type']):
+ yield None, "The parent ticket (#%s) has type '%s' which does not allow child tickets." % (parent.id, parent['type'])
+
+ # It is possible that the parent restricts the
+ # type of children it allows.
+ allowedtypes = self.config.getlist('subtickets',
+ '%s.restrict_child_types' % parent['type'])
+ if allowedtypes and ticket['type'] not in allowedtypes:
+ yield None, "The parent ticket (#%s) has type '%s' which does not allow child type '%s'. Must be one of: %s." % (parent.id,parent['type'],ticket['type'],','.join(allowedtypes))
+
for x in ids:
# check parent ticket state
parent = Ticket(self.env, x)
@@ -192,9 +205,14 @@ class SubTicketsSystem(Component):
for error in _check_parents(int(x), all_parents):
yield error
+ # Check type
+ for error in _check_types(ticket, parent):
+ yield error
+
ticket['parents'] = ', '.join(sorted(ids, key=lambda x: int(x)))
except Exception, e:
self.log.error(e)
yield 'parents', 'Not a valid list of ticket IDs'
+
The text was updated successfully, but these errors were encountered:
This feature is ported from ChildTickets plugin.
The text was updated successfully, but these errors were encountered: