Edgewall Software

Opened 3 years ago

Closed 3 years ago

#13176 closed defect (fixed)

Skip custom field of type select with no options — at Version 3

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: low Milestone: 1.0.18
Component: ticket system Version:
Severity: normal Keywords: ticket-custom
Cc: Branch:
Release Notes:

Select custom field is not created if it has no options.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

Ticket custom field with no options is created as an empty select:

[ticket-custom]
...
select1 = select
...

I found strange behavior resulted in ticket validation when testing #13040. A warning would be raised when cloning a ticket, but not when creating a new ticket.

I think it would be better to just skip creation of ticket custom field of type select when it has no options.

  • trac/ticket/api.py

    diff --git a/trac/ticket/api.py b/trac/ticket/api.py
    index 9a752c32f..4c29f7c80 100644
    a b class TicketSystem(Component):  
    379379            }
    380380            if field['type'] == 'select' or field['type'] == 'radio':
    381381                field['options'] = config.getlist(name + '.options', sep='|')
     382                if not field['options']:
     383                    continue
    382384                if '' in field['options']:
    383385                    field['optional'] = True
    384386                    field['options'].remove('')

The built-in ticket fields already have this behavior.

Change History (4)

by Ryan J Ollos, 3 years ago

comment:1 by Ryan J Ollos, 3 years ago

Description: modified (diff)

comment:3 by Ryan J Ollos, 3 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in r16937, merged in r16938, r16939.

Note: See TracTickets for help on using tickets.