summaryrefslogtreecommitdiffstats
path: root/post_bug.cgi
diff options
context:
space:
mode:
authorgerv%gerv.net <>2002-09-14 07:21:16 +0200
committergerv%gerv.net <>2002-09-14 07:21:16 +0200
commit229bf2d0d7a6c7b48b25e4d9c08c038184340a8a (patch)
tree6b3bf85aa6fe3035a46044eb5047f4dda3a3e8eb /post_bug.cgi
parent2594a7d4e2a290c18184d72d63d4a96ef0d52ef1 (diff)
downloadbugzilla-229bf2d0d7a6c7b48b25e4d9c08c038184340a8a.tar.gz
bugzilla-229bf2d0d7a6c7b48b25e4d9c08c038184340a8a.tar.xz
Bug 25521 - Keyword field in new bug entry. Patch by jeff.hedlund@matrixsi.com; r=gerv.
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-xpost_bug.cgi28
1 files changed, 28 insertions, 0 deletions
diff --git a/post_bug.cgi b/post_bug.cgi
index b7fdf66d5..8d21f1505 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -220,6 +220,27 @@ if (defined $::FORM{'cc'}) {
}
}
}
+# Check for valid keywords and create list of keywords to be added to db
+# (validity routine copied from process_bug.cgi)
+my @keywordlist;
+my %keywordseen;
+
+if ($::FORM{'keywords'} && UserInGroup("editbugs")) {
+ foreach my $keyword (split(/[\s,]+/, $::FORM{'keywords'})) {
+ if ($keyword eq '') {
+ next;
+ }
+ my $i = GetKeywordIdFromName($keyword);
+ if (!$i) {
+ $vars->{'keyword'} = $keyword;
+ ThrowUserError("unknown_keyword");
+ }
+ if (!$keywordseen{$i}) {
+ push(@keywordlist, $i);
+ $keywordseen{$i} = 1;
+ }
+ }
+}
# Build up SQL string to add bug.
my $sql = "INSERT INTO bugs " .
@@ -281,6 +302,13 @@ foreach my $ccid (keys(%ccids)) {
SendSQL("INSERT INTO cc (bug_id, who) VALUES ($id, $ccid)");
}
+if (UserInGroup("editbugs")) {
+ foreach my $keyword (@keywordlist) {
+ SendSQL("INSERT INTO keywords (bug_id, keywordid)
+ VALUES ($id, $keyword)");
+ }
+}
+
SendSQL("UNLOCK TABLES") if Param("shadowdb");
# Assemble the -force* strings so this counts as "Added to this capacity"