]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 384009: Global fields (priority, severity, OS, and platform) are required when...
authorlpsolit%gmail.com <>
Tue, 12 Feb 2008 07:35:12 +0000 (07:35 +0000)
committerlpsolit%gmail.com <>
Tue, 12 Feb 2008 07:35:12 +0000 (07:35 +0000)
Bugzilla/Bug.pm
Bugzilla/WebService/Bug.pm
email_in.pl

index 1c3dc99aee3d22d604e21480ea42988f1da542d7..80026000d2fb6c357e1d90e7bc8c63e654aa7c61 100755 (executable)
@@ -99,13 +99,8 @@ sub DB_COLUMNS {
 }
 
 use constant REQUIRED_CREATE_FIELDS => qw(
-    bug_severity
-    comment
     component
-    op_sys
-    priority
     product
-    rep_platform
     short_desc
     version
 );
@@ -245,11 +240,23 @@ sub new {
 # C<deadline>       - For time-tracking. Will be ignored for the same
 #                     reasons as C<estimated_time>.
 sub create {
-    my $class  = shift;
+    my ($class, $params) = @_;
     my $dbh = Bugzilla->dbh;
 
-    $class->check_required_create_fields(@_);
-    my $params = $class->run_create_validators(@_);
+    # These fields have default values which we can use if they are undefined.
+    $params->{bug_severity} = Bugzilla->params->{defaultseverity}
+      unless defined $params->{bug_severity};
+    $params->{priority} = Bugzilla->params->{defaultpriority}
+      unless defined $params->{priority};
+    $params->{op_sys} = Bugzilla->params->{defaultopsys}
+      unless defined $params->{op_sys};
+    $params->{rep_platform} = Bugzilla->params->{defaultplatform}
+      unless defined $params->{rep_platform};
+    # Make sure a comment is always defined.
+    $params->{comment} = '' unless defined $params->{comment};
+
+    $class->check_required_create_fields($params);
+    $params = $class->run_create_validators($params);
 
     # These are not a fields in the bugs table, so we don't pass them to
     # insert_create_data.
index ba1c01e98910f881037e2a8dbbc5681fb099e02e..0313d76d5fac5c793ef61c03a0802c7cd82fda0f 100755 (executable)
@@ -116,11 +116,6 @@ sub create {
         $field_values{$field_name} = $params->{$field}; 
     }
 
-    # Make sure all the required fields are in the hash.
-    foreach my $field (Bugzilla::Bug::REQUIRED_CREATE_FIELDS) {
-        $field_values{$field} = undef unless exists $field_values{$field};
-    }
-
     # WebService users can't set the creation date of a bug.
     delete $field_values{'creation_ts'};
 
@@ -462,6 +457,15 @@ in them. The error message will have more details.
 
 =back
 
+=item B<History>
+
+=over
+
+=item Before B<3.0.4>, parameters marked as B<Defaulted> were actually
+B<Required>, due to a bug in Bugzilla.
+
+=back
+
 =back
 
 
index b0895bda9b5949d9841e9c48b461ced63609a5af..5fd28337e5d5647df950b9e18eb2a90600a46e42 100644 (file)
@@ -54,25 +54,6 @@ use Bugzilla::Util;
 # in a message. RFC-compliant mailers use this.
 use constant SIGNATURE_DELIMITER => '-- ';
 
-# These fields must all be defined or post_bug complains. They don't have
-# to have values--they just have to be defined. There's not yet any
-# way to require custom fields have values, for enter_bug, so we don't
-# have to worry about those yet.
-use constant REQUIRED_ENTRY_FIELDS => qw(
-    reporter
-    short_desc
-    product
-    component
-    version
-
-    assigned_to
-    rep_platform
-    op_sys
-    priority
-    bug_severity
-    bug_file_loc
-);
-
 # Fields that must be defined during process_bug. They *do* have to
 # have values. The script will grab their values from the current
 # bug object, if they're not specified.
@@ -179,15 +160,6 @@ sub post_bug {
 
     debug_print('Posting a new bug...');
 
-    $fields{'rep_platform'} ||= Bugzilla->params->{'defaultplatform'};
-    $fields{'op_sys'}   ||= Bugzilla->params->{'defaultopsys'};
-    $fields{'priority'} ||= Bugzilla->params->{'defaultpriority'};
-    $fields{'bug_severity'} ||= Bugzilla->params->{'defaultseverity'};
-
-    foreach my $field (REQUIRED_ENTRY_FIELDS) {
-        $fields{$field} ||= '';
-    }
-
     my $cgi = Bugzilla->cgi;
     foreach my $field (keys %fields) {
         $cgi->param(-name => $field, -value => $fields{$field});