2003-03-27 03:07:02 +03:00
|
|
|
#!/usr/bin/perl -wT
|
1998-09-16 01:49:26 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
1998-08-26 10:14:20 +04:00
|
|
|
#
|
1999-11-02 02:33:56 +03:00
|
|
|
# The contents of this file are subject to the Mozilla Public
|
|
|
|
# License Version 1.1 (the "License"); you may not use this file
|
|
|
|
# except in compliance with the License. You may obtain a copy of
|
|
|
|
# the License at http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS
|
|
|
|
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
# implied. See the License for the specific language governing
|
|
|
|
# rights and limitations under the License.
|
|
|
|
#
|
1998-08-26 10:14:20 +04:00
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
1999-11-02 02:33:56 +03:00
|
|
|
#
|
1998-08-26 10:14:20 +04:00
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
1999-11-02 02:33:56 +03:00
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
1998-08-26 10:14:20 +04:00
|
|
|
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
1999-12-03 02:21:42 +03:00
|
|
|
# Dan Mosedale <dmose@mozilla.org>
|
2000-03-10 19:25:03 +03:00
|
|
|
# Joe Robins <jmrobins@tgix.com>
|
2002-04-05 11:09:28 +04:00
|
|
|
# Gervase Markham <gerv@gerv.net>
|
2006-06-18 03:24:36 +04:00
|
|
|
# Marc Schumann <wurblzap@gmail.com>
|
1998-08-26 10:14:20 +04:00
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
use strict;
|
2002-01-20 04:44:52 +03:00
|
|
|
use lib qw(.);
|
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
use Bugzilla;
|
2006-06-18 03:24:36 +04:00
|
|
|
use Bugzilla::Attachment;
|
2002-11-24 22:56:34 +03:00
|
|
|
use Bugzilla::Constants;
|
2005-08-15 21:43:38 +04:00
|
|
|
use Bugzilla::Util;
|
2006-06-21 04:44:48 +04:00
|
|
|
use Bugzilla::Error;
|
2004-03-18 06:57:05 +03:00
|
|
|
use Bugzilla::Bug;
|
2002-10-25 07:59:35 +04:00
|
|
|
use Bugzilla::User;
|
2005-07-22 00:04:27 +04:00
|
|
|
use Bugzilla::Field;
|
2006-03-03 02:50:17 +03:00
|
|
|
use Bugzilla::Product;
|
2006-07-13 16:11:56 +04:00
|
|
|
use Bugzilla::Component;
|
2006-03-09 03:09:00 +03:00
|
|
|
use Bugzilla::Keyword;
|
2006-06-05 14:58:38 +04:00
|
|
|
use Bugzilla::Token;
|
2006-08-24 19:56:39 +04:00
|
|
|
use Bugzilla::Flag;
|
2002-10-25 07:59:35 +04:00
|
|
|
|
2004-03-27 06:51:44 +03:00
|
|
|
my $user = Bugzilla->login(LOGIN_REQUIRED);
|
2005-10-25 03:11:56 +04:00
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
my $cgi = Bugzilla->cgi;
|
2005-02-18 19:01:48 +03:00
|
|
|
my $dbh = Bugzilla->dbh;
|
2005-10-25 03:11:56 +04:00
|
|
|
my $template = Bugzilla->template;
|
|
|
|
my $vars = {};
|
2005-02-18 19:01:48 +03:00
|
|
|
|
2006-03-02 00:26:18 +03:00
|
|
|
######################################################################
|
|
|
|
# Subroutines
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
# Determines whether or not a group is active by checking
|
|
|
|
# the "isactive" column for the group in the "groups" table.
|
|
|
|
# Note: This function selects groups by id rather than by name.
|
|
|
|
sub GroupIsActive {
|
|
|
|
my ($group_id) = @_;
|
|
|
|
$group_id ||= 0;
|
|
|
|
detaint_natural($group_id);
|
|
|
|
my ($is_active) = Bugzilla->dbh->selectrow_array(
|
|
|
|
"SELECT isactive FROM groups WHERE id = ?", undef, $group_id);
|
|
|
|
return $is_active;
|
|
|
|
}
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Main Script
|
|
|
|
######################################################################
|
|
|
|
|
2006-06-05 14:58:38 +04:00
|
|
|
# Detect if the user already used the same form to submit a bug
|
|
|
|
my $token = trim($cgi->param('token'));
|
|
|
|
if ($token) {
|
|
|
|
my ($creator_id, $date, $old_bug_id) = Bugzilla::Token::GetTokenData($token);
|
|
|
|
unless ($creator_id
|
|
|
|
&& ($creator_id == $user->id)
|
|
|
|
&& ($old_bug_id =~ "^createbug:"))
|
|
|
|
{
|
|
|
|
# The token is invalid.
|
|
|
|
ThrowUserError('token_inexistent');
|
|
|
|
}
|
|
|
|
|
|
|
|
$old_bug_id =~ s/^createbug://;
|
|
|
|
|
|
|
|
if ($old_bug_id && (!$cgi->param('ignore_token')
|
|
|
|
|| ($cgi->param('ignore_token') != $old_bug_id)))
|
|
|
|
{
|
|
|
|
$vars->{'bugid'} = $old_bug_id;
|
|
|
|
$vars->{'allow_override'} = defined $cgi->param('ignore_token') ? 0 : 1;
|
|
|
|
|
|
|
|
print $cgi->header();
|
|
|
|
$template->process("bug/create/confirm-create-dupe.html.tmpl", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-25 07:59:35 +04:00
|
|
|
# do a match on the fields if applicable
|
|
|
|
|
2005-04-08 03:37:56 +04:00
|
|
|
&Bugzilla::User::match_field ($cgi, {
|
2002-10-25 07:59:35 +04:00
|
|
|
'cc' => { 'type' => 'multi' },
|
|
|
|
'assigned_to' => { 'type' => 'single' },
|
2005-02-25 20:10:33 +03:00
|
|
|
'qa_contact' => { 'type' => 'single' },
|
2006-08-04 01:52:28 +04:00
|
|
|
'^requestee_type-(\d+)$' => { 'type' => 'multi' },
|
2002-10-25 07:59:35 +04:00
|
|
|
});
|
2002-04-16 03:17:03 +04:00
|
|
|
|
|
|
|
# The format of the initial comment can be structured by adding fields to the
|
|
|
|
# enter_bug template and then referencing them in the comment template.
|
|
|
|
my $comment;
|
|
|
|
|
2005-08-25 18:02:41 +04:00
|
|
|
my $format = $template->get_format("bug/create/comment",
|
|
|
|
scalar($cgi->param('format')), "txt");
|
2002-04-29 02:05:31 +04:00
|
|
|
|
2002-09-18 03:28:24 +04:00
|
|
|
$template->process($format->{'template'}, $vars, \$comment)
|
2002-04-16 03:17:03 +04:00
|
|
|
|| ThrowTemplateError($template->error());
|
|
|
|
|
2005-02-24 19:30:40 +03:00
|
|
|
# Check that the product exists and that the user
|
2005-05-12 06:07:10 +04:00
|
|
|
# is allowed to enter bugs into this product.
|
2006-09-05 23:18:27 +04:00
|
|
|
my $product = Bugzilla::Bug->_check_product($cgi->param('product'));
|
2000-03-29 03:18:45 +04:00
|
|
|
|
2002-04-05 11:09:28 +04:00
|
|
|
# Set cookies
|
2005-04-08 03:59:59 +04:00
|
|
|
if (defined $cgi->param('product')) {
|
|
|
|
if (defined $cgi->param('version')) {
|
2006-05-29 21:24:54 +04:00
|
|
|
$cgi->send_cookie(-name => "VERSION-" . $product->name,
|
2003-05-05 05:15:38 +04:00
|
|
|
-value => $cgi->param('version'),
|
|
|
|
-expires => "Fri, 01-Jan-2038 00:00:00 GMT");
|
2002-04-05 11:09:28 +04:00
|
|
|
}
|
|
|
|
}
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2005-04-08 03:59:59 +04:00
|
|
|
if (defined $cgi->param('maketemplate')) {
|
2005-08-10 05:30:41 +04:00
|
|
|
$vars->{'url'} = $cgi->query_string();
|
2005-12-13 23:43:49 +03:00
|
|
|
$vars->{'short_desc'} = $cgi->param('short_desc');
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
print $cgi->header();
|
2002-04-24 11:24:50 +04:00
|
|
|
$template->process("bug/create/make-template.html.tmpl", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|
1998-09-16 01:49:26 +04:00
|
|
|
exit;
|
1998-08-26 10:14:20 +04:00
|
|
|
}
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
umask 0;
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2004-12-03 01:31:35 +03:00
|
|
|
# This has to go somewhere after 'maketemplate'
|
2006-08-20 03:21:44 +04:00
|
|
|
# or it breaks bookmarks with no comments.
|
2006-09-05 23:18:27 +04:00
|
|
|
$comment = Bugzilla::Bug->_check_comment($cgi->param('comment'));
|
2006-08-20 03:21:44 +04:00
|
|
|
# If comment is all whitespace, it'll be null at this point. That's
|
|
|
|
# OK except for the fact that it causes e-mail to be suppressed.
|
|
|
|
$comment = $comment ? $comment : " ";
|
2005-04-08 03:59:59 +04:00
|
|
|
|
2006-09-05 23:18:27 +04:00
|
|
|
my @keyword_ids = @{Bugzilla::Bug->_check_keywords($cgi->param('keywords'))};
|
2002-06-26 16:16:24 +04:00
|
|
|
|
2006-09-05 23:18:27 +04:00
|
|
|
my ($depends_on_ids, $blocks_ids) = Bugzilla::Bug->_check_dependencies(
|
2006-08-23 02:52:10 +04:00
|
|
|
scalar $cgi->param('dependson'), scalar $cgi->param('blocked'));
|
2002-10-17 08:31:56 +04:00
|
|
|
|
2005-02-08 19:51:03 +03:00
|
|
|
# get current time
|
2006-04-07 02:34:30 +04:00
|
|
|
my $timestamp = $dbh->selectrow_array(q{SELECT NOW()});
|
2005-02-08 19:51:03 +03:00
|
|
|
|
2002-04-05 11:09:28 +04:00
|
|
|
# Groups
|
2002-09-22 21:15:13 +04:00
|
|
|
my @groupstoadd = ();
|
2006-04-07 02:34:30 +04:00
|
|
|
my $sth_othercontrol = $dbh->prepare(q{SELECT othercontrol
|
|
|
|
FROM group_control_map
|
|
|
|
WHERE group_id = ?
|
|
|
|
AND product_id = ?});
|
|
|
|
|
2005-04-08 03:59:59 +04:00
|
|
|
foreach my $b (grep(/^bit-\d*$/, $cgi->param())) {
|
|
|
|
if ($cgi->param($b)) {
|
2000-03-08 01:22:55 +03:00
|
|
|
my $v = substr($b, 4);
|
2005-04-08 03:59:59 +04:00
|
|
|
detaint_natural($v)
|
2005-10-24 01:47:51 +04:00
|
|
|
|| ThrowUserError("invalid_group_ID");
|
2001-06-06 07:16:52 +04:00
|
|
|
if (!GroupIsActive($v)) {
|
|
|
|
# Prevent the user from adding the bug to an inactive group.
|
|
|
|
# Should only happen if there is a bug in Bugzilla or the user
|
|
|
|
# hacked the "enter bug" form since otherwise the UI
|
|
|
|
# for adding the bug to the group won't appear on that form.
|
2002-08-15 10:43:47 +04:00
|
|
|
$vars->{'bit'} = $v;
|
2005-03-05 03:18:48 +03:00
|
|
|
ThrowCodeError("inactive_group");
|
2001-06-06 07:16:52 +04:00
|
|
|
}
|
2005-08-19 00:09:37 +04:00
|
|
|
my ($permit) = $user->in_group_id($v);
|
2002-11-24 22:56:34 +03:00
|
|
|
if (!$permit) {
|
2006-04-07 02:34:30 +04:00
|
|
|
my $othercontrol = $dbh->selectrow_array($sth_othercontrol,
|
2006-05-29 21:24:54 +04:00
|
|
|
undef, ($v, $product->id));
|
2002-11-24 22:56:34 +03:00
|
|
|
$permit = (($othercontrol == CONTROLMAPSHOWN)
|
|
|
|
|| ($othercontrol == CONTROLMAPDEFAULT));
|
|
|
|
}
|
|
|
|
if ($permit) {
|
2002-09-22 21:15:13 +04:00
|
|
|
push(@groupstoadd, $v)
|
|
|
|
}
|
2000-03-08 01:22:55 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-07 02:34:30 +04:00
|
|
|
my $groups = $dbh->selectall_arrayref(q{
|
|
|
|
SELECT DISTINCT groups.id, groups.name, membercontrol,
|
|
|
|
othercontrol, description
|
|
|
|
FROM groups
|
|
|
|
LEFT JOIN group_control_map
|
|
|
|
ON group_id = id
|
|
|
|
AND product_id = ?
|
|
|
|
WHERE isbuggroup != 0
|
|
|
|
AND isactive != 0
|
2006-05-29 21:24:54 +04:00
|
|
|
ORDER BY description}, undef, $product->id);
|
2006-04-07 02:34:30 +04:00
|
|
|
|
|
|
|
foreach my $group (@$groups) {
|
|
|
|
my ($id, $groupname, $membercontrol, $othercontrol) = @$group;
|
2002-11-24 22:56:34 +03:00
|
|
|
$membercontrol ||= 0;
|
|
|
|
$othercontrol ||= 0;
|
|
|
|
# Add groups required
|
|
|
|
if (($membercontrol == CONTROLMAPMANDATORY)
|
|
|
|
|| (($othercontrol == CONTROLMAPMANDATORY)
|
2006-09-04 20:21:49 +04:00
|
|
|
&& (!Bugzilla->user->in_group($groupname)))) {
|
2002-11-24 22:56:34 +03:00
|
|
|
# User had no option, bug needs to be in this group.
|
|
|
|
push(@groupstoadd, $id)
|
|
|
|
}
|
|
|
|
}
|
2002-04-24 01:33:46 +04:00
|
|
|
|
2006-09-04 20:19:07 +04:00
|
|
|
my @bug_fields = map {$_->name} Bugzilla->get_fields(
|
|
|
|
{ custom => 1, obsolete => 0, enter_bug => 1});
|
|
|
|
push(@bug_fields, qw(
|
|
|
|
product
|
|
|
|
component
|
|
|
|
|
|
|
|
assigned_to
|
|
|
|
qa_contact
|
|
|
|
|
|
|
|
alias
|
|
|
|
bug_file_loc
|
|
|
|
bug_severity
|
|
|
|
bug_status
|
|
|
|
short_desc
|
|
|
|
op_sys
|
|
|
|
priority
|
|
|
|
rep_platform
|
|
|
|
version
|
|
|
|
target_milestone
|
|
|
|
status_whiteboard
|
|
|
|
|
|
|
|
estimated_time
|
|
|
|
deadline
|
|
|
|
));
|
|
|
|
my %bug_params;
|
|
|
|
foreach my $field (@bug_fields) {
|
|
|
|
$bug_params{$field} = $cgi->param($field);
|
|
|
|
}
|
|
|
|
$bug_params{'creation_ts'} = $timestamp;
|
2006-09-09 02:01:27 +04:00
|
|
|
$bug_params{'cc'} = [$cgi->param('cc')];
|
2006-09-04 20:19:07 +04:00
|
|
|
|
2002-04-05 11:09:28 +04:00
|
|
|
# Add the bug report to the DB.
|
2005-07-08 09:35:21 +04:00
|
|
|
$dbh->bz_lock_tables('bugs WRITE', 'bug_group_map WRITE', 'longdescs WRITE',
|
|
|
|
'cc WRITE', 'keywords WRITE', 'dependencies WRITE',
|
2005-08-30 20:04:39 +04:00
|
|
|
'bugs_activity WRITE', 'groups READ',
|
|
|
|
'user_group_map READ', 'group_group_map READ',
|
2006-09-04 20:19:07 +04:00
|
|
|
'keyworddefs READ', 'fielddefs READ',
|
|
|
|
'products READ', 'versions READ', 'milestones READ',
|
|
|
|
'components READ', 'profiles READ', 'bug_severity READ',
|
2006-09-09 02:01:27 +04:00
|
|
|
'op_sys READ', 'priority READ', 'rep_platform READ',
|
|
|
|
'group_control_map READ');
|
2005-07-08 09:35:21 +04:00
|
|
|
|
2006-09-04 20:19:07 +04:00
|
|
|
my $bug = Bugzilla::Bug->create(\%bug_params);
|
2000-03-08 01:22:55 +03:00
|
|
|
|
2002-04-05 11:09:28 +04:00
|
|
|
# Get the bug ID back.
|
2006-09-04 20:19:07 +04:00
|
|
|
my $id = $bug->bug_id;
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2002-09-22 21:15:13 +04:00
|
|
|
# Add the group restrictions
|
2006-04-07 02:34:30 +04:00
|
|
|
my $sth_addgroup = $dbh->prepare(q{
|
|
|
|
INSERT INTO bug_group_map (bug_id, group_id) VALUES (?, ?)});
|
2002-09-22 21:15:13 +04:00
|
|
|
foreach my $grouptoadd (@groupstoadd) {
|
2006-04-07 02:34:30 +04:00
|
|
|
$sth_addgroup->execute($id, $grouptoadd);
|
2002-09-22 21:15:13 +04:00
|
|
|
}
|
|
|
|
|
2005-01-07 23:25:20 +03:00
|
|
|
# Add the initial comment, allowing for the fact that it may be private
|
|
|
|
my $privacy = 0;
|
2006-07-04 01:26:22 +04:00
|
|
|
if (Bugzilla->params->{"insidergroup"}
|
2006-09-04 20:21:49 +04:00
|
|
|
&& Bugzilla->user->in_group(Bugzilla->params->{"insidergroup"}))
|
2006-07-04 01:26:22 +04:00
|
|
|
{
|
2005-04-08 03:59:59 +04:00
|
|
|
$privacy = $cgi->param('commentprivacy') ? 1 : 0;
|
2005-01-07 23:25:20 +03:00
|
|
|
}
|
|
|
|
|
2006-04-07 02:34:30 +04:00
|
|
|
trick_taint($comment);
|
|
|
|
$dbh->do(q{INSERT INTO longdescs (bug_id, who, bug_when, thetext,isprivate)
|
|
|
|
VALUES (?, ?, ?, ?, ?)}, undef, ($id, $user->id, $timestamp,
|
|
|
|
$comment, $privacy));
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2002-10-17 08:31:56 +04:00
|
|
|
my @all_deps;
|
2006-04-07 02:34:30 +04:00
|
|
|
my $sth_addkeyword = $dbh->prepare(q{
|
|
|
|
INSERT INTO keywords (bug_id, keywordid) VALUES (?, ?)});
|
2006-09-04 20:21:49 +04:00
|
|
|
if (Bugzilla->user->in_group("editbugs")) {
|
2006-08-21 22:53:16 +04:00
|
|
|
foreach my $keyword (@keyword_ids) {
|
2006-04-07 02:34:30 +04:00
|
|
|
$sth_addkeyword->execute($id, $keyword);
|
2002-09-14 02:21:19 +04:00
|
|
|
}
|
2006-08-21 22:53:16 +04:00
|
|
|
if (@keyword_ids) {
|
2002-11-20 02:35:53 +03:00
|
|
|
# Make sure that we have the correct case for the kw
|
2006-08-21 22:53:16 +04:00
|
|
|
my $kw_ids = join(', ', @keyword_ids);
|
2006-04-08 14:56:55 +04:00
|
|
|
my $list = $dbh->selectcol_arrayref(qq{
|
2006-04-07 02:34:30 +04:00
|
|
|
SELECT name
|
|
|
|
FROM keyworddefs
|
2006-07-03 13:31:15 +04:00
|
|
|
WHERE id IN ($kw_ids)
|
|
|
|
ORDER BY name});
|
2006-04-07 02:34:30 +04:00
|
|
|
my $kw_list = join(', ', @$list);
|
|
|
|
$dbh->do(q{UPDATE bugs
|
|
|
|
SET delta_ts = ?, keywords = ?
|
|
|
|
WHERE bug_id = ?}, undef, ($timestamp, $kw_list, $id));
|
2002-11-20 02:35:53 +03:00
|
|
|
}
|
2005-07-07 18:17:18 +04:00
|
|
|
if ($cgi->param('dependson') || $cgi->param('blocked')) {
|
2006-08-23 02:52:10 +04:00
|
|
|
my %deps = (dependson => $depends_on_ids, blocked => $blocks_ids);
|
2005-07-07 18:17:18 +04:00
|
|
|
foreach my $pair (["blocked", "dependson"], ["dependson", "blocked"]) {
|
|
|
|
my ($me, $target) = @{$pair};
|
2006-04-07 02:34:30 +04:00
|
|
|
my $sth_dep = $dbh->prepare(qq{
|
|
|
|
INSERT INTO dependencies ($me, $target) VALUES (?, ?)});
|
2002-10-17 08:31:56 +04:00
|
|
|
foreach my $i (@{$deps{$target}}) {
|
2006-04-07 02:34:30 +04:00
|
|
|
$sth_dep->execute($id, $i);
|
2002-10-17 08:31:56 +04:00
|
|
|
push(@all_deps, $i); # list for mailing dependent bugs
|
|
|
|
# Log the activity for the other bug:
|
2003-06-03 13:48:15 +04:00
|
|
|
LogActivityEntry($i, $me, "", $id, $user->id, $timestamp);
|
2002-10-17 08:31:56 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-09-14 02:21:19 +04:00
|
|
|
}
|
|
|
|
|
2005-07-08 09:35:21 +04:00
|
|
|
# All fields related to the newly created bug are set.
|
|
|
|
# The bug can now be made accessible.
|
|
|
|
$dbh->do("UPDATE bugs SET creation_ts = ? WHERE bug_id = ?",
|
|
|
|
undef, ($timestamp, $id));
|
|
|
|
|
|
|
|
$dbh->bz_unlock_tables();
|
|
|
|
|
2006-08-12 03:45:08 +04:00
|
|
|
# We don't have to check if the user can see the bug, because a user filing
|
|
|
|
# a bug can always see it. You can't change reporter_accessible until
|
|
|
|
# after the bug is filed.
|
2006-07-25 03:24:34 +04:00
|
|
|
|
2006-06-18 03:24:36 +04:00
|
|
|
# Add an attachment if requested.
|
|
|
|
if (defined($cgi->upload('data')) || $cgi->param('attachurl')) {
|
|
|
|
$cgi->param('isprivate', $cgi->param('commentprivacy'));
|
|
|
|
Bugzilla::Attachment->insert_attachment_for_bug(!THROW_ERROR,
|
2006-07-25 03:24:34 +04:00
|
|
|
$bug, $user, $timestamp,
|
2006-06-18 03:24:36 +04:00
|
|
|
\$vars)
|
|
|
|
|| ($vars->{'message'} = 'attachment_creation_failed');
|
|
|
|
|
|
|
|
# Determine if Patch Viewer is installed, for Diff link
|
|
|
|
eval {
|
|
|
|
require PatchReader;
|
|
|
|
$vars->{'patchviewerinstalled'} = 1;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2006-07-25 03:24:34 +04:00
|
|
|
# Add flags, if any. To avoid dying if something goes wrong
|
|
|
|
# while processing flags, we will eval() flag validation.
|
2006-08-19 21:20:25 +04:00
|
|
|
# This requires errors to die().
|
2006-07-25 03:24:34 +04:00
|
|
|
# XXX: this can go away as soon as flag validation is able to
|
|
|
|
# fail without dying.
|
2006-08-19 21:20:25 +04:00
|
|
|
my $error_mode_cache = Bugzilla->error_mode;
|
|
|
|
Bugzilla->error_mode(ERROR_MODE_DIE);
|
2006-07-25 03:24:34 +04:00
|
|
|
eval {
|
2006-08-24 19:56:39 +04:00
|
|
|
Bugzilla::Flag::validate($cgi, $id);
|
2006-07-25 03:24:34 +04:00
|
|
|
Bugzilla::Flag::process($bug, undef, $timestamp, $cgi);
|
|
|
|
};
|
2006-08-19 21:20:25 +04:00
|
|
|
Bugzilla->error_mode($error_mode_cache);
|
2006-07-25 03:24:34 +04:00
|
|
|
if ($@) {
|
|
|
|
$vars->{'message'} = 'flag_creation_failed';
|
|
|
|
$vars->{'flag_creation_error'} = $@;
|
|
|
|
}
|
|
|
|
|
2003-02-10 01:04:25 +03:00
|
|
|
# Email everyone the details of the new bug
|
2005-10-31 00:31:29 +03:00
|
|
|
$vars->{'mailrecipients'} = {'changer' => $user->login};
|
2002-04-14 08:43:55 +04:00
|
|
|
|
2002-05-01 23:00:51 +04:00
|
|
|
$vars->{'id'} = $id;
|
2002-11-28 13:49:58 +03:00
|
|
|
$vars->{'bug'} = $bug;
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2003-09-14 10:05:23 +04:00
|
|
|
ThrowCodeError("bug_error", { bug => $bug }) if $bug->error;
|
2002-11-28 13:49:58 +03:00
|
|
|
|
|
|
|
$vars->{'sentmail'} = [];
|
|
|
|
|
|
|
|
push (@{$vars->{'sentmail'}}, { type => 'created',
|
|
|
|
id => $id,
|
|
|
|
});
|
2002-05-01 23:00:51 +04:00
|
|
|
|
2002-10-17 08:31:56 +04:00
|
|
|
foreach my $i (@all_deps) {
|
2003-02-10 01:04:25 +03:00
|
|
|
push (@{$vars->{'sentmail'}}, { type => 'dep', id => $i, });
|
2002-11-28 13:49:58 +03:00
|
|
|
}
|
2002-10-17 08:31:56 +04:00
|
|
|
|
2002-11-28 13:49:58 +03:00
|
|
|
my @bug_list;
|
2004-07-21 01:12:33 +04:00
|
|
|
if ($cgi->cookie("BUGLIST")) {
|
|
|
|
@bug_list = split(/:/, $cgi->cookie("BUGLIST"));
|
2002-10-17 08:31:56 +04:00
|
|
|
}
|
2002-11-28 13:49:58 +03:00
|
|
|
$vars->{'bug_list'} = \@bug_list;
|
2006-03-09 03:09:00 +03:00
|
|
|
$vars->{'use_keywords'} = 1 if Bugzilla::Keyword::keyword_count();
|
2002-11-28 13:49:58 +03:00
|
|
|
|
2006-06-05 14:58:38 +04:00
|
|
|
if ($token) {
|
|
|
|
trick_taint($token);
|
|
|
|
$dbh->do('UPDATE tokens SET eventdata = ? WHERE token = ?', undef,
|
|
|
|
("createbug:$id", $token));
|
|
|
|
}
|
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
print $cgi->header();
|
2002-11-28 13:49:58 +03:00
|
|
|
$template->process("bug/create/created.html.tmpl", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|
2002-10-17 08:31:56 +04:00
|
|
|
|
2002-05-01 23:00:51 +04:00
|
|
|
|