Changeset 32


Ignore:
Timestamp:
03/14/09 20:43:51 (15 years ago)
Author:
nanardon
Message:
  • set some default values at poll creation
File:
1 edited

Legend:

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

    r30 r32  
    115115    my @online_f = qw(label start end owner password); 
    116116 
    117     my $sth = $self->db->prepare_cached( 
    118         q{update poll set } . 
    119         join(',', map { qq("$_" = ?) } grep { exists $attr{$_} } @online_f) . 
    120         q{ where id = ?} 
    121     ); 
    122     $sth->execute((map { $attr{$_} } grep { exists $attr{$_} } @online_f), $voteid) 
    123         or $self->db->rollback; 
     117    if (grep { exists($attr{$_}) } @online_f) { 
     118        my $sth = $self->db->prepare_cached( 
     119            q{update poll set } . 
     120            join(',', map { qq("$_" = ?) } grep { exists $attr{$_} } @online_f) . 
     121            q{ where id = ?} 
     122        ); 
     123        $sth->execute((map { $attr{$_} } grep { exists $attr{$_} } @online_f), $voteid) 
     124            or do { 
     125            $self->db->rollback; 
     126            return; 
     127        }; 
     128    } 
    124129 
    125130    # vote settings in settings table 
     
    726731 
    727732    $newpoll->execute($newpollid, $rinfo->{label}, $rinfo->{mail}, $encpasswd); 
     733    # set some default 
     734    $self->vote_param($newpollid, 
     735        free_choice => 0, 
     736        choice_count => 1, 
     737    );      
    728738 
    729739    my $delreq = $self->db->prepare_cached( 
Note: See TracChangeset for help on using the changeset viewer.