/[Frey]/branches/zimbardo/lib/App/RoomReservation/Messages.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/Messages.pm

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

trunk/lib/App/RoomReservation/Messages.pm revision 1152 by dpavlin, Wed Jul 1 22:25:11 2009 UTC branches/zimbardo/lib/App/RoomReservation/Messages.pm revision 1172 by dpavlin, Sun Jul 5 21:40:16 2009 UTC
# Line 4  use Moose::Role; Line 4  use Moose::Role;
4  sub seat_confirmation_message {  sub seat_confirmation_message {
5          my ( $self, $col, $value ) = @_;          my ( $self, $col, $value ) = @_;
6    
7          $col =~ s{token}{md5(id||email};          die "wrong column name $col = $value" unless $col =~ m{^(token|email)$};
8    
9            $col =~ s{token}{md5(id||email)};
10    
11          my $sth = $self->dbh->prepare(qq{          my $sth = $self->dbh->prepare(qq{
12                  select                  select
# Line 12  sub seat_confirmation_message { Line 14  sub seat_confirmation_message {
14                          _seat_number,                          _seat_number,
15                          email,                          email,
16                          md5(id||email) as token,                          md5(id||email) as token,
17                          _confirmed                          _confirmed,
18                            _canceled
19                  from reservation                  from reservation
20                  where                  where
21                          $col = ?                          $col = ?
# Line 20  sub seat_confirmation_message { Line 23  sub seat_confirmation_message {
23    
24          $sth->execute( $value );          $sth->execute( $value );
25    
26          die "can't find user $col = $value" if $sth->rows == 0;          die qq|<error>Can't find user $col = $value</error>| if $sth->rows == 0;
27    
28            my ( $name, $seat, $email, $token, $confirmed, $canceled ) = $sth->fetchrow_array;
29    
30            if ( $confirmed && $canceled ) {
31    
32          my ( $name, $seat, $email, $token, $confirmed ) = $sth->fetchrow_array;                  my $html =
33                    qq|
34                            $name, <em>you have canceled your reservation allready</em>
35                            <br>
36                            If you did that by mistake, and you want to attend this lecture, please
37                            contact us via e-mail.
38                    |;
39    
40                    $self->send( $email,
41                            "Lecture confirmation canceled",
42                            $html
43                    );
44    
45                    return $html;
46    
47          if ( $confirmed ) {          } elsif ( $confirmed ) {
48    
49                  my $url = $self->url_for( 'Confirmation/cancel_as_markup?token=' . $token );                  my $url = $self->url_for( 'Confirmation/cancel_as_markup?token=', $token );
50    
51                  my $html =                  my $html =
52                  qq|                  qq|
# Line 44  sub seat_confirmation_message { Line 64  sub seat_confirmation_message {
64                  ;                  ;
65    
66                  $self->send( $email,                  $self->send( $email,
67                          "Lecture confirmation" . $seat ? " [seat $seat]" : " [wating for vacancy]",                          "Lecture confirmation" . ( $seat ? " [seat $seat]" : " [wating for vacancy]" ),
68                          $html . <<__EMAIL__                          $html . <<__EMAIL__
69    
70  If you wish to cancel your reservation please click on link below:  If you wish to cancel your reservation please click on link below:
# Line 58  __EMAIL__ Line 78  __EMAIL__
78    
79          } else { # not verified          } else { # not verified
80    
81                  my $url = $self->url_for( 'Confirmation/verify_as_markup?token=' . $token );                  my $url = $self->url_for( 'Confirmation/verify_as_markup?token=', $token );
82    
83                  $self->send( $self->email,                  $self->send( $self->email,
84                          'Confirm your reservation for lecture', <<__EMAIL__                          'Confirm your reservation for lecture', <<__EMAIL__

Legend:
Removed from v.1152  
changed lines
  Added in v.1172

  ViewVC Help
Powered by ViewVC 1.1.26