Ticket #2463: preliminary_required_fields_change.patch
| File preliminary_required_fields_change.patch, 2.3 KB (added by Mark Mc Mahon <mark.mcmahon@…>, 17 months ago) |
|---|
-
trac-trunk/trac/ticket/web_ui.py
1129 1129 add_warning(req, _("Tickets must contain a summary.")) 1130 1130 valid = False 1131 1131 1132 action = req.args.get('action', None) 1133 if action == 'leave': 1134 action = ticket.values['status'] 1135 1136 if action not in (None, 'leave', 'new'): 1137 # todo - add required fields for 'new', which are the default 1138 # required fields 1139 controllers = list( 1140 self._get_action_controllers(req, ticket, action)) 1141 if controllers: 1142 action_config = controllers[0].actions.get(action, {}) 1143 required_fields = action_config.get('required_fields', []) 1144 1132 1145 # Always validate for known values 1133 1146 for field in ticket.fields: 1147 if field['name'] in required_fields and not field['value']: 1148 add_warning(req, _( 1149 '"%(field)s" requires a value for the "%(action)s" action', 1150 field = field['name'], action = action)) 1151 valid = False 1152 1134 1153 if 'options' not in field: 1135 1154 continue 1136 1155 if field['name'] == 'status': -
trac-trunk/trac/ticket/default_workflow.py
74 74 else: 75 75 attributes['permissions'] = [a.strip() for a in 76 76 attributes['permissions'].split(',')] 77 # If no required_fields are specified, then all fields are conditional 78 if 'required_fields' not in attributes: 79 attributes['required_fields'] = [] 80 else: 81 attributes['required_fields'] = [ 82 a.strip() for a in attributes['required_fields'].split(',')] 83 77 84 # Normalize the oldstates 78 85 attributes['oldstates'] = [x.strip() for x in 79 86 attributes['oldstates'].split(',')]
