From af5945dfd1c859d874880a73ed18b75b46d9454a Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 30 Jul 2014 19:13:58 +0400 Subject: [PATCH] Fix input_params --- Bugzilla.pm | 10 +++++-- Bugzilla/Bug.pm | 2 +- Bugzilla/User.pm | 1 + bugzilla.dtd | 2 +- extensions/custis/lib/FlushViews.pm | 1 + importxml.pl | 30 +++++++++---------- template/en/default/bug/show.xml.tmpl | 3 ++ .../en/default/global/user-error.html.tmpl | 2 +- 8 files changed, 31 insertions(+), 20 deletions(-) diff --git a/Bugzilla.pm b/Bugzilla.pm index 021d00176..be902898c 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -491,8 +491,13 @@ sub input_params } return $cache->{input_params} if defined $cache->{input_params}; - # Throw away the tie. - $cache->{input_params} = { %{ $class->cgi->Vars } }; + $cache->{input_params} = {}; + my $cgi = $class->cgi; + for ($cgi->param) + { + my @v = $cgi->param($_); + $cache->{input_params}->{$_} = @v <= 1 ? $v[0] : \@v; + } return $cache->{input_params}; } @@ -998,6 +1003,7 @@ sub fieldvaluecontrol ); for (@$rows) { + next if !defined $_->{default_field_id}; # FIXME: means field_defaults table has inconsistent data $has->{$_->{default_field_id}} ->{defaults} ->{$_->{field_id}} diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 5c34f13f5..7665d2d2d 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1808,7 +1808,7 @@ sub _set_alias return $self->{alias} = undef if !$alias; # Make sure the alias isn't too long. - if (length($alias) > 20) + if (length($alias) > 255) { ThrowUserError('alias_too_long'); } diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index ba0abee64..ca8859706 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -57,6 +57,7 @@ use Scalar::Util qw(blessed); use Storable qw(dclone); use base qw(Bugzilla::Object Exporter); +# FIXME Remove procedural APIs @Bugzilla::User::EXPORT = qw(is_available_username login_to_id user_id_to_login validate_password USER_MATCH_MULTIPLE USER_MATCH_FAILED USER_MATCH_SUCCESS diff --git a/bugzilla.dtd b/bugzilla.dtd index 7633222e2..fb5013ae5 100644 --- a/bugzilla.dtd +++ b/bugzilla.dtd @@ -50,7 +50,7 @@ - + root; my $maintainer = $root->{'att'}->{'maintainer'}; my $exporter_login = $root->{'att'}->{'exporter'}; @@ -443,16 +443,16 @@ sub process_bug { # We will store output information in this variable. my $log = ""; - if ( defined $bug->{'att'}->{'error'} ) { - $log .= "\nError in bug " . $bug->field('bug_id') . "\@$urlbase: "; - $log .= $bug->{'att'}->{'error'} . "\n"; - if ( $bug->{'att'}->{'error'} =~ /NotFound/ ) { - $log .= "$exporter_login tried to move bug " . $bug->field('bug_id'); + if ( defined $bug_xml->{'att'}->{'error'} ) { + $log .= "\nError in bug " . $bug_xml->field('bug_id') . "\@$urlbase: "; + $log .= $bug_xml->{'att'}->{'error'} . "\n"; + if ( $bug_xml->{'att'}->{'error'} =~ /NotFound/ ) { + $log .= "$exporter_login tried to move bug " . $bug_xml->field('bug_id'); $log .= " here, but $urlbase reports that this bug"; $log .= " does not exist.\n"; } - elsif ( $bug->{'att'}->{'error'} =~ /NotPermitted/ ) { - $log .= "$exporter_login tried to move bug " . $bug->field('bug_id'); + elsif ( $bug_xml->{'att'}->{'error'} =~ /NotPermitted/ ) { + $log .= "$exporter_login tried to move bug " . $bug_xml->field('bug_id'); $log .= " here, but $urlbase reports that $exporter_login does "; $log .= " not have access to that bug.\n"; } @@ -472,10 +472,10 @@ sub process_bug { my %bug_fields; my $err = ""; - # Loop through all the xml tags inside a and compare them to the - # lists of fields. If they match throw them into the hash. Otherwise - # append it to the log, which will go into the comments when we are done. - foreach my $bugchild ( $bug->children() ) { + # Loop through all the xml tags inside a and compare them to the + # lists of fields. If they match throw them into the hash. Otherwise + # append it to the log, which will go into the comments when we are done. + foreach my $bugchild ( $bug_xml->children() ) { Debug( "Parsing field: " . $bugchild->name, DEBUG_LEVEL ); # Skip the token if one is included. We don't want it included in @@ -483,7 +483,7 @@ sub process_bug { next if $bugchild->name eq 'token'; if ( defined $all_fields{ $bugchild->name } ) { - my @values = $bug->children_text($bugchild->name); + my @values = $bug_xml->children_text($bugchild->name); if (scalar @values > 1) { $bug_fields{$bugchild->name} = \@values; } @@ -514,7 +514,7 @@ sub process_bug { my $private = 0; # Parse long descriptions - foreach my $comment ( $bug->children('long_desc') ) { + foreach my $comment ($bug_xml->children('long_desc')) { Debug( "Parsing Long Description", DEBUG_LEVEL ); my %long_desc; $long_desc{'who'} = $comment->field('who'); @@ -1190,7 +1190,7 @@ sub process_bug { } # Parse bug flags - foreach my $bflag ( $bug->children('flag')) { + foreach my $bflag ($bug_xml->children('flag')) { next unless ( defined($bflag) ); $err .= flag_handler( $bflag->{'att'}->{'name'}, $bflag->{'att'}->{'status'}, diff --git a/template/en/default/bug/show.xml.tmpl b/template/en/default/bug/show.xml.tmpl index cc36003a2..7c81adaa6 100644 --- a/template/en/default/bug/show.xml.tmpl +++ b/template/en/default/bug/show.xml.tmpl @@ -70,6 +70,9 @@ [% NEXT IF c.is_private && !user.is_insider %] [% c.id | xml %] + [% IF c.type %] + [% c.type | xml %] + [% END %] [% IF c.is_about_attachment %] [% c.extra_data | xml %] [% END %] diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 2a79561ac..32d846f84 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -133,7 +133,7 @@ [% BLOCK error_alias_too_long %] [% title = "Alias Too Long" %] - [% terms.Bug %] aliases cannot be longer than 20 characters. + [% terms.Bug %] aliases cannot be longer than 255 characters. Please choose a shorter alias. [% END %]