/[Frey]/branches/zimbardo/lib/App/RoomReservation/Confirmation.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/zimbardo/lib/App/RoomReservation/Confirmation.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/lib/App/RoomReservation/Confirmation.pm revision 1151 by dpavlin, Wed Jul 1 21:47:04 2009 UTC branches/zimbardo/lib/App/RoomReservation/Confirmation.pm revision 1173 by dpavlin, Sun Jul 5 21:40:54 2009 UTC
# Line 33  sub verify_as_markup { Line 33  sub verify_as_markup {
33                  where                  where
34                          md5(id||email) = ?                          md5(id||email) = ?
35                          and _confirmed is false                          and _confirmed is false
36                            and _canceled is false
37          });          });
38    
39          $sth->execute( $self->token );          my $token = $self->token;
40    
41            $sth->execute( $token );
42    
43          if ( $sth->rows == 0 ) {          if ( $sth->rows == 0 ) {
44                  warn "can't confirm ", $self->token, " check if it's allready confirmed";                  warn "can't confirm ", $self->token, " check if it's allready confirmed";
# Line 46  sub verify_as_markup { Line 49  sub verify_as_markup {
49                                  md5(id||email) = ?                                  md5(id||email) = ?
50                                  and _confirmed is true                                  and _confirmed is true
51                  });                  });
52                  $sth->execute( $self->token );                  $sth->execute( $token );
53          }          }
54    
55          if ( $sth->rows == 1 ) {          if ( $sth->rows == 1 ) {
56    
57                  $sth = $dbh->prepare(qq{                  die qq|<error>can't find account associated with $token</error>| unless $sth->rows == 1;
                         select  
                                 ime||' '||prezime,  
                                 _seat_number,  
                                 email  
                         from reservation  
                         where  
                                 _confirmed is true  
 --                              and _seat_number is not null  
                                 and md5(id||email) = ?  
                 });  
   
                 $sth->execute( $self->token );  
   
                 die "can't find account associated with ", $self->token unless $sth->rows == 1;  
58    
59                  my @reservation = $sth->fetchrow_array;                  return $self->seat_confirmation_message( token => $token );
                 push @reservation,  
                         $self->url_for( 'Confirmation/cancel_as_markup?token=' . $self->token );  
   
                 return $self->seat_confirmation_message( @reservation );  
60    
61          } else {          } else {
62                  die "Problem with confirmation.\n";                  die qq|<error>Can't find confirmation $token<br>
63                            Did you copy-pasted whole URL in your browser?</error>|;
64          }          }
65  }  }
66    
# Line 86  sub cancel_as_markup { Line 72  sub cancel_as_markup {
72          my $sth = $dbh->prepare(qq{          my $sth = $dbh->prepare(qq{
73                  update reservation                  update reservation
74                  set                  set
75                          _confirmed = false,                          _canceled = true,
76                          _seat_number = null                          _seat_number = null
77                  where                  where
78                          md5(id||email) = ?                          md5(id||email) = ?
# Line 96  sub cancel_as_markup { Line 82  sub cancel_as_markup {
82    
83          if ( $sth->rows == 1 ) {          if ( $sth->rows == 1 ) {
84                  qq|                  qq|
85                          Your <em>reservation is canceled</em>, thanks for your effort to provide seat to somebody else                          Vaš <em>dolazak je odjavljen</em>.
86    
87                            Hvala što ste omogućili dolazak nekom drugom!
88                  |;                  |;
89          } else {          } else {
90                  die "Problem with cancelation.\n";                  die qq|<error>Can't find reservation which you are trying to cancel.<br>
91                            Did you copy-pasted whole URL in your browser?</error>|;
92          }          }
93  }  }
94    

Legend:
Removed from v.1151  
changed lines
  Added in v.1173

  ViewVC Help
Powered by ViewVC 1.1.26