]>
src.bluestatic.org Git - bugdar.git/blob - editreport.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2002-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2002 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 $fetchtemplates = array(
18 require_once('./global.php');
20 $bug = $db->query_first("
21 SELECT bug.*, user.email, user.displayname, user.showemail
22 FROM " . TABLE_PREFIX
. "bug AS bug
23 LEFT JOIN " . TABLE_PREFIX
. "user AS user
24 ON (bug.userid = user.userid)
25 WHERE bug.bugid = " . intval($bugsys->in
['bugid'])
30 echo 'alert: bad bug';
34 if (!(((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')))
41 require_once('./includes/class_history.php');
43 $log->bugid
= $bug['bugid'];
45 // ###################################################################
47 if (empty($_REQUEST['do']))
49 $_REQUEST['do'] = 'edit';
52 // ###################################################################
54 #*# do these later once we have delete permissions figured out
55 if ($_REQUEST['do'] == 'kill')
57 // run code to remove item in database
60 // ###################################################################
62 if ($_REQUEST['do'] == 'delete')
64 // display delete confirmation message
67 // ###################################################################
69 if ($_POST['do'] == 'update')
71 $pcv = parse_pcv_select($bugsys->in
['pcv_select'], true);
73 if (!$bugsys->in
['summary'])
75 echo 'you need to enter a summary';
80 echo 'invalid product/component/version';
84 $hist[0] = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "bug WHERE bugid = $bug[bugid]");
87 UPDATE " . TABLE_PREFIX
. "bug
88 SET summary = '" . $bugsys->in
['summary'] . "',
89 priority = " . intval($bugsys->in
['priority']) . ",
90 status = " . intval($bugsys->in
['status']) . ",
91 severity = " . intval($bugsys->in
['severity']) . ",
92 resolution = " . intval($bugsys->in
['resolution']) . ",
93 assignedto = " . intval($bugsys->in
['assignedto']) . ",
94 productid = " . $pcv['product'] . ",
95 componentid = " . $pcv['component'] . ",
96 versionid = " . $pcv['version'] . "
97 WHERE bugid = $bug[bugid]"
100 $hist[1] = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "bug WHERE bugid = $bug[bugid]");
102 $diff[0] = array_diff_assoc($hist[0], $hist[1]);
103 $diff[1] = array_diff_assoc($hist[1], $hist[0]);
105 $lookupindex = array(
106 'status' => 'status',
107 'severity' => 'severity',
108 'priority' => 'priority',
109 'versionid' => 'version',
110 'assignedto' => 'assignto',
111 'resolution' => 'resolution',
112 'productid' => 'product',
113 'componentid' => 'product'
116 $log->language
= 'log_update_bug';
118 foreach ($diff AS $num => $diffs)
120 foreach ($diffs AS $key => $value)
122 if (!isset($lookupindex["$key"]))
127 $ref = $lookupindex["$key"];
128 $temp =& $bugsys->datastore
["$ref"]["$value"];
129 $thevalue = $temp["$ref"];
130 $idbit = ' (id: ' . $temp["$ref" . 'id'] . ')';
132 if ($key == 'assignedto')
134 $thevalue = (($temp['userid']) ? construct_user_display($temp) : '');
137 else if ($key == 'productid' OR $key == 'componentid')
140 $thevalue = $temp['title'];
143 $diff["$num"]["$key"] = (($thevalue) ? $thevalue . $idbit : '');
147 foreach ($diff[1] AS $key => $value)
149 $log->log($log->diff($key, $diff[0]["$key"], $diff[1]["$key"]));
152 if (!$bugsys->in
['firstcomment'])
154 echo 'you need to enter some text in the first comment';
158 $bugsys->in
['comment_parsed'] = $bugsys->in
['firstcomment'];
160 if (!$bugsys->options
['allowhtml'])
162 $bugsys->in
['comment_parsed'] = $bugsys->sanitize($bugsys->in
['comment_parsed']);
165 // we could pass this as a GET param, but that's unsafe
166 $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1");
169 UPDATE " . TABLE_PREFIX
. "comment
170 SET comment = '" . $bugsys->in
['firstcomment'] . "',
171 comment_parsed = '" . nl2br($bugsys->in
['comment_parsed']) . "'
172 WHERE commentid = $firstcomment[commentid]"
175 if ($bugsys->in
['changeproduct'])
177 $_REQUEST['do'] = 'editproduct';
181 echo "<a href=\"showreport.php?bugid=$bug[bugid]\">done with update bug</a>";
185 // ###################################################################
187 if ($_REQUEST['do'] == 'edit')
189 foreach ($bugsys->datastore
['severity'] AS $severity)
191 $value = $severity['severityid'];
192 $selected = (($severity['severityid'] == $bug['severity']) ? true : false);
193 $label = $severity['severity'];
194 eval('$select[severity] .= "' . $template->fetch('selectoption') . '";');
197 $show['changestatus'] = ((can_perform('canchangestatus')) ? true : false);
198 if (can_perform('canchangestatus'))
200 foreach ($bugsys->datastore
['priority'] AS $priority)
202 $value = $priority['priorityid'];
203 $selected = (($priority['priorityid'] == $bug['priority']) ? true : false);
204 $label = $priority['priority'];
205 eval('$select[priority] .= "' . $template->fetch('selectoption') . '";');
208 foreach ($bugsys->datastore
['status'] AS $status)
210 $value = $status['statusid'];
211 $selected = (($status['statusid'] == $bug['status']) ? true : false);
212 $label = $status['status'];
213 eval('$select[status] .= "' . $template->fetch('selectoption') . '";');
216 foreach ($bugsys->datastore
['resolution'] AS $resolution)
218 $value = $resolution['resolutionid'];
219 $selected = (($resolution['resolutionid'] == $bug['resolution']) ? true : false);
220 $label = $resolution['resolution'];
221 eval('$select[resolution] .= "' . $template->fetch('selectoption') . '";');
225 $show['assign'] = ((can_perform('canassign')) ? true : false);
226 if (can_perform('canassign'))
228 foreach ($bugsys->datastore
['assignto'] AS $dev)
230 $value = $dev['userid'];
231 $selected = (($dev['userid'] == $bug['assignedto']) ? true : false);
232 $label = construct_user_display($dev, false);
233 eval('$select[dev] .= "' . $template->fetch('selectoption') . '";');
237 $pcv_select = construct_pcv_select("p$bug[productid]c$bug[componentid]v$bug[versionid]");
239 $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1");
241 eval('$template->flush("' . $template->fetch('editreport') . '");');
244 /*=====================================================================*\
245 || ###################################################################
248 || ###################################################################
249 \*=====================================================================*/