]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 315339: User::match_field() now leaves fields undefined instead of as empty strin...
authorlpsolit%gmail.com <>
Wed, 23 Nov 2005 18:59:09 +0000 (18:59 +0000)
committerlpsolit%gmail.com <>
Wed, 23 Nov 2005 18:59:09 +0000 (18:59 +0000)
Bugzilla/User.pm

index 87b82171bd6423b4af2203cb8ddd92d85a4b59ac..681bd5f5fa9c9eac337cdcfaa8b6460eefa8f5c5 100644 (file)
@@ -858,10 +858,13 @@ sub match_field {
         # the field here, and not set it to '', so that we will add
         # things to an empty list, and not to a list containing one
         # empty string.
-        # If no match or more than one match is found for this field,
+        # If the field accepts only one match (type eq "single") and
+        # no match or more than one match is found for this field,
         # we will set it back to '' so that the field remains defined
         # outside this function (it was if we came here; else we would
-        # have returned ealier above).
+        # have returned earlier above).
+        # If the field accepts several matches (type eq "multi") and no match
+        # is found, we leave this field undefined (= empty array).
         $cgi->delete($field);
 
         my @queries = ();
@@ -947,10 +950,14 @@ sub match_field {
             }
         }
         # Above, we deleted the field before adding matches. If no match
-        # or more than one match has been found, we set it back to '' so
+        # or more than one match has been found for a field expecting only
+        # one match (type eq "single"), we set it back to '' so
         # that the caller of this function can still check whether this
         # field was defined or not (and it was if we came here).
-        $cgi->param($field, '') unless defined $cgi->param($field);
+        if (!defined $cgi->param($field)
+            && $fields->{$field}->{'type'} eq 'single') {
+            $cgi->param($field, '');
+        }
     }
 
     my $retval;