]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 513212 - Allow people to set "See Also" when filing/creating/entering a bug on...
authorDavid Lawrence <dkl@mozilla.com>
Thu, 20 Mar 2014 19:55:57 +0000 (19:55 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Thu, 20 Mar 2014 19:55:57 +0000 (19:55 +0000)
r/a=glob

Bugzilla/Bug.pm
Bugzilla/WebService/Bug.pm
enter_bug.cgi
post_bug.cgi
skins/standard/global.css
template/en/default/bug/create/create.html.tmpl
template/en/default/bug/field.html.tmpl

index f05533d258220e538ade4adce0f125fb797155f9..b53847790b2bca3618948fcc7d5121e92d16c06e 100644 (file)
@@ -652,6 +652,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.
@@ -715,6 +716,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
index 7c6547de91bbaaa59ac3488ca3a88cc6c0981b99..09f6e1adc36ba3f039eba2fbb4d13c33b660ac8d 100644 (file)
@@ -717,7 +717,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) };
 }
 
index da80e9d15b13d6baada1838c88f1dce807dead71..93997e665d02b0bdbfe8c39cd44c31dc0be6f5b7 100755 (executable)
@@ -262,6 +262,7 @@ else {
     $vars->{'blocked'}        = formvalue('blocked');
     $vars->{'deadline'}       = formvalue('deadline');
     $vars->{'estimated_time'} = formvalue('estimated_time');
+    $vars->{'see_also'}       = formvalue('see_also');
 
     $vars->{'cc'}             = join(', ', $cgi->param('cc'));
 
index 24fa331b48d38ace4f7c1984c41e6346c156d7fc..782bb22939f863f21e45b48eb0c8ab3027924cbf 100755 (executable)
@@ -22,6 +22,8 @@ use Bugzilla::Hook;
 use Bugzilla::Token;
 use Bugzilla::Flag;
 
+use List::MoreUtils qw(uniq);
+
 my $user = Bugzilla->login(LOGIN_REQUIRED);
 
 my $cgi = Bugzilla->cgi;
@@ -101,7 +103,7 @@ push(@bug_fields, qw(
     version
     target_milestone
     status_whiteboard
-
+    see_also
     estimated_time
     deadline
 ));
@@ -204,12 +206,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",
index ab8a44f60931304e108851d7b084c8e0acf49626..13949edc4d57e9fdd1f485ef303ce40051b13a5f 100644 (file)
@@ -638,7 +638,7 @@ input.required, select.required, span.required_explanation {
 }
 
 .bug_urls {
-    margin: 0 0 1em 0;
+    margin: 0;
     padding: 0;
     list-style-type: none;
 }
index 05f1396460a37a01ae44a34461a4d100ff1b80e4..d3f56d00c413075f7b7706d1d686e3d8ad3bb4a3 100644 (file)
@@ -625,6 +625,15 @@ TUI_hide_default('attachment_text_field');
       </td>
     </tr>
   [% END %]
+
+  <tr>
+    [% INCLUDE bug/field.html.tmpl
+       bug            = default
+       field          = bug_fields.see_also
+       editable       = 1
+       value          = see_also
+    %]
+  </tr>
 </tbody>
 
 <tbody class="expert_fields">
index f8612eebbf60c5dfbbeb7c885889c1d04ebbc8b1..b3b92e19828ae95e1d7cf84d632086c9d7cce903 100644 (file)
                            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 %]">
-             <strong>Add [% terms.Bug %] URLs:</strong>
-           </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="[% field.name FILTER html %]_container">