2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Renapsus [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 $fetchtemplates = array(
18 require_once('./global.php');
20 sanitize(array('bugid' => INT));
22 $bug = $DB_sql->query_first("
23 SELECT bug.*, user.email, user.displayname, user.showemail
24 FROM " . TABLE_PREFIX
. "bug AS bug
25 LEFT JOIN " . TABLE_PREFIX
. "user AS user
26 ON (bug.userid = user.userid)
27 WHERE bug.bugid = $vars[bugid]"
32 echo 'alert: bad bug';
36 if (!(((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')))
42 // ###################################################################
44 if (empty($_REQUEST['do']))
46 $_REQUEST['do'] = 'edit';
49 // ###################################################################
51 #*# do these later once we have delete permissions figured out
52 if ($_REQUEST['do'] == 'kill')
54 // run code to remove item in database
57 // ###################################################################
59 if ($_REQUEST['do'] == 'delete')
61 // display delete confirmation message
64 // ###################################################################
66 if ($_POST['do'] == 'update')
69 'summary' => STR_NOHTML
,
74 'changeproduct' => STR
)
78 UPDATE " . TABLE_PREFIX
. "bug
79 SET summary = '" . addslasheslike($vars['summary']) . "',
80 priority = $vars[priority], status = $vars[status],
81 resolution = $vars[resolution],
82 assignedto = $vars[assignedto]
83 WHERE bugid = $bug[bugid]"
86 if ($vars['changeproduct'])
88 $_REQUEST['do'] = 'editproduct';
92 echo "<a href=\"showreport.php?bugid=$bug[bugid]\">done with update bug</a>";
96 // ###################################################################
98 if ($_REQUEST['do'] == 'edit')
100 foreach ($bugsys->datastore
['severity'] AS $severity)
102 $value = $severity['severityid'];
103 $selected = iff($severity['severityid'] == $bug['severity'], true
, false
);
104 $label = $severity['severity'];
105 eval('$select[severity] .= "' . $tpl->fetch('selectoption') . '";');
108 $show['changestatus'] = iff(can_perform('canchangestatus'), true
, false
);
109 if (can_perform('canchangestatus'))
111 foreach ($bugsys->datastore
['priority'] AS $priority)
113 $value = $priority['priorityid'];
114 $selected = iff($priority['priorityid'] == $bug['priority'], true
, false
);
115 $label = $priority['priority'];
116 eval('$select[priority] .= "' . $tpl->fetch('selectoption') . '";');
119 foreach ($bugsys->datastore
['status'] AS $status)
121 $value = $status['statusid'];
122 $selected = iff($status['statusid'] == $bug['status'], true
, false
);
123 $label = $status['status'];
124 eval('$select[status] .= "' . $tpl->fetch('selectoption') . '";');
127 foreach ($bugsys->datastore
['resolution'] AS $resolution)
129 $value = $resolution['resolutionid'];
130 $selected = iff($resolution['resolutionid'] == $bug['resolution'], true
, false
);
131 $label = $resolution['resolution'];
132 eval('$select[resolution] .= "' . $tpl->fetch('selectoption') . '";');
136 $show['assign'] = iff(can_perform('canassign'), true
, false
);
137 if (can_perform('canassign'))
139 foreach ($bugsys->datastore
['assignto'] AS $dev)
141 $value = $dev['userid'];
142 $selected = iff($dev['userid'] == $bug['assignedto'], true
, false
);
143 $label = construct_user_display($dev, false
);
144 eval('$select[dev] .= "' . $tpl->fetch('selectoption') . '";');
148 eval('$tpl->flush("' . $tpl->fetch('editreport') . '");');
151 // ###################################################################
153 if ($_POST['do'] == 'updateproduct')
155 sanitize(array('product' => INT, 'component' => INT, 'version' => INT));
159 if (!$vars['product'] OR !$vars['component'] OR !$vars['version'])
161 echo 'there was a problem selecting the product, component, or version';
164 $product = $bugsys->datastore
['product']["$vars[product]"];
167 echo 'please select a valid product';
170 $version = $bugsys->datastore
['version']["$vars[version]"];
173 echo 'please select a valid version';
177 if ($vars['component'] == -1)
179 // not global version and version.productid != product.productid
180 if ($version['productid'] != 0 AND $version['productid'] != $product['productid'])
182 echo 'invalid version specified';
189 $component = $bugsys->datastore
['product']["$vars[component]"];
190 // component has the right mother
191 if ($component['componentmother'] == $product['productid'])
193 // version.productid != {component.productid | product.productid}
194 if (($version['productid'] != $component['productid'] AND $version['productid'] != $product['productid']) AND $version['productid'] != 0)
196 echo 'invalid version specified';
202 echo 'invalid component specified';
208 $DB_sql->query("UPDATE " . TABLE_PREFIX
. "bug SET productid = $vars[product], componentid = $vars[component], versionid = $vars[version] WHERE bugid = $bug[bugid]");
210 echo "<a href=\"showreport.php?bugid=$bug[bugid]\">changed product info</a>";
213 // ###################################################################
215 if ($_REQUEST['do'] == 'editproduct')
217 sanitize(array('product' => INT, 'component' => INT, 'version' => INT));
219 $select['do'] = 'editproduct';
220 $select['script'] = 'editreport';
222 if (!$vars['product'])
224 $products = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX
. "product WHERE !componentmother ORDER BY displayorder ASC");
225 while ($product = $DB_sql->fetch_array($products))
227 $value = $product['productid'];
228 $selected = iff($product['productid'] == $bug['productid'], true
, false
);
229 $label = $product['title'];
230 eval('$select[options] .= "' . $tpl->fetch('selectoption') . '";');
233 $select['display'] = 'Product';
234 $select['name'] = 'product';
235 eval('$tpl->flush("' . $tpl->fetch('productselect') . '");');
237 else if (!$vars['component'])
240 $selected = iff($bug['componentid'] == -1, true
, false
);
241 $label = 'No Component';
242 eval('$select[options] .= "' . $tpl->fetch('selectoption') . '";');
243 $components = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX
. "product WHERE componentmother IN ($vars[product]) ORDER BY displayorder ASC");
244 while ($component = $DB_sql->fetch_array($components))
246 $value = $component['productid'];
247 $selected = iff($component['productid'] == $bug['componentid'], true
, false
);
248 $label = $component['title'];
249 eval('$select[options] .= "' . $tpl->fetch('selectoption') . '";');
252 $select['display'] = 'Component';
253 $select['name'] = 'component';
254 eval('$tpl->flush("' . $tpl->fetch('productselect') . '");');
256 else if (!$vars['version'])
258 $versions = $DB_sql->query("
259 SELECT version.*, product.componentmother, product.title AS productname
260 FROM " . TABLE_PREFIX
. "version AS version
261 LEFT JOIN " . TABLE_PREFIX
. "product ON (product.productid = version.productid)
262 WHERE version.productid IN (0, $vars[product]" . iff($vars['component'] != -1, ", $vars[component]", '') . ")
263 ORDER BY version.productid, version.displayorder ASC"
266 while ($version = $DB_sql->fetch_array($versions))
268 $versionlist["$version[productid]"][] = $version;
269 $lookup["$version[productid]"] = array('componentmother' => $version['componentmother'], 'productname' => $version['productname']);
272 foreach ($versionlist AS $productid => $versions)
278 $glabel = 'Global Versions';
281 else if ($lookup["$productid"]['componentmother'])
283 $glabel = $lookup["$productid"]['productname'];
287 $glabel = $lookup["$productid"]['productname'];
290 foreach ($versions AS $version)
292 $value = $version['versionid'];
293 $selected = iff($version['versionid'] == $bug['versionid'], true
, false
);
294 $label = $prepend . $version['version'];
295 eval('$optbits .= "' . $tpl->fetch('selectoption') . '";');
297 eval('$select[options] .= "' . $tpl->fetch('selectoptgroup') . '";');
301 $select['display'] = 'Version';
302 $select['name'] = 'version';
303 $select['do'] = 'updateproduct';
304 $select['method'] = 'post';
306 eval('$tpl->flush("' . $tpl->fetch('productselect') . '");');
310 /*=====================================================================*\
311 || ###################################################################
314 || ###################################################################
315 \*=====================================================================*/