2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 $fetchtemplates = array(
26 define('SVN', '$Id$');
28 $focus['newreport'] = 'focus';
30 require_once('./global.php');
31 require_once('./includes/functions_product.php');
32 require_once('./includes/api_bug.php');
33 require_once('./includes/api_comment.php');
35 if (!can_perform('cansubmitbugs', intval($bugsys->in
['productid'])))
37 $message->error_permission();
40 // ###################################################################
42 if (empty($_REQUEST['do']))
44 $_REQUEST['do'] = 'add';
47 // ###################################################################
49 if ($_POST['do'] == 'insert')
51 $bug = new BugAPI($bugsys);
52 $comment = new CommentAPI($bugsys);
54 $bug->set('userid', $bugsys->userinfo
['userid']);
55 $bug->set('username', $bugsys->userinfo
['displayname']);
56 $bug->set('summary', $bugsys->in
['summary']);
57 $bug->set('severity', $bugsys->in
['severity']);
59 $comment->set('userid', $bugsys->userinfo
['userid']);
60 $comment->set('comment', $bugsys->in
['comment']);
62 // -------------------------------------------------------------------
63 // check permissions on various input values
64 if (!can_perform('canchangestatus', intval($bugsys->in
['productid'])))
66 $bug->set('priority', $bugsys->options
['defaultpriority']);
67 $bug->set('status', $bugsys->options
['defaultstatus']);
68 $bug->set('resolution', $bugsys->options
['defaultresolve']);
72 $bug->set('priority', $bugsys->in
['priority']);
73 $bug->set('status', $bugsys->in
['status']);
74 $bug->set('resolution', $bugsys->in
['resolution']);
76 if (!can_perform('canassign', intval($bugsys->in
['productid'])))
78 $bug->set('assignedto', $bugsys->options
['defaultassign']);
82 // assigned person is not a dev or a valid user
83 $bug->set('assignedto', $bugsys->in
['assignedto']);
86 // -------------------------------------------------------------------
87 // product/component/version stuff
88 $pcv = parse_pcv_select($bugsys->in
['pcv_select'], true
);
91 $message->add_error($lang->string('Invalid product/component/version selected.'));
93 $bug->set('productid', $pcv['product']);
94 $bug->set('componentid', $pcv['component']);
95 $bug->set('versionid', $pcv['version']);
101 $comment->set('bugid', $bug->insertid
);
104 $bug = new BugAPI($bugsys); // need to destroy because update will think the insert fields need to be changed, too
105 $bug->set('bugid', $comment->values
['bugid']);
106 $bug->set_condition();
107 $bug->set('dateline', $comment->values
['dateline']);
108 $bug->set('initialreport', $comment->insertid
);
109 $bug->set('lastposttime', $comment->values
['dateline']);
110 $bug->set('lastpostby', $bugsys->userinfo
['userid']);
111 $bug->set('lastpostbyname', $bugsys->userinfo
['displayname']);
112 $bug->set('hiddenlastposttime', $comment->values
['dateline']);
113 $bug->set('hiddenlastpostby', $bugsys->userinfo
['userid']);
114 $bug->set('hiddenlastpostbyname', $bugsys->userinfo
['displayname']);
117 $message->redirect($lang->string('The bug has been added to the database.'), ($bugsys->in
['submit_reload'] == '' ?
"showreport.php?bugid=" . $bug->values
['bugid'] : 'newreport.php'));
121 $show['errors'] = true
;
122 $_REQUEST['do'] = 'add';
123 $message->error_list_process();
127 // ###################################################################
129 if ($_REQUEST['do'] == 'add')
131 $select['severity'] = construct_datastore_select('severity', 'severity', 'severityid', ($bugsys->in
['severity'] ?
$bugsys->in
['severity'] : $bugsys->options
['defaultseverity']));
133 $show['changestatus'] = ((can_perform('canchangestatus')) ? true
: false
);
135 if (can_perform('canchangestatus'))
137 $select['priority'] = construct_datastore_select('priority', 'priority', 'priorityid', ($bugsys->in
['priority'] ?
$bugsys->in
['priority'] : $bugsys->options
['defaultpriority']));
138 $select['status'] = construct_datastore_select('status', 'status', 'statusid', ($bugsys->in
['status'] ?
$bugsys->in
['status'] : $bugsys->options
['defaultstatus']));
139 $select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid', ($bugsys->in
['resolution'] ?
$bugsys->in
['resolution'] : $bugsys->options
['defaultresolve']));
142 $show['assign'] = ((can_perform('canassign')) ? true
: false
);
144 if (can_perform('canassign'))
146 foreach ($bugsys->datastore
['assignto'] AS $dev)
148 $value = $dev['userid'];
149 $label = construct_user_display($dev, false
);
150 $selected = ($bugsys->in
['assignedto'] ?
($bugsys->in
['assignedto'] == $dev['userid']) : ($dev['userid'] == $bugsys->options
['defaultassign']));
151 eval('$select[dev] .= "' . $template->fetch('selectoption') . '";');
156 $fields = construct_custom_fields(null
, true
);
158 foreach ($fields AS $field)
162 $customfields['left'] .= $field;
166 $customfields['right'] .= $field;
171 $pcv_select = construct_pcv_select('cansubmitbugs', $bugsys->in
['pcv_select']);
173 $reporter = construct_user_display($bugsys->userinfo
);
175 eval('$template->flush("' . $template->fetch('newreport') . '");');
178 /*=====================================================================*\
179 || ###################################################################
182 || ###################################################################
183 \*=====================================================================*/