Changeset 110
- Timestamp:
- 03/26/09 16:24:31 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Vote/Controller/Ballot.pm
r88 r110 82 82 $c->request->parameters->{fsbal} = $c->stash->{fsbal}; 83 83 84 my @sbalval = grep { $_ } map { $choices{$_}} $c->req->param('sbal');84 my @sbalval = grep { $_ } map { lc($choices{$_} || '') } $c->req->param('sbal'); 85 85 86 86 if (scalar(@sbalval) + scalar(@{$c->stash->{fsbal} || []}) … … 93 93 { 94 94 my %uniq; 95 $uniq{lc($_)} = 1 foreach(@sbalval, @{$c->stash->{fsbal} || []}); 96 if (scalar(keys %uniq) != scalar(@sbalval) + scalar(@{$c->stash->{fsbal} || []})) { 95 foreach(@sbalval, @{$c->stash->{fsbal} || []}) { 96 $uniq{lc($_)} ||= 0; # avoid undef 97 $uniq{lc($_)}++; 98 } 99 my @twices = grep { $uniq{$_} > 1 } (sort keys %uniq); 100 if (scalar(@twices)) { 97 101 $c->req->parameters->{'ballot'} = ''; 98 $c->stash->{vote_error} = 'Une valeur est en double'; 102 $c->stash->{vote_error} = 'Une ou plusieurs valeurs sont en double: ' . 103 join(' ,', map { qq'"$_"' } @twices); 99 104 return; 100 105 }
Note: See TracChangeset
for help on using the changeset viewer.