Fix input_params

hinted-selects
Vitaliy Filippov 2014-07-30 19:13:58 +04:00
parent cb58d0da87
commit af5945dfd1
8 changed files with 31 additions and 20 deletions

View File

@ -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}}

View File

@ -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');
}

View File

@ -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

View File

@ -50,7 +50,7 @@
<!ELEMENT remaining_time (#PCDATA)>
<!ELEMENT actual_time (#PCDATA)>
<!ELEMENT deadline (#PCDATA)>
<!ELEMENT long_desc (who, bug_when, work_time?, thetext)>
<!ELEMENT long_desc (who, type?, bug_when, work_time?, thetext)>
<!ATTLIST long_desc
encoding (base64) #IMPLIED
isprivate (0|1) #IMPLIED

View File

@ -1,5 +1,6 @@
#!/usr/bin/perl
# CustIS Bug 61728 - external SQL interface to Bugzilla's bug tables
# FIXME: Add UI for managing views
package FlushViews;

View File

@ -433,7 +433,7 @@ my %was_known_as_id = ();
my %depends_to_import = ();
sub process_bug {
my ( $twig, $bug ) = @_;
my ($twig, $bug_xml) = @_;
my $root = $twig->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 <bug> 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 <bug> 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'},

View File

@ -70,6 +70,9 @@
[% NEXT IF c.is_private && !user.is_insider %]
<long_desc isprivate="[% c.is_private | xml %]">
<commentid>[% c.id | xml %]</commentid>
[% IF c.type %]
<type>[% c.type | xml %]</type>
[% END %]
[% IF c.is_about_attachment %]
<attachid>[% c.extra_data | xml %]</attachid>
[% END %]

View File

@ -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 %]