summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-11-23 19:56:10 +0100
committerlpsolit%gmail.com <>2005-11-23 19:56:10 +0100
commit4b61c038bb255086cf273ff3faa1b2d89c220212 (patch)
tree3fe771b3aaac9bfa5502cfd983460c3f46dfc3f9 /Bugzilla
parent1ec20babb683eb7fd7c0768bf3e616aac277a4a3 (diff)
downloadbugzilla-4b61c038bb255086cf273ff3faa1b2d89c220212.tar.gz
bugzilla-4b61c038bb255086cf273ff3faa1b2d89c220212.tar.xz
Bug 315339: User::match_field() now leaves fields undefined instead of as empty strings when no value is passed (for type eq "single" only) - My previous patch was buggy as fields accepting only one user and those accepting several users must be considered differently. Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/User.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 88a7f0e49..0cca45682 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -955,10 +955,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 = ();
@@ -1044,10 +1047,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;