summaryrefslogtreecommitdiffstats
path: root/post_bug.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-xpost_bug.cgi20
1 files changed, 14 insertions, 6 deletions
diff --git a/post_bug.cgi b/post_bug.cgi
index 78a18e759..a01cd11fb 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -125,6 +125,18 @@ foreach my $field (@multi_selects) {
$bug_params{$field->name} = [$cgi->param($field->name)];
}
+
+my $product = Bugzilla::Product->check($bug_params{'product'});
+my $component_id = Bugzilla::Component->check({
+ product => $product,
+ name => $bug_params{'component'}})->id;
+
+# Set bug flags.
+my (undef, $flag_data) = Bugzilla::Flag->extract_flags_from_cgi($vars, SKIP_REQUESTEE_ON_ERROR,{
+ product_id => $product->id,
+ component_id => $component_id });
+$bug_params{flags} = $flag_data;
+
my $bug = Bugzilla::Bug->create(\%bug_params);
# Get the bug ID back and delete the token used to create this bug.
@@ -180,7 +192,8 @@ if ($data_fh || $attach_text) {
if ($attachment) {
# Set attachment flags.
my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi(
- $bug, $attachment, $vars, SKIP_REQUESTEE_ON_ERROR);
+ $vars, SKIP_REQUESTEE_ON_ERROR,
+ { bug => $bug, attachment => $attachment });
$attachment->set_flags($flags, $new_flags);
$attachment->update($timestamp);
my $comment = $bug->comments->[0];
@@ -193,11 +206,6 @@ if ($data_fh || $attach_text) {
}
}
-# Set bug flags.
-my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi($bug, undef, $vars,
- SKIP_REQUESTEE_ON_ERROR);
-$bug->set_flags($flags, $new_flags);
-$bug->update($timestamp);
$vars->{'id'} = $id;
$vars->{'bug'} = $bug;