Changes between Version 3 and Version 4 of TracTicketsCustomFields
- Timestamp:
- Sep 16, 2025, 5:57:34 PM (5 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracTicketsCustomFields
v3 v4 1 1 = Custom Ticket Fields 2 2 3 Trac supports adding custom, user-defined fields to the ticket module. With custom fields you can add typed, site-specific properties to tickets. 3 4 4 5 == Configuration 5 6 6 Configur ing custom ticket fields is done in the [wiki:TracIni trac.ini] file. All field definitions should be under a section named `[ticket-custom]`.7 Configure custom ticket fields in the [TracIni#ticket-custom-section "[ticket-custom]"] section of trac.ini. 7 8 8 9 The syntax of each field definition is: … … 16 17 17 18 === Field Names 19 18 20 A field name can only contain lowercase letters a-z, uppercase letters A-Z or digits 0-9, and must not start with a leading digit. 19 21 … … 55 57 * label: Descriptive label. 56 58 * value: Default value. 57 * order: Sort order placement; this determines relative placement in forms with respect to other custom fields. 58 * format: One of: 59 * `plain` for plain text 60 * `wiki` to interpret the content as WikiFormatting 61 * `reference` to treat the content as a queryable value (''since 1.0'') 62 * `list` to interpret the content as a list of queryable values, separated by whitespace (''since 1.0'') 59 * order: Sort order placement relative to other custom fields. 60 * max_size: Maximum allowed size in characters (//Since 1.3.2//). 61 * format: One of: 62 * `plain` for plain text 63 * `wiki` for [WikiFormatting wiki formatted] content 64 * `reference` to treat the content as a queryable value 65 * `list` to interpret the content as a list of queryable values, separated by whitespace 63 66 * '''checkbox''': A boolean value check box. 64 67 * label: Descriptive label. … … 78 81 * label: Descriptive label. 79 82 * value: Default text. 80 * cols: Width in columns. //(Removed in 1.1.2)//81 83 * rows: Height in lines. 82 84 * order: Sort order placement. 85 * max_size: Maximum allowed size in characters (//Since 1.3.2//). 83 86 * format: Either `plain` for plain text or `wiki` to interpret the content as WikiFormatting. 84 * '''time''': Date and time picker. ( ''Since 1.1.1.'')87 * '''time''': Date and time picker. (//Since 1.1.1//) 85 88 * label: Descriptive label. 86 89 * value: Default date. … … 119 122 test_five = radio 120 123 test_five.label = Radio buttons are fun 121 test_five.options = uno|dos|tres|cuatro|cinco124 test_five.options = |uno|dos|tres|cuatro|cinco 122 125 test_five.value = dos 123 126 … … 144 147 }}} 145 148 146 '''Note''': To make a `select` type field optional, specify a leading `|` in the `fieldname.options` option.149 '''Note''': To make a `select` type field optional, specify a leading `|` in `fieldname.options` (e.g. `test_five`). 147 150 148 151 === Reports Involving Custom Fields … … 153 156 SELECT p.value AS __color__, 154 157 id AS ticket, summary, owner, c.value AS progress 155 156 157 AND p.name = t.priority AND p.type = 'priority'158 158 FROM ticket t, enum p, ticket_custom c 159 WHERE status IN ('assigned') AND t.id = c.ticket AND c.name = 'progress' 160 AND p.name = t.priority AND p.type = 'priority' 161 ORDER BY p.value 159 162 }}} 160 163 '''Note''': This will only show tickets that have progress set in them. This is '''not the same as showing all tickets'''. If you created this custom ticket field ''after'' you have already created some tickets, they will not have that field defined, and thus they will never show up on this ticket query. If you go back and modify those tickets, the field will be defined, and they will appear in the query. … … 169 172 reporter AS _reporter, 170 173 (CASE WHEN c.value = '0' THEN 'None' ELSE c.value END) AS progress 171 172 173 JOIN enum p ON p.name = t.priority AND p.type='priority'174 175 174 FROM ticket t 175 LEFT OUTER JOIN ticket_custom c ON (t.id = c.ticket AND c.name = 'progress') 176 JOIN enum p ON p.name = t.priority AND p.type = 'priority' 177 WHERE status IN ('new', 'assigned', 'reopened') 178 ORDER BY p.value, milestone, severity, time 176 179 }}} 177 180 178 181 Note in particular the `LEFT OUTER JOIN` statement here. 179 182 180 Note that if your config file uses an '''uppercase''' name:183 Note that option names in trac.ini are case-insensitive, so even if your option name includes uppercase characters: 181 184 {{{#!ini 182 185 [ticket-custom] 183 184 186 Progress_Type = text 185 187 }}} 186 you woulduse '''lowercase''' in the SQL: `AND c.name = 'progress_type'`.188 you must use '''lowercase''' in the SQL: `AND c.name = 'progress_type'`. 187 189 188 190 ----