Check correct voting in ballot.

It's possible that ballots get mixed up when
a voter is participating in more than one
voting and sending the ballots manually (by
copying and pasting them into his mail client).

UseVote could - and should! - check that the
ballot belongs to the current voting by comparing
the ballot introduction ("WAHLSCHEIN fuer ...")
with the votename and throw an error if they
don't match.

* Add ballotintro (default: WAHLSCHEIN fuer) and
  tpl_wrong_voting (default: wrong-voting) to
  usevote.cfg
* Add messages to messages.cfg
* Modify ballot and ballot-personal templates
  accordingly
* Add check to uvvote.pl
* Add error handling to UVmenu.pm
* Change UVmenu::menu call in uvcfv.pl due
  to new parameter ($voting)

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2012-01-09 02:39:57 +01:00
parent fb9d3eb071
commit b9f5201405
8 changed files with 56 additions and 7 deletions

View file

@ -17,7 +17,8 @@ $VERSION = "0.4";
##############################################################################
# Menu for interaction with the votetaker #
# Parameters: votes list and header (references to arrays) #
# Body, Mailadress, Name, Ballot ID (references to strings) #
# Body, Mailadress, Name, Ballot ID, #
# Voting (references to strings) #
# List of newly set fields (reference to array) #
# List of errors to correct (Array-Ref) #
# Return Values: 'w': proceed #
@ -25,7 +26,7 @@ $VERSION = "0.4";
##############################################################################
sub menu {
my ($votes, $header, $body, $addr, $name, $ballot_id, $set, $errors) = @_;
my ($votes, $header, $body, $addr, $name, $ballot_id, $voting, $set, $errors) = @_;
my $input = "";
my $voter_addr = $$addr || '';
my $voter_name = $$name || '';
@ -79,6 +80,7 @@ sub menu {
print "(5) ", UVmessage::get("MENU_BALLOT_ID"), " [$$ballot_id]\n"
if ($config{personal});
print "(6) ", UVmessage::get("MENU_BDSG"), "\n" if ($config{bdsg});
print "(7) ", UVmessage::get("MENU_VOTING"), " [", $$voting, "]\n";
}
print "\n",
@ -269,6 +271,22 @@ sub menu {
$errors{InvalidBDSG} = UVmessage::get("MENU_INVALIDBDSG");
}
} elsif ($input eq '7') {
my $sel;
do {
print "[a] ", UVmessage::get("MENU_VOTING_CORRECT"), "\n",
"[b] ", UVmessage::get("MENU_VOTING_WRONG"), "\n\n",
UVmessage::get("MENU_PROMPT");
$sel = <STDIN>;
} until ($sel =~ /^[ab]$/i);
if ($sel =~ /^a$/i) {
delete $errors{NoVoting};
delete $errors{WrongVoting};
} else {
$errors{WrongVoting} = UVmessage::get("MENU_WRONGVOTING");
}
} elsif ($input =~ /^i$/i) {
my $ignore = UVmessage::get("MENU_IGNORE_STRING");
# Set columns for Text::Wrap