]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 344521: Make custom fields optionally functional on enter_bug.cgi
authormkanat%bugzilla.org <>
Wed, 19 Jul 2006 04:10:31 +0000 (04:10 +0000)
committermkanat%bugzilla.org <>
Wed, 19 Jul 2006 04:10:31 +0000 (04:10 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk

Bugzilla/DB/Schema.pm
Bugzilla/Field.pm
checksetup.pl
enter_bug.cgi
post_bug.cgi
template/en/default/bug/create/create.html.tmpl
template/en/default/bug/field.html.tmpl

index c885987bc6f67b4ce7d383b99bec60fba72b1532..94e457dd0906d727c593f627652d2cf118ce6b0d 100644 (file)
@@ -464,6 +464,8 @@ use constant ABSTRACT_SCHEMA => {
             sortkey     => {TYPE => 'INT2', NOTNULL => 1},
             obsolete    => {TYPE => 'BOOLEAN', NOTNULL => 1,
                             DEFAULT => 'FALSE'},
+            enter_bug   => {TYPE => 'BOOLEAN', NOTNULL => 1,
+                            DEFAULT => 'FALSE'},
         ],
         INDEXES => [
             fielddefs_name_idx    => {FIELDS => ['name'],
index 2118d41acad2fe2cd3818b3019be5e615cdbcc32..e964141d48b978d6e3686b004a7674264973dd9b 100644 (file)
@@ -82,7 +82,8 @@ use constant DB_COLUMNS => (
     'description',
     'type',
     'custom',
-    'obsolete'
+    'obsolete',
+    'enter_bug',
 );
 
 our $columns = join(", ", DB_COLUMNS);
@@ -182,6 +183,19 @@ a boolean specifying whether or not the field is obsolete;
 
 sub obsolete { return $_[0]->{obsolete} }
 
+=over
+
+=item C<enter_bug>
+
+A boolean specifying whether or not this field should appear on 
+enter_bug.cgi
+
+=back
+
+=cut
+
+sub enter_bug { return $_[0]->{enter_bug} }
+
 
 =pod
 
@@ -267,6 +281,9 @@ sub match {
     if (defined $criteria->{obsolete}) {
         push(@terms, "obsolete=" . ($criteria->{obsolete} ? "1" : "0"));
     }
+    if (defined $criteria->{enter_bug}) {
+        push(@terms, "enter_bug=" . ($criteria->{enter_bug} ? '1' : '0'));
+    }
     my $where = (scalar(@terms) > 0) ? "WHERE " . join(" AND ", @terms) : "";
   
     my $records = Bugzilla->dbh->selectall_arrayref(
index 71e43d281ad32f14830594d6bee155096705c4e2..d6a76a0a013ca068ade1d9488ea9b2bcaf4c982b 100755 (executable)
@@ -4246,6 +4246,9 @@ if (!$dbh->bz_column_info('classifications', 'sortkey')) {
     }
 }
 
+$dbh->bz_add_column('fielddefs', 'enter_bug',
+    {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'});
+
 # If you had to change the --TABLE-- definition in any way, then add your
 # differential change code *** A B O V E *** this comment.
 #
index 66f4109c73f769cae5e967b55831a950d0b65d05..70c989ecaeec999aeadf588217c8d7cf32841f23 100755 (executable)
@@ -336,6 +336,13 @@ $vars->{'cloned_bug_id'}         = $cloned_bug_id;
 
 $vars->{'token'}             = Bugzilla::Token::IssueSessionToken('createbug:');
 
+
+my @enter_bug_fields = Bugzilla->get_fields({ custom => 1, obsolete => 0, 
+                                              enter_bug => 1 });
+foreach my $field (@enter_bug_fields) {
+    $vars->{$field->name} = formvalue($field->name);
+}
+
 if ($cloned_bug_id) {
 
     $default{'component_'}    = $cloned_bug->{'component'};
@@ -357,6 +364,10 @@ if ($cloned_bug_id) {
         $vars->{'cc'}         = formvalue('cc');
     }
 
+    foreach my $field (@enter_bug_fields) {
+        $vars->{$field->name} = $cloned_bug->{$field->name};
+    }
+
 # We need to ensure that we respect the 'insider' status of
 # the first comment, if it has one. Either way, make a note
 # that this bug was cloned from another bug.
index b3f668e3ff9b45546af0be4f12e8b1018b06401c..083f577ac3270b35eb295d249792f6e407a50ce8 100755 (executable)
@@ -172,10 +172,15 @@ if (!UserInGroup("editbugs") || $cgi->param('assigned_to') eq "") {
                 -value => login_to_id(trim($cgi->param('assigned_to')), THROW_ERROR));
 }
 
+
+my @enter_bug_field_names = map {$_->name} Bugzilla->get_fields({ custom => 1,
+    obsolete => 0, enter_bug => 1});
+
 my @bug_fields = ("version", "rep_platform",
                   "bug_severity", "priority", "op_sys", "assigned_to",
                   "bug_status", "everconfirmed", "bug_file_loc", "short_desc",
-                  "target_milestone", "status_whiteboard");
+                  "target_milestone", "status_whiteboard",
+                  @enter_bug_field_names);
 
 if (Bugzilla->params->{"usebugaliases"}) {
    my $alias = trim($cgi->param('alias') || "");
index 1749813e3733b3bc9bebbd8b747463c25537f494..8b2bcb9972205f955f32b9301f2dadf1683eb533 100644 (file)
@@ -313,6 +313,15 @@ function handleWantsAttachment(wants_attachment) {
     </td>
   </tr>
 
+  [% USE Bugzilla %]
+  [% FOREACH field = Bugzilla.get_fields({ obsolete => 0, custom => 1, 
+                                           enter_bug => 1 }) %]
+    [% SET value = ${field.name} IF ${field.name}.defined %]
+    <tr>
+      [% PROCESS bug/field.html.tmpl editable=1 value_span=3 %]
+    </tr>
+  [% END %]
+
   <tr>
     <td align="right"><strong>Summary:</strong></td>
     <td colspan="3">
index 9c45b3e57ead074aaf2d13c7286e21fd9ef13291..ece2f64bfe9c6065a7a20a098d0b4706cf92384f 100644 (file)
@@ -25,6 +25,8 @@
   #   value: The value of the field for this bug.
   #   editable: Whether the field should be displayed as an editable
   #             <input> or as just the plain text of its value.
+  #   value_span: A colspan for the table cell containing
+  #               the field value.
   #%]
 
 <th class="field_label">
@@ -41,6 +43,7 @@
     [% CASE constants.FIELD_TYPE_FREETEXT %]
         <input name="[% field.name FILTER html %]"
                value="[% value FILTER html %]"
+               [% "colspan=\"$value_span\"" FILTER none IF value_span %]
                size="60">
   [% END %]
 [% ELSE %]