summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-03-20 21:57:18 +0100
committerDavid Lawrence <dkl@mozilla.com>2014-03-20 21:57:18 +0100
commit99457cc8631ec71dcacb4e79b1597c0f8b9abd25 (patch)
tree2886187dfe1f10b5cf210a798126d19fe024f73d
parent076af7dcd9541e0ff7b2e1895759cedf156a5c39 (diff)
downloadbugzilla-99457cc8631ec71dcacb4e79b1597c0f8b9abd25.tar.gz
bugzilla-99457cc8631ec71dcacb4e79b1597c0f8b9abd25.tar.xz
Bug 986124 - backport upstream bug 513212 to bmo/4.2 to add the ability to add see_also values in enter_bug.cgi and Bug.create
-rw-r--r--Bugzilla/Bug.pm20
-rw-r--r--Bugzilla/WebService/Bug.pm3
-rwxr-xr-xenter_bug.cgi1
-rwxr-xr-xpost_bug.cgi13
-rw-r--r--skins/standard/global.css2
-rw-r--r--template/en/default/bug/create/create.html.tmpl11
-rw-r--r--template/en/default/bug/field.html.tmpl33
7 files changed, 64 insertions, 19 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index a99dfaf85..f19803e1c 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -665,6 +665,7 @@ sub create {
my $blocked = delete $params->{blocked};
my $keywords = delete $params->{keywords};
my $creation_comment = delete $params->{comment};
+ my $see_also = delete $params->{see_also};
# We don't want the bug to appear in the system until it's correctly
# protected by groups.
@@ -727,6 +728,25 @@ sub create {
}
}
+ # Insert any see_also values
+ if ($see_also) {
+ my $see_also_array = $see_also;
+ if (!ref $see_also_array) {
+ $see_also = trim($see_also);
+ $see_also_array = [ split(/[\s,]+/, $see_also) ];
+ }
+ foreach my $value (@$see_also_array) {
+ $bug->add_see_also($value);
+ }
+ foreach my $see_also (@{ $bug->see_also }) {
+ $see_also->insert_create_data($see_also);
+ }
+ foreach my $ref_bug (@{ $bug->{_update_ref_bugs} || [] }) {
+ $ref_bug->update();
+ }
+ delete $bug->{_update_ref_bugs};
+ }
+
# Comment #0 handling...
# We now have a bug id so we can fill this out
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 058d12ecd..80a055ae2 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -763,7 +763,8 @@ sub create {
$dbh->bz_commit_transaction();
- Bugzilla::BugMail::Send($bug->bug_id, { changer => $bug->reporter });
+ $bug->send_changes();
+
return { id => $self->type('int', $bug->bug_id) };
}
diff --git a/enter_bug.cgi b/enter_bug.cgi
index a7e76ba76..4866fdf28 100755
--- a/enter_bug.cgi
+++ b/enter_bug.cgi
@@ -314,6 +314,7 @@ else {
$vars->{'deadline'} = formvalue('deadline');
$vars->{'estimated_time'} = formvalue('estimated_time');
$vars->{'bug_ignored'} = formvalue('bug_ignored');
+ $vars->{'see_also'} = formvalue('see_also');
$vars->{'cc'} = join(', ', $cgi->param('cc'));
diff --git a/post_bug.cgi b/post_bug.cgi
index 7907d7037..a1ed77bac 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -43,6 +43,8 @@ use Bugzilla::Keyword;
use Bugzilla::Token;
use Bugzilla::Flag;
+use List::MoreUtils qw(uniq);
+
my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
@@ -128,7 +130,7 @@ push(@bug_fields, qw(
version
target_milestone
status_whiteboard
-
+ see_also
estimated_time
deadline
));
@@ -239,12 +241,21 @@ my $bug_sent = Bugzilla::BugMail::Send($id, $recipients);
$bug_sent->{type} = 'created';
$bug_sent->{id} = $id;
my @all_mail_results = ($bug_sent);
+
foreach my $dep (@{$bug->dependson || []}, @{$bug->blocked || []}) {
my $dep_sent = Bugzilla::BugMail::Send($dep, $recipients);
$dep_sent->{type} = 'dep';
$dep_sent->{id} = $dep;
push(@all_mail_results, $dep_sent);
}
+
+# Sending emails for any referenced bugs.
+foreach my $ref_bug_id (uniq @{ $bug->{see_also_changes} || [] }) {
+ my $ref_sent = Bugzilla::BugMail::Send($ref_bug_id, $recipients);
+ $ref_sent->{id} = $ref_bug_id;
+ push(@all_mail_results, $ref_sent);
+}
+
$vars->{sentmail} = \@all_mail_results;
$format = $template->get_format("bug/create/created",
diff --git a/skins/standard/global.css b/skins/standard/global.css
index 3eee10fab..63229886a 100644
--- a/skins/standard/global.css
+++ b/skins/standard/global.css
@@ -546,7 +546,7 @@ input.required, select.required, span.required_explanation {
}
.bug_urls {
- margin: 0 0 1em 0;
+ margin: 0;
padding: 0;
list-style-type: none;
}
diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl
index 02256721c..d1de42eb9 100644
--- a/template/en/default/bug/create/create.html.tmpl
+++ b/template/en/default/bug/create/create.html.tmpl
@@ -629,6 +629,17 @@ TUI_hide_default('attachment_text_field');
%]
</tr>
[% END %]
+
+ [% IF Param('use_see_also') %]
+ <tr>
+ [% INCLUDE bug/field.html.tmpl
+ bug = default
+ field = bug_fields.see_also
+ editable = 1
+ value = see_also
+ %]
+ </tr>
+ [% END %]
</tbody>
<tbody>
diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl
index 73131225d..1e80cf17a 100644
--- a/template/en/default/bug/field.html.tmpl
+++ b/template/en/default/bug/field.html.tmpl
@@ -204,32 +204,33 @@
true);
</script>
[% CASE constants.FIELD_TYPE_BUG_URLS %]
- [% '<ul class="bug_urls">' IF value.size %]
- [% FOREACH bug_url = value %]
- <li>
- [% PROCESS bug_url_link bug_url = bug_url %]
- <label><input type="checkbox" value="[% bug_url.name FILTER html %]"
- name="remove_[% field.name FILTER html %]">
- Remove</label>
- </li>
+ [% IF bug.id && value.size %]
+ <ul class="bug_urls">
+ [% FOREACH bug_url = value %]
+ <li>
+ [% PROCESS bug_url_link bug_url = bug_url %]
+ <label><input type="checkbox" value="[% bug_url.name FILTER html %]"
+ name="remove_[% field.name FILTER html %]">
+ Remove</label>
+ </li>
+ [% END %]
+ </ul>
[% END %]
- [% '</ul>' IF value.size %]
-
[% IF Param('use_see_also') %]
<span id="container_showhide_[% field.name FILTER html %]"
class="bz_default_hidden">
(<a href="#" id="showhide_[% field.name FILTER html %]">add</a>)
</span>
<div id="container_[% field.name FILTER html %]">
- <label for="[% field.name FILTER html %]">
- Add [% terms.Bug %] URLs:
- </label><br>
<input type="text" id="[% field.name FILTER html %]" size="40"
- class="text_input" name="[% field.name FILTER html %]">
+ class="text_input" name="[% field.name FILTER html %]"
+ [% IF !bug.id %]value="[% value FILTER html %]"[% END %]>
</div>
- <script type="text/javascript">
+ [% IF bug.id %]
+ <script type="text/javascript">
setupEditLink('[% field.name FILTER js %]');
- </script>
+ </script>
+ [% END %]
[% END %]
[% CASE constants.FIELD_TYPE_KEYWORDS %]
<div id="keyword_container">