From 05fe02cdd0cf84e61df2f89afec751c279d30f35 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sun, 18 Jun 2006 06:24:34 +0000 Subject: Bug 5179: Need to be able to put attachment on new bug - Patch by Marc Schumann r=LpSolit a=justdave --- post_bug.cgi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'post_bug.cgi') diff --git a/post_bug.cgi b/post_bug.cgi index 5f3f91c3b..99b6e533b 100755 --- a/post_bug.cgi +++ b/post_bug.cgi @@ -22,12 +22,14 @@ # Dan Mosedale # Joe Robins # Gervase Markham +# Marc Schumann use strict; use lib qw(.); require "globals.pl"; use Bugzilla; +use Bugzilla::Attachment; use Bugzilla::Constants; use Bugzilla::Util; use Bugzilla::Bug; @@ -546,6 +548,21 @@ $dbh->do("UPDATE bugs SET creation_ts = ? WHERE bug_id = ?", $dbh->bz_unlock_tables(); +# 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, + $id, $user, $timestamp, + \$vars) + || ($vars->{'message'} = 'attachment_creation_failed'); + + # Determine if Patch Viewer is installed, for Diff link + eval { + require PatchReader; + $vars->{'patchviewerinstalled'} = 1; + }; +} + # Email everyone the details of the new bug $vars->{'mailrecipients'} = {'changer' => $user->login}; -- cgit v1.2.3-24-g4f1b