Changes between Version 2 and Version 3 of TracTicketsCustomFields
- Timestamp:
- 18/06/13 12:48:03 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracTicketsCustomFields
v2 v3 18 18 * value: Default value. 19 19 * order: Sort order placement. (Determines relative placement in forms with respect to other custom fields.) 20 * format: One of: 21 * `plain` for plain text 22 * `wiki` to interpret the content as WikiFormatting (''since 0.11.3'') 23 * `reference` to treat the content as a queryable value (''since 1.0'') 24 * `list` to interpret the content as a list of queryable values, separated by whitespace (''since 1.0'') 20 25 * '''checkbox''': A boolean value check box. 21 26 * label: Descriptive label. … … 30 35 * label: Descriptive label. 31 36 * options: List of values, separated by '''|''' (vertical pipe). 32 * value: Default value ( Item #, starting at 0).37 * value: Default value (one of the values from options). 33 38 * order: Sort order placement. 34 39 * '''textarea''': Multi-line text area. … … 38 43 * rows: Height in lines. 39 44 * order: Sort order placement. 45 * format: Either `plain` for plain text or `wiki` to interpret the content as WikiFormatting. (''since 0.11.3'') 40 46 41 47 === Sample Config === … … 48 54 test_two = text 49 55 test_two.label = Another text-box 50 test_two.value = Just a default value 56 test_two.value = Default [mailto:joe@nospam.com owner] 57 test_two.format = wiki 51 58 52 59 test_three = checkbox … … 62 69 test_five.label = Radio buttons are fun 63 70 test_five.options = uno|dos|tres|cuatro|cinco 64 test_five.value = 171 test_five.value = dos 65 72 66 73 test_six = textarea … … 107 114 Note in particular the `LEFT OUTER JOIN` statement here. 108 115 116 === Updating the database === 117 118 As noted above, any tickets created before a custom field has been defined will not have a value for that field. Here's a bit of SQL (tested with SQLite) that you can run directly on the Trac database to set an initial value for custom ticket fields. Inserts the default value of 'None' into a custom field called 'request_source' for all tickets that have no existing value: 119 120 {{{ 121 #!sql 122 INSERT INTO ticket_custom 123 (ticket, name, value) 124 SELECT 125 id AS ticket, 126 'request_source' AS name, 127 'None' AS value 128 FROM ticket 129 WHERE id NOT IN ( 130 SELECT ticket FROM ticket_custom 131 ); 132 }}} 133 134 If you added multiple custom fields at different points in time, you should be more specific in the subquery on table {{{ticket}}} by adding the exact custom field name to the query: 135 136 {{{ 137 #!sql 138 INSERT INTO ticket_custom 139 (ticket, name, value) 140 SELECT 141 id AS ticket, 142 'request_source' AS name, 143 'None' AS value 144 FROM ticket 145 WHERE id NOT IN ( 146 SELECT ticket FROM ticket_custom WHERE name = 'request_source' 147 ); 148 }}} 149 109 150 ---- 110 151 See also: TracTickets, TracIni