Ignore:
Timestamp:
03/15/09 16:28:12 (15 years ago)
Author:
nanardon
Message:
  • voting identifier is now the email
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Vote/Model/Vote.pm

    r33 r34  
    207207        select *, voting.key as vkey from voting left join signing 
    208208        on signing.key = voting.key 
    209         where poll = ? order by voting.id 
     209        where poll = ? order by voting.mail 
    210210        } 
    211211    ); 
     
    219219 
    220220sub vote_voting { 
    221     my ($self, $id) = @_; 
     221    my ($self, $voteid) = @_; 
    222222 
    223223    my $sth = $self->db->prepare_cached( 
    224224        q{ 
    225225        select key from voting 
    226         where poll = ? order by voting.id 
    227         } 
    228     ); 
    229     $sth->execute($id); 
     226        where poll = ? order by voting.mail 
     227        } 
     228    ); 
     229    $sth->execute($voteid); 
    230230    my @people; 
    231231    while (my $res = $sth->fetchrow_hashref) { 
     
    246246    ); 
    247247    $sth->execute($id); 
    248      
     248 
    249249    my $res = $sth->fetchrow_hashref; 
    250250    $sth->finish; 
     
    330330 
    331331sub voting_info_id { 
    332     my ($self, $id, $voteid) = @_; 
    333  
    334     my $sth = $self->db->prepare_cached( 
    335         q{ 
    336         select * from voting where id = ? and poll = ? 
    337         } 
    338     ); 
    339     $sth->execute($id, $voteid); 
     332    my ($self, $mail, $voteid) = @_; 
     333 
     334    my $sth = $self->db->prepare_cached( 
     335        q{ 
     336        select * from voting where mail = ? and poll = ? 
     337        } 
     338    ); 
     339    $sth->execute($mail, $voteid); 
    340340    my $res = $sth->fetchrow_hashref(); 
    341341    $sth->finish; 
     
    344344 
    345345sub _register_signing { 
    346     my ($self, $vid, $voteid, $referal) = @_; 
    347  
    348     my $vinfo = $self->voting_info_id($vid, $voteid) or return; 
     346    my ($self, $mail, $voteid, $referal) = @_; 
     347 
     348    my $vinfo = $self->voting_info_id($mail, $voteid) or return; 
    349349 
    350350    my $sth = $self->db->prepare_cached( 
     
    464464 
    465465sub auth_voting { 
    466     my ($self, $poll, $user, $password) = @_; 
    467     my $userinfo = $self->voting_info_id($user, $poll) or return; 
     466    my ($self, $poll, $mail, $password) = @_; 
     467    my $userinfo = $self->voting_info_id($mail, $poll) or return; 
    468468 
    469469    $userinfo->{passwd} or return; 
     
    496496        select date from signing join voting 
    497497        on voting.key = signing.key 
    498         where poll = ? and id = ? 
     498        where poll = ? and mail = ? 
    499499        } 
    500500    ); 
     
    618618 
    619619sub addupd_voting { 
    620     my ($self, $voteid, $id, $mail) = @_; 
     620    my ($self, $voteid, $mail, $id) = @_; 
    621621 
    622622    my $upd = $self->db->prepare_cached( 
    623623        q{ 
    624         update voting set mail = ? where poll = ? and id = ? 
     624        update voting set label = ? where mail = ? and poll = ? 
    625625        } 
    626626    ); 
     
    628628    if ($upd->execute($mail, $voteid, $id) == 0) { 
    629629        my $add = $self->db->prepare_cached(q{ 
    630             insert into voting (poll, id, mail) values (?,?,?) 
     630            insert into voting (poll, label, mail) values (?,?,?) 
    631631        }); 
    632632 
     
    705705$voteinfo->{label} 
    706706 
    707 Votre identifiant est: $vinfo->{id} 
     707Votre identifiant est: $vinfo->{mail} 
    708708Votre mot de passe est: $passwd 
    709709 
Note: See TracChangeset for help on using the changeset viewer.