Ticket #4019: TicketApiAddMissingFieldsOptional.diff
| File TicketApiAddMissingFieldsOptional.diff, 1.3 KB (added by ilias@…, 5 years ago) |
|---|
-
api.py
85 85 return [action for action in actions.get(ticket['status'], ['leave']) 86 86 if action not in perms or perm_.has_permission(perms[action])] 87 87 88 def get_ticket_fields(self): 89 """Returns the list of fields available for tickets.""" 88 def get_ticket_fields(self, all_fields=False): 89 """Returns the list of fields available for tickets. 90 optional Bool parameter 'all_fields': 91 True: return all available fields 92 False: return only fields for display within Ticket GUI (default)""" 90 93 from trac.ticket import model 91 94 92 95 db = self.env.get_db_cnx() … … 142 145 field = {'name': name, 'type': 'text', 'label': name.title()} 143 146 fields.append(field) 144 147 148 # DateTime fields 149 if (all_fields): 150 fields.append( {'name': 'time', 'type': 'text', 'label': 'Created'} ) 151 fields.append( {'name': 'changetime', 'type': 'text', 'label': 'Modified'} ) 152 145 153 for field in self.get_custom_fields(): 146 154 if field['name'] in [f['name'] for f in fields]: 147 155 self.log.warning('Duplicate field name "%s" (ignoring)',
