]>
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')))
40 // ###################################################################
42 if (empty($_REQUEST['do']))
44 $_REQUEST['do'] = 'edit';
47 // ###################################################################
49 #*# do these later once we have delete permissions figured out
50 if ($_REQUEST['do'] == 'kill')
52 // run code to remove item in database
55 // ###################################################################
57 if ($_REQUEST['do'] == 'delete')
59 // display delete confirmation message
62 // ###################################################################
64 if ($_POST['do'] == 'update')
66 $pcv = parse_pcv_select($bugsys->in
['pcv_select'], true);
68 if (!$bugsys->in
['summary'])
70 echo 'you need to enter a summary';
75 echo 'invalid product/component/version';
79 $hist[0] = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "bug WHERE bugid = $bug[bugid]");
82 UPDATE " . TABLE_PREFIX
. "bug
83 SET summary = '" . $bugsys->in
['summary'] . "',
84 priority = " . intval($bugsys->in
['priority']) . ",
85 status = " . intval($bugsys->in
['status']) . ",
86 resolution = " . intval($bugsys->in
['resolution']) . ",
87 assignedto = " . intval($bugsys->in
['assignedto']) . ",
88 productid = " . $pcv['product'] . ",
89 componentid = " . $pcv['component'] . ",
90 versionid = " . $pcv['version'] . "
91 WHERE bugid = $bug[bugid]"
94 $hist[1] = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "bug WHERE bugid = $bug[bugid]");
96 $diff[0] = array_diff_assoc($hist[0], $hist[1]);
97 $diff[1] = array_diff_assoc($hist[1], $hist[0]);
99 log_action($bug['bugid'], 'log_update_bug', array(), $diff[0], $diff[1]);
101 if (!$bugsys->in
['firstcomment'])
103 echo 'you need to enter some text in the first comment';
107 $bugsys->in
['comment_parsed'] = $bugsys->in
['firstcomment'];
109 if (!$bugsys->options
['allowhtml'])
111 $bugsys->in
['comment_parsed'] = $bugsys->sanitize($bugsys->in
['comment_parsed']);
114 // we could pass this as a GET param, but that's unsafe
115 $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1");
118 UPDATE " . TABLE_PREFIX
. "comment
119 SET comment = '" . $bugsys->in
['firstcomment'] . "',
120 comment_parsed = '" . nl2br($bugsys->in
['comment_parsed']) . "'
121 WHERE commentid = $firstcomment[commentid]"
124 if ($bugsys->in
['changeproduct'])
126 $_REQUEST['do'] = 'editproduct';
130 echo "<a href=\"showreport.php?bugid=$bug[bugid]\">done with update bug</a>";
134 // ###################################################################
136 if ($_REQUEST['do'] == 'edit')
138 foreach ($bugsys->datastore
['severity'] AS $severity)
140 $value = $severity['severityid'];
141 $selected = (($severity['severityid'] == $bug['severity']) ? true : false);
142 $label = $severity['severity'];
143 eval('$select[severity] .= "' . $template->fetch('selectoption') . '";');
146 $show['changestatus'] = ((can_perform('canchangestatus')) ? true : false);
147 if (can_perform('canchangestatus'))
149 foreach ($bugsys->datastore
['priority'] AS $priority)
151 $value = $priority['priorityid'];
152 $selected = (($priority['priorityid'] == $bug['priority']) ? true : false);
153 $label = $priority['priority'];
154 eval('$select[priority] .= "' . $template->fetch('selectoption') . '";');
157 foreach ($bugsys->datastore
['status'] AS $status)
159 $value = $status['statusid'];
160 $selected = (($status['statusid'] == $bug['status']) ? true : false);
161 $label = $status['status'];
162 eval('$select[status] .= "' . $template->fetch('selectoption') . '";');
165 foreach ($bugsys->datastore
['resolution'] AS $resolution)
167 $value = $resolution['resolutionid'];
168 $selected = (($resolution['resolutionid'] == $bug['resolution']) ? true : false);
169 $label = $resolution['resolution'];
170 eval('$select[resolution] .= "' . $template->fetch('selectoption') . '";');
174 $show['assign'] = ((can_perform('canassign')) ? true : false);
175 if (can_perform('canassign'))
177 foreach ($bugsys->datastore
['assignto'] AS $dev)
179 $value = $dev['userid'];
180 $selected = (($dev['userid'] == $bug['assignedto']) ? true : false);
181 $label = construct_user_display($dev, false);
182 eval('$select[dev] .= "' . $template->fetch('selectoption') . '";');
186 $pcv_select = construct_pcv_select("p$bug[productid]c$bug[componentid]v$bug[versionid]");
188 $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1");
190 eval('$template->flush("' . $template->fetch('editreport') . '");');
193 /*=====================================================================*\
194 || ###################################################################
197 || ###################################################################
198 \*=====================================================================*/