|
1
|
<title>Customizing The Ticket System</title> |
|
2
|
|
|
3
|
<h2>Introduction</h2> |
|
4
|
|
|
5
|
This guide will explain how to add the "assigned_to" and "submitted_by" fields |
|
6
|
to the ticket system in Fossil, as well as making the system more useful. You |
|
7
|
must have "admin" access to the repository to implement these instructions. |
|
8
|
|
|
9
|
<h2>First modify the TICKET table</h2> |
|
10
|
|
|
11
|
Click on the "Admin" menu, then "Tickets", then "Table". After the other fields |
|
12
|
and before the final ")", insert: |
|
13
|
<pre> |
|
14
|
, |
|
15
|
assigned_to TEXT, |
|
16
|
opened_by TEXT |
|
17
|
</pre> |
|
18
|
|
|
19
|
And "Apply Changes". You have just added two more fields to the ticket |
|
20
|
database! NOTE: I won't tell you to "Apply Changes" after each step from here |
|
21
|
on out. Now, how do you use these fields? |
|
22
|
|
|
23
|
<h2>Next add assignees</h2> |
|
24
|
|
|
25
|
Back to the "Tickets" admin page, and click "Common". Add something like this: |
|
26
|
<pre> |
|
27
|
set assigned_choices { |
|
28
|
unassigned |
|
29
|
tom |
|
30
|
dick |
|
31
|
harriet |
|
32
|
} |
|
33
|
</pre> |
|
34
|
|
|
35
|
Obviously, choose names corresponding to the logins on your system. The |
|
36
|
'unassigned' entry is important, as it prevents you from having a NULL in that |
|
37
|
field (which causes problems later when editing). |
|
38
|
|
|
39
|
<h2>Now modify the 'new ticket' page</h2> |
|
40
|
|
|
41
|
Back to the "Tickets" admin page, and click "New Ticket Page". This is a little |
|
42
|
more tricky. Edit the top part: |
|
43
|
|
|
44
|
<verbatim> |
|
45
|
if {[info exists submit]} { |
|
46
|
set status Open |
|
47
|
set opened_by $login |
|
48
|
set assigned_to "unassigned" |
|
49
|
submit_ticket |
|
50
|
} |
|
51
|
</verbatim> |
|
52
|
|
|
53
|
Note the "set opened_by" bit -- that will automatically set the "opened_by" |
|
54
|
field to the login name of the bug reporter. Now, skip to the part with "EMail" |
|
55
|
and modify it like so: |
|
56
|
|
|
57
|
<verbatim> |
|
58
|
<th1>enable_output expr { "$login" eq "anonymous"}</th1> |
|
59
|
<tr> |
|
60
|
<td align="right"> |
|
61
|
EMail: |
|
62
|
<input type="text" name="private_contact" value="$<private_contact>" size="30"> |
|
63
|
</td> |
|
64
|
<td> |
|
65
|
<u>Not publicly visible</u>. Used by developers to contact you with questions. |
|
66
|
</td> |
|
67
|
</tr> |
|
68
|
<th1>enable_output 1</th1> |
|
69
|
</verbatim> |
|
70
|
|
|
71
|
This bit of code will get rid of the "email" field entry for logged-in users. |
|
72
|
Since we know the user's information, we don't have to ask for it. NOTE: it |
|
73
|
might be good to automatically scoop up the user's email and put it here. |
|
74
|
|
|
75
|
You might also want to enable people to actually assign the ticket to a specific |
|
76
|
person during creation. For this to work, you need to add the code |
|
77
|
for "assigned_to" as shown below under the heading "Modify the 'edit ticket' page". |
|
78
|
This will give you an additional combobox where you can choose a person during |
|
79
|
ticket creation. |
|
80
|
|
|
81
|
<h2>Modify the 'view ticket' page</h2> |
|
82
|
|
|
83
|
Look for the text "Contact:" (about halfway through). Then insert these lines |
|
84
|
after the closing tr tag and before the "enable_output" line: |
|
85
|
|
|
86
|
<verbatim> |
|
87
|
<tr> |
|
88
|
<td align="right">Assigned to:</td><td bgcolor="#d0d0d0"> |
|
89
|
$<assigned_to> |
|
90
|
</td> |
|
91
|
<td align="right">Opened by:</td><td bgcolor="#d0d0d0"> |
|
92
|
$<opened_by> |
|
93
|
</td> |
|
94
|
</tr> |
|
95
|
</verbatim> |
|
96
|
|
|
97
|
This will add a row which displays these two fields, in the event the user has |
|
98
|
<a href="./caps/ref.html#w">ticket "edit" capability</a>. |
|
99
|
|
|
100
|
<h2>Modify the 'edit ticket' page</h2> |
|
101
|
|
|
102
|
Before the "Severity:" line, add this: |
|
103
|
|
|
104
|
<verbatim> |
|
105
|
<tr> |
|
106
|
<td align="right">Assigned to:</td> |
|
107
|
<td> |
|
108
|
<th1>combobox assigned_to $assigned_choices 1</th1> |
|
109
|
</td> |
|
110
|
</tr> |
|
111
|
</verbatim> |
|
112
|
|
|
113
|
That will give you a drop-down list of assignees. The first argument to the TH1 |
|
114
|
command 'combobox' is the database field which the combobox is associated to. |
|
115
|
The next argument is the list of choices you want to show in the combobox (and |
|
116
|
that you specified in the second step above.) The last argument should be 1 for |
|
117
|
a true combobox (see the <a href="th1.md#combobox">TH1 documentation</a> for |
|
118
|
details). |
|
119
|
|
|
120
|
Now, similar to the previous |
|
121
|
section, look for "Contact:" and add this: |
|
122
|
|
|
123
|
<verbatim> |
|
124
|
<tr> |
|
125
|
<td align="right">Reported by:</td> |
|
126
|
<td> |
|
127
|
<input type="text" name="opened_by" size="40" value="$<opened_by>"> |
|
128
|
</td> |
|
129
|
</tr> |
|
130
|
</verbatim> |
|
131
|
|
|
132
|
<h2>What next?</h2> |
|
133
|
|
|
134
|
Now you can add custom reports which select based on the person to whom the |
|
135
|
ticket is assigned. For example, an "Assigned to me" report could be: |
|
136
|
|
|
137
|
<verbatim> |
|
138
|
SELECT |
|
139
|
CASE WHEN status IN ('Open','Verified') THEN '#f2dcdc' |
|
140
|
WHEN status='Review' THEN '#e8e8e8' |
|
141
|
WHEN status='Fixed' THEN '#cfe8bd' |
|
142
|
WHEN status='Tested' THEN '#bde5d6' |
|
143
|
WHEN status='Deferred' THEN '#cacae5' |
|
144
|
ELSE '#c8c8c8' END AS 'bgcolor', |
|
145
|
substr(tkt_uuid,1,10) AS '#', |
|
146
|
datetime(tkt_mtime) AS 'mtime', |
|
147
|
type, |
|
148
|
status, |
|
149
|
subsystem, |
|
150
|
title |
|
151
|
FROM ticket |
|
152
|
WHERE assigned_to=user() |
|
153
|
</verbatim> |
|
154
|
|