Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

#13176 closed defect (fixed)

Skip custom field of type select with no options

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.

Attachments (1)

Screen Shot 2019-07-03 at 12.32.01.jpg (20.1 KB ) - added by Ryan J Ollos 5 years ago.

Download all attachments as: .zip

Change History (4)

by Ryan J Ollos, 5 years ago

comment:1 by Ryan J Ollos, 5 years ago

Description: modified (diff)

comment:3 by Ryan J Ollos, 5 years ago

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

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.