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 |
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 = ? |
25 |
|
|
26 |
die "can't find user $col = $value" if $sth->rows == 0; |
die "can't find user $col = $value" if $sth->rows == 0; |
27 |
|
|
28 |
my ( $name, $seat, $email, $token, $confirmed ) = $sth->fetchrow_array; |
my ( $name, $seat, $email, $token, $confirmed, $canceled ) = $sth->fetchrow_array; |
29 |
|
|
30 |
|
if ( $confirmed && $canceled ) { |
31 |
|
|
32 |
|
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 |
|
|
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: |