Edgewall Software

Opened 11 years ago

Last modified 9 years ago

#10951 closed defect

[PATCH] Custom field order is not preserved — at Version 3

Reported by: Chris.Nelson@… Owned by:
Priority: normal Milestone:
Component: ticket system Version: 0.11.6
Severity: normal Keywords: custom field order needinfo
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos <ryan.j.ollos@…>)

It appears that _prepare_fields() in ticket/web_ui.py is supposed to order the fields for the ticket property box:

  • Most standard fields
  • Custom fields in the order specified by the user
  • Keywords

However, what I see is like:

ReporterOwner
PriorityMilestone
Custom 6Custom 7
Custom 8Custom 9
CCKeywords
Custom 0Custom 1
Custom 2Custom 3
Custom 4Custom 5

I've displayed the names, in order, from fields in templates/ticket.html and the fields are in the wrong order as the ticket is displayed.

This may be a complex interaction of many plugins. Or one plugin's ticket handling reordering fields. (I have ~30 plugins installed.) While there may be a bug in a plugin that should not reorder fields, Trac can enforce its intended order with the attached patch.

Change History (4)

by Chris.Nelson@…, 11 years ago

Attachment: custom_order.patch added

Patch to enforce custom field order

comment:1 by Chris.Nelson@…, 11 years ago

By the way, the change I made to display field order in the ticket template is:

  • trac/ticket/templates/ticket.html

    a b  
    159159              <td headers="h_owner">${ticket.owner and authorinfo(ticket.owner)
    160160              </td>
    161161            </tr>
     162         <span py:with="fieldorder=[f['name'] for f in fields]">
     163             ${pprint('fieldorder:%s' % fieldorder)}
     164          </span>
    162165            <tr py:for="row in group(fields, 2, lambda f: f.type != 'textarea')
    163166              py:with="fullrow = len(row) == 1">
    164167              <py:for each="idx, field in enumerate(row)">

I wish I could figure out how to write to trac.log from a template but this is the best I could do.

comment:2 by anonymous, 11 years ago

Summary: [PATHC] Custom field order is not preserved[PATCH] Custom field order is not preserved

comment:3 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.